From 1c063bb83b736b452495a3baf7e7e2cabedc666e Mon Sep 17 00:00:00 2001 From: Brandon Ly Date: Thu, 30 Nov 2023 09:21:46 -0600 Subject: [PATCH] [DOP-4097]: Ensure we use the --no-caching flag for production builds (#940) * [DOP-4097]: Add no caching flag for ts command * [DOP-4097]: Add NO_CACHING flag to next-gen-parse for production jobHandler * [DOP-4097]: Add NO_CACHING flag to next-gen-parse to staging for testing * [DOP-4097]: Add the right shared.mk path for right dockerfile * [DOP-4097]: Revert * [DOP-4097]: Fix dockerfile * [DOP-4097]: Update comments --- src/commands/src/shared/next-gen-parse.ts | 15 +++++++++++++-- src/job/productionJobHandler.ts | 2 +- tests/data/data.ts | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/commands/src/shared/next-gen-parse.ts b/src/commands/src/shared/next-gen-parse.ts index fc1847ec9..5fd6b6c01 100644 --- a/src/commands/src/shared/next-gen-parse.ts +++ b/src/commands/src/shared/next-gen-parse.ts @@ -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 { +export async function nextGenParse({ + repoDir, + patchId, + commitHash, + isProd, +}: NextGenParseParams): Promise { const commandArgs = ['build', repoDir, '--output', `${repoDir}/bundle.zip`, RSTSPEC_FLAG]; if (patchId) { @@ -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) { + commandArgs.push('--no-caching'); + } + return executeCliCommand({ command: 'snooty', args: commandArgs }); } diff --git a/src/job/productionJobHandler.ts b/src/job/productionJobHandler.ts index 8a394cd1c..b92cb3911 100644 --- a/src/job/productionJobHandler.ts +++ b/src/job/productionJobHandler.ts @@ -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}`); diff --git a/tests/data/data.ts b/tests/data/data.ts index b9aa9251f..ace634776 100644 --- a/tests/data/data.ts +++ b/tests/data/data.ts @@ -145,7 +145,7 @@ export class TestDataProvider { const genericCommands = TestDataProvider.getCommonBuildCommands(job); return Array().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}`,