Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 6180699

Browse files
DOP-4401-c: Add commit hash to path for Smoke Test Deploys (#1018)
* 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
1 parent 6d698e2 commit 6180699

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

src/job/jobHandler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export abstract class JobHandler {
153153
// TODO: Can empty string check be removed?
154154
if (pathPrefix || pathPrefix === '') {
155155
this.currJob.payload.pathPrefix = pathPrefix;
156+
//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)
156157
const mutPrefix = pathPrefix.split(`/${server_user}`)[0];
157158
this.currJob.payload.mutPrefix = mutPrefix;
158159
}

src/job/productionJobHandler.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -141,22 +141,15 @@ export class ProductionJobHandler extends JobHandler {
141141
}
142142

143143
getPathPrefix(): string {
144-
try {
145-
if (this.currJob.payload.prefix && this.currJob.payload.prefix === '') {
146-
return this.currJob.payload.urlSlug ?? '';
147-
}
148-
if (this.currJob.payload.urlSlug) {
149-
if (this.currJob.payload.urlSlug === '') {
150-
return this.currJob.payload.prefix;
151-
} else {
152-
return `${this.currJob.payload.prefix}/${this.currJob.payload.urlSlug}`;
153-
}
154-
}
155-
return this.currJob.payload.prefix;
156-
} catch (error) {
157-
this.logger.save(this.currJob._id, error).then();
158-
throw new InvalidJobError(error.message);
144+
const prefix = this.currJob.payload.urlSlug
145+
? `${this.currJob.payload.prefix}/${this.currJob.payload.urlSlug}`
146+
: this.currJob.payload.prefix;
147+
if (this.currJob.payload.action == 'automatedTest') {
148+
const titleArray = this.currJob.title.split(' ');
149+
const commitHash = titleArray[titleArray.length - 5];
150+
return `${prefix}/smokeTests/${commitHash}`;
159151
}
152+
return prefix;
160153
}
161154

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

0 commit comments

Comments
 (0)