Skip to content

Commit

Permalink
used process.env to find URL and BUCKET
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeigs committed Nov 29, 2023
1 parent a2e9a64 commit 02aba79
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
27 changes: 23 additions & 4 deletions src/commands/src/shared/next-gen-deploy.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { executeAndPipeCommands, executeCliCommand } from '../helpers';

interface NextGenDeployParams {
bucket: string;
// bucket: string;
mutPrefix: string;
gitBranch: string;
hasConfigRedirects: boolean;
url: string;
// url: string;
preppedLogger: (message: string) => void;
}

export async function nextGenDeploy({
bucket,
// bucket,
mutPrefix,
gitBranch,
hasConfigRedirects,
url,
// url,
preppedLogger,
}: NextGenDeployParams) {
try {
Expand All @@ -23,6 +23,25 @@ export async function nextGenDeploy({
await executeCliCommand({ command: 'mut-redirects', args: ['config/redirects', '-o', 'public/.htaccess'] });
}

const bucket = process.env.BUCKET;
const url = process.env.URL;
if (!bucket) {
preppedLogger(`nextGenDeploy has failed. Variable for S3 bucket address was undefined.`);
return {
status: 'failure',
output: 'Failed in nextGenDeploy: No value present for S3 bucket',
error: 'No value present for S3 bucket.',
};
}
if (!url) {
preppedLogger(`nextGenDeploy has failed. Variable for URL address was undefined.`);
return {
status: 'failure',
output: 'Failed in nextGenDeploy: No value present for target url.',
error: 'No value present for URL.',
};
}

// equivalent to: yes | mut-publish public ${BUCKET} --prefix=${MUT_PREFIX} --deploy --deployed-url-prefix=${URL} --json --all-subdirectories ${ARGS};
const { outputText } = await executeAndPipeCommands(
{ command: 'yes' },
Expand Down
4 changes: 2 additions & 2 deletions src/job/jobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ export abstract class JobHandler {
'https://mongodbcom-cdn.website.staging.corp.mongodb.com',
(message: string) => this._logger.save(this._currJob._id, message)
);
// await this.setEnvironmentVariables();
// this._logger.save(this._currJob._id, 'Prepared Environment variables');
await this.setEnvironmentVariables();
this._logger.save(this._currJob._id, 'Prepared Environment variables');
return await this.executeBuild();
}

Expand Down
4 changes: 2 additions & 2 deletions src/job/stagingJobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ export class StagingJobHandler extends JobHandler {
});
this.logger.save(this.currJob._id, `Now to deploy `);
await nextGenDeploy({
bucket: 'docs-atlas-dotcomstg',
// bucket: 'docs-atlas-dotcomstg',
gitBranch: this.currJob.payload.branchName,
mutPrefix: this.currJob.mutPrefix || '',
hasConfigRedirects: hasConfigRedirects,
preppedLogger: (message: string) => this.logger.save(this.currJob._id, message),
url: 'https://mongodbcom-cdn.website.staging.corp.mongodb.com',
// url: 'https://mongodbcom-cdn.website.staging.corp.mongodb.com',
});
// resp = await this.deployGeneric();
}
Expand Down

0 comments on commit 02aba79

Please sign in to comment.