Skip to content

Commit

Permalink
DOP-4401-c: Add commit hash to path for Smoke Test Deploys (#1018)
Browse files Browse the repository at this point in the history
* DOP-4401-c initial changes

* DOP-4414 undoing changes for testing

* DOP-4401-c refactor pathprefix

* DOP-4401-c playing with mut prefix

* DOP-4401-c mut prefix

* DOP-4401-c undoing pathprefix conditional

* DOP-4401-c redoing path prefix conditional and populating pathPrefix

* DOP-4401-c redoing path prefix conditional but depopulating path prefix

* DOP-4401-c adding a space in next-gen-stage argument

* DOP-4401-c pushing to preprd

* DOP-4401-c removing from preprd

* DOP-4401-c pushing to preprd

* DOP-4401-c playing with pathprefix

* DOP-4401-c playing with pathprefix

* DOP-4401-c setting mutPrefix to prePrefix

* DOP-4401-c adding slack deploy to the end of mutprefix

* DOP-4401-c implementing changes test on 4414

* DOP-4401-c reverting conditional amended for testing
  • Loading branch information
anabellabuckvar authored Apr 17, 2024
1 parent 6d698e2 commit 6180699
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/job/jobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export abstract class JobHandler {
// TODO: Can empty string check be removed?
if (pathPrefix || pathPrefix === '') {
this.currJob.payload.pathPrefix = pathPrefix;
//sets mutPrefix to the full pathPrefix unless server user is in the path (I believe this only happens in a subset of cases when docs-worker-xlarge is the server-user)
const mutPrefix = pathPrefix.split(`/${server_user}`)[0];
this.currJob.payload.mutPrefix = mutPrefix;
}
Expand Down
23 changes: 8 additions & 15 deletions src/job/productionJobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,15 @@ export class ProductionJobHandler extends JobHandler {
}

getPathPrefix(): string {
try {
if (this.currJob.payload.prefix && this.currJob.payload.prefix === '') {
return this.currJob.payload.urlSlug ?? '';
}
if (this.currJob.payload.urlSlug) {
if (this.currJob.payload.urlSlug === '') {
return this.currJob.payload.prefix;
} else {
return `${this.currJob.payload.prefix}/${this.currJob.payload.urlSlug}`;
}
}
return this.currJob.payload.prefix;
} catch (error) {
this.logger.save(this.currJob._id, error).then();
throw new InvalidJobError(error.message);
const prefix = this.currJob.payload.urlSlug
? `${this.currJob.payload.prefix}/${this.currJob.payload.urlSlug}`
: this.currJob.payload.prefix;
if (this.currJob.payload.action == 'automatedTest') {
const titleArray = this.currJob.title.split(' ');
const commitHash = titleArray[titleArray.length - 5];
return `${prefix}/smokeTests/${commitHash}`;
}
return prefix;
}

private async purgePublishedContent(makefileOutput: Array<string>): Promise<void> {
Expand Down

0 comments on commit 6180699

Please sign in to comment.