Skip to content

Commit

Permalink
DOP-4451 undoing prefix changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Apr 9, 2024
1 parent 49b2f0c commit ce27d06
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
13 changes: 4 additions & 9 deletions src/job/jobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,12 @@ export abstract class JobHandler {
@throwIfJobInterupted()
private async constructPrefix(): Promise<void> {
const server_user = this._config.get<string>('GATSBY_PARSER_USER');
// const pathPrefix = this.getPathPrefix();
const pathPrefix = '';
// let pathPrefix;
// if (this.currJob.payload.newHead && this.currJob.payload.action == 'automatedTest') {
// pathPrefix = `${prePrefix}/${this.currJob.payload.newHead}`;
// } else pathPrefix = prePrefix;
const pathPrefix = await this.getPathPrefix();
// TODO: Can empty string check be removed?
if (pathPrefix || pathPrefix === '') {
const mutPrefix = pathPrefix.split(`/${server_user}`)[0];
this.currJob.payload.mutPrefix = `slackPrefix`;
this.currJob.payload.pathPrefix = pathPrefix;
this._logger.save(this.currJob._id, `${mutPrefix}, prePrefix: ${pathPrefix}, server user: ${server_user}`);
const mutPrefix = pathPrefix.split(`/${server_user}`)[0];
this.currJob.payload.mutPrefix = mutPrefix;
}
}

Expand Down
25 changes: 15 additions & 10 deletions src/job/productionJobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,22 @@ export class ProductionJobHandler extends JobHandler {
}

getPathPrefix(): string {
const prefix = this.currJob.payload.urlSlug
? `${this.currJob.payload.prefix}/${this.currJob.payload.urlSlug}`
: this.currJob.payload.prefix;
this.logger.save(
this.currJob._id,
`current job prefix ${prefix}, newHead ${this.currJob.payload.newHead} & action ${this.currJob.payload.action}`
);
if (this.currJob.payload.newHead && this.currJob.payload.action == 'automatedTest') {
return `${prefix}/${this.currJob.payload.newHead}`;
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);
}
return prefix;
}

private async purgePublishedContent(makefileOutput: Array<string>): Promise<void> {
Expand Down
3 changes: 1 addition & 2 deletions src/job/stagingJobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ export class StagingJobHandler extends JobHandler {
prepDeployCommands(): void {
this.currJob.deployCommands = [
`cd repos/${getDirectory(this.currJob)}`,
// `make next-gen-stage ${this.currJob.payload.pathPrefix ? ` MUT_PREFIX=${this.currJob.payload.mutPrefix}` : ''}`,
`make next-gen-stage ${true ? `MUT_PREFIX=${this.currJob.payload.mutPrefix}` : ''}`,
`make next-gen-stage${this.currJob.payload.pathPrefix ? `MUT_PREFIX=${this.currJob.payload.mutPrefix}` : ''}`,
];
}

Expand Down

0 comments on commit ce27d06

Please sign in to comment.