Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOP-4097]: Ensure we use the --no-caching flag for production builds #940

Merged
merged 9 commits into from
Nov 30, 2023
15 changes: 13 additions & 2 deletions src/commands/src/shared/next-gen-parse.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { CliCommandResponse, executeCliCommand } from '../helpers';

const RSTSPEC_FLAG = '--rstspec=https://raw.githubusercontent.com/mongodb/snooty-parser/latest/snooty/rstspec.toml';

interface NextGenParseParams {
repoDir: string;
commitHash: string;
patchId?: string;
isProd?: boolean;
}
export async function nextGenParse({ repoDir, patchId, commitHash }: NextGenParseParams): Promise<CliCommandResponse> {
export async function nextGenParse({
repoDir,
patchId,
commitHash,
isProd,
}: NextGenParseParams): Promise<CliCommandResponse> {
const commandArgs = ['build', repoDir, '--output', `${repoDir}/bundle.zip`, RSTSPEC_FLAG];

if (patchId) {
Expand All @@ -18,5 +23,11 @@ export async function nextGenParse({ repoDir, patchId, commitHash }: NextGenPars
commandArgs.push(patchId);
}

// Not currently used in production builds, adding functionality
// now so that it is available when it is.
if (isProd) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, this is for when we do use this export fn nextGenParse for prod, since this is not being used yet. can we add a comment for this?

commandArgs.push('--no-caching');
}

return executeCliCommand({ command: 'snooty', args: commandArgs });
}
2 changes: 1 addition & 1 deletion src/job/productionJobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class ProductionJobHandler extends JobHandler {
prepStageSpecificNextGenCommands(): void {
if (this.currJob?.buildCommands) {
this.currJob.buildCommands[this.currJob.buildCommands.length - 1] = 'make get-build-dependencies';
this.currJob.buildCommands.push('make next-gen-parse');
this.currJob.buildCommands.push('make next-gen-parse NO_CACHING=--no-caching');
this.currJob.buildCommands.push(`make persistence-module JOB_ID=${this.currJob._id}`);
this.currJob.buildCommands.push('make next-gen-html');
this.currJob.buildCommands.push(`make oas-page-build MUT_PREFIX=${this.currJob.payload.mutPrefix}`);
Expand Down
2 changes: 1 addition & 1 deletion tests/data/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class TestDataProvider {
const genericCommands = TestDataProvider.getCommonBuildCommands(job);
return Array<string>().concat(genericCommands.slice(0, genericCommands.length - 1), [
'make get-build-dependencies',
'make next-gen-parse',
'make next-gen-parse NO_CACHING=--no-caching',
`make persistence-module JOB_ID=${job._id}`,
'make next-gen-html',
`make oas-page-build MUT_PREFIX=${job.payload.mutPrefix}`,
Expand Down
Loading