diff --git a/.github/workflows/deploy-stg-ecs.yml b/.github/workflows/deploy-stg-ecs.yml index 55c5630b3..56680cbe8 100644 --- a/.github/workflows/deploy-stg-ecs.yml +++ b/.github/workflows/deploy-stg-ecs.yml @@ -3,6 +3,7 @@ on: branches: - "master" - "integration" + - "DOP-4127-no-makefiles" concurrency: group: environment-stg-${{ github.ref }} cancel-in-progress: true diff --git a/Dockerfile.local b/Dockerfile.local index 7e34e5da4..74709aa9a 100644 --- a/Dockerfile.local +++ b/Dockerfile.local @@ -57,7 +57,7 @@ RUN chown -Rv docsworker-xlarge ${WORK_DIRECTORY} USER docsworker-xlarge # install snooty frontend and docs-tools -RUN git clone -b v${SNOOTY_FRONTEND_VERSION} --depth 1 https://github.com/mongodb/snooty.git \ +RUN git clone -b mm-log --depth 1 https://github.com/mongodb/snooty.git \ && cd snooty \ && npm ci --legacy-peer-deps --omit=dev diff --git a/src/commands/src/helpers/dependency-helpers.ts b/src/commands/src/helpers/dependency-helpers.ts index 5dd5e9099..938f4cf71 100644 --- a/src/commands/src/helpers/dependency-helpers.ts +++ b/src/commands/src/helpers/dependency-helpers.ts @@ -44,17 +44,23 @@ async function createEnvProdFile( ) { const prodFileName = `${process.cwd()}/snooty/.env.production`; const prodDirName = repoDir; - // const prodSnootyFileName = `${prodDirName}snooty/.env.production`; logger(`PRODFILENAME ${prodFileName}`); logger(`PRODDIRNAME: ${prodDirName}`); + logger(`write Env Prod File: \nGATSBY_SITE=${projectName}\n + GATSBY_MANIFEST_PATH=${prodDirName}/bundle.zip\n + GATSBY_PARSER_USER=docsworker-xlarge\n + GATSBY_BASE_URL=${baseUrl}\n + GATSBY_MARIAN_URL=${process.env.GATSBY_MARIAN_URL}\n + PATH_PREFIX=${prefix}\n + 'utf8'\n`); try { await writeFileAsync( prodFileName, `GATSBY_SITE=${projectName} GATSBY_MANIFEST_PATH=${prodDirName}/bundle.zip - GATSBY_PARSER_USER=${process.env.USER} + GATSBY_PARSER_USER=docsworker-xlarge GATSBY_BASE_URL=${baseUrl} GATSBY_MARIAN_URL=${process.env.GATSBY_MARIAN_URL} PATH_PREFIX=${prefix}`, diff --git a/src/commands/src/scripts/local-build/index.ts b/src/commands/src/scripts/local-build/index.ts index 70be9b0d9..236142cfc 100644 --- a/src/commands/src/scripts/local-build/index.ts +++ b/src/commands/src/scripts/local-build/index.ts @@ -68,8 +68,6 @@ async function main() { const db = connectedDbClient.db(env.DB_NAME); const collection = db.collection(env.JOB_QUEUE_COL_NAME); - console.log('BRANCH NAME?!?!? ', branchName); - const consoleLogger = new ConsoleLogger(); const docsetsRepository = new DocsetsRepository(db, c, consoleLogger); diff --git a/src/commands/src/scripts/local-build/utils/create-job.ts b/src/commands/src/scripts/local-build/utils/create-job.ts index 883ff856f..f9e58f776 100644 --- a/src/commands/src/scripts/local-build/utils/create-job.ts +++ b/src/commands/src/scripts/local-build/utils/create-job.ts @@ -37,6 +37,7 @@ export function createLocalJob({ branchName, repoName, repoOwner, commit, projec project: project, // Needs to get the project rather than repo name pathPrefix: `${project}/docsworker-xlarge/${branchName}`, mutPrefix: project, + directory: 'cloud-docs', }, logs: [], }; diff --git a/src/commands/src/shared/next-gen-html.ts b/src/commands/src/shared/next-gen-html.ts index 748c984f9..ec71dc104 100644 --- a/src/commands/src/shared/next-gen-html.ts +++ b/src/commands/src/shared/next-gen-html.ts @@ -29,6 +29,14 @@ export async function nextGenHtml({ job, preppedLogger }: { job: Job; preppedLog }); preppedLogger(`Result of pwd: ${pwd.outputText}\n ${pwd.errorText}`); + // rsync -az --exclude '.git' "${PATH_TO_SNOOTY}" "${REPO_DIR}" + // const rysnc = await executeCliCommand({ + // command: 'rsync', + // args: [`-az --exclude .git ${process.cwd()}/snooty ${repoDir}`], + // logger: preppedLogger, + // }); + // preppedLogger(`Result of rsync: ${rysnc.outputText}\n ${rysnc.errorText}`); + // preppedLogger(`Now cd into snooty: cd ${process.cwd()}/snooty`); // const secondResult = await executeCliCommand({ // command: 'cd', @@ -63,13 +71,24 @@ export async function nextGenHtml({ job, preppedLogger }: { job: Job; preppedLog // process.chdir(`../`); // preppedLogger(`new pwd out of snooty? ${process.cwd()}`); - preppedLogger(`Now running second cp command: cp -r ${process.cwd()}/snooty/public ${repoDir}}`); - const lastResult = await executeCliCommand({ - command: 'cp', - args: [`-r`, `${process.cwd()}/snooty/public`, `${repoDir}`], - logger: preppedLogger, - }); - preppedLogger(`Result of last cp : ${lastResult.outputText}\n ${lastResult.errorText}`); + // await executeCliCommand({ + // command: 'ls', + // options: { cwd: `${process.cwd()}/snooty/public` }, + // logger: preppedLogger, + // }); + + // await executeCliCommand({ + // command: 'ls', + // options: { cwd: `${process.cwd()}/snooty/public/page-data` }, + // logger: preppedLogger, + // }); + // preppedLogger(`Now running second cp command: cp -r ${process.cwd()}/snooty/public ${repoDir}}`); + // const lastResult = await executeCliCommand({ + // command: 'cp', + // args: [`-r`, `${process.cwd()}/snooty/public`, `${repoDir}`], + // logger: preppedLogger, + // }); + // preppedLogger(`Result of last cp : ${lastResult.outputText}\n ${lastResult.errorText}`); return result; } diff --git a/src/commands/src/shared/next-gen-parse.ts b/src/commands/src/shared/next-gen-parse.ts index c90a326ea..f97ec3249 100644 --- a/src/commands/src/shared/next-gen-parse.ts +++ b/src/commands/src/shared/next-gen-parse.ts @@ -35,7 +35,12 @@ export async function nextGenParse({ job, preppedLogger, isProd }: NextGenParseP } try { - return await executeCliCommand({ command: 'snooty', args: commandArgs, logger: preppedLogger }); + return await executeCliCommand({ + command: 'snooty', + args: commandArgs, + options: { cwd: repoDir }, + logger: preppedLogger, + }); } catch (error) { preppedLogger(`ERROR: ${error}\n\n`); } diff --git a/src/commands/src/shared/next-gen-stage.ts b/src/commands/src/shared/next-gen-stage.ts index 065bdff70..d9f6c7b9b 100644 --- a/src/commands/src/shared/next-gen-stage.ts +++ b/src/commands/src/shared/next-gen-stage.ts @@ -1,5 +1,5 @@ import { Job } from '../../../entities/job'; -import { executeCliCommand } from '../helpers'; +import { executeCliCommand, getRepoDir } from '../helpers'; const DOCS_WORKER_USER = 'docsworker-xlarge'; interface StageParams { @@ -28,12 +28,19 @@ export async function nextGenStage({ job, preppedLogger, bucket, url }: StagePar preppedLogger(`MUT PUBLISH command args: ${commandArgs}`); + const repoDir = getRepoDir(job.payload.repoName, job.payload.directory); + try { + await executeCliCommand({ + command: 'cp', + args: ['-r', `${process.cwd()}/snooty/public`, repoDir], + }); + const { outputText } = await executeCliCommand({ command: 'mut-publish', args: commandArgs, options: { - cwd: `${process.cwd()}/snooty`, + cwd: repoDir, }, logger: preppedLogger, }); diff --git a/src/commands/src/shared/oas-page-build.ts b/src/commands/src/shared/oas-page-build.ts index 6c68d56cc..9402dc608 100644 --- a/src/commands/src/shared/oas-page-build.ts +++ b/src/commands/src/shared/oas-page-build.ts @@ -24,7 +24,7 @@ export async function oasPageBuild({ job, preppedLogger }: OasPageBuildParams) { const { outputText } = await executeCliCommand({ command: 'node', args: [ - `${process.cwd()}/modules/oas-page-builder/index.js`, // There was a Fix dist/index.js + `${process.cwd()}/modules/oas-page-builder/index.js`, // There was a Fix dist/index.js (dist needed for preprd, not for local) '--bundle', bundlePath, '--output', diff --git a/src/entities/job.ts b/src/entities/job.ts index d09ca1c96..acb51eaf4 100644 --- a/src/entities/job.ts +++ b/src/entities/job.ts @@ -72,6 +72,7 @@ export type EnhancedPayload = { prefix: string; project: string; includeInGlobalSearch?: boolean; + directory?: string; }; export type Job = { diff --git a/src/job/jobHandler.ts b/src/job/jobHandler.ts index 72b3e5bc2..cae93b5ee 100644 --- a/src/job/jobHandler.ts +++ b/src/job/jobHandler.ts @@ -582,7 +582,8 @@ export abstract class JobHandler { 'https://mongodbcom-cdn.website.staging.corp.mongodb.com', this._currJob.payload.branchName, (message: string) => this._logger.save(this._currJob._id, message), - this._currJob.payload.newHead + this._currJob.payload.newHead, + this._currJob.payload.directory ); await this.setEnvironmentVariables(); this._logger.save(this._currJob._id, 'Prepared Environment variables'); diff --git a/src/job/stagingJobHandler.ts b/src/job/stagingJobHandler.ts index 59bc02142..efe25a2e3 100644 --- a/src/job/stagingJobHandler.ts +++ b/src/job/stagingJobHandler.ts @@ -81,7 +81,8 @@ export class StagingJobHandler extends JobHandler { 'https://mongodbcom-cdn.website.staging.corp.mongodb.com', this.currJob.payload.branchName, (message: string) => this.logger.save(this.currJob._id, message), - this.currJob.payload.newHead + this.currJob.payload.newHead, + this.currJob.payload.directory ); // await this.pullRepo(); // this._logger.save(this._currJob._id, 'Pulled Repo');