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

Commit 1a48224

Browse files
authored
DOP-3304, DOP-3335, DOP-3359: update manifest job handler to use snooty manifest (#705)
* DOP-3304: update manifest job handler to use snooty manifest * call parse only during manifest job * exclude the 404 and meta sites from search * DOP-3359: fix global search flags? * fix test * update mut to v0.10.2 so slugs are correct * fix path * idiomaticness ++
1 parent 3d65114 commit 1a48224

File tree

12 files changed

+38
-95
lines changed

12 files changed

+38
-95
lines changed

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ RUN /venv/bin/pip install -r https://raw.githubusercontent.com/mongodb/docs-tool
3434
RUN apt-get update && apt-get install -y python3 python3-dev python3-pip
3535
RUN apt-get -y install vim
3636
RUN apt-get -y install git pkg-config libxml2-dev
37-
RUN python3 -m pip install -r https://raw.githubusercontent.com/mongodb/mut/master/requirements.txt
37+
RUN python3 -m pip install https://github.com/mongodb/mut/releases/download/v0.10.2/mut-0.10.2-py3-none-any.whl
38+
39+
3840
ENV PATH="${PATH}:/home/docsworker-xlarge/.local/bin:/usr/local/lib/python2.7/dist-packages/virtualenv/bin"
3941

4042
# get node 14
@@ -65,7 +67,7 @@ RUN git clone -b v${SNOOTY_PARSER_VERSION} --depth 1 https://github.com/mongodb/
6567

6668
# install snooty frontend and docs-tools
6769
RUN git clone -b v${SNOOTY_FRONTEND_VERSION} --depth 1 https://github.com/mongodb/snooty.git \
68-
&& cd snooty \ \
70+
&& cd snooty \
6971
&& npm install \
7072
&& git clone --depth 1 https://github.com/mongodb/docs-tools.git \
7173
&& mkdir -p ./static/images \

api/controllers/v1/slack.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,11 @@ export const getDeployableJobs = async (values, entitlement, branchRepository: B
140140
urlSlug,
141141
false,
142142
false,
143-
'-g'
143+
false
144144
);
145145

146+
newPayload.stable = !!isStableBranch;
147+
146148
if (!aliases || aliases.length === 0) {
147149
if (non_versioned) {
148150
newPayload.urlSlug = '';
@@ -151,8 +153,6 @@ export const getDeployableJobs = async (values, entitlement, branchRepository: B
151153
continue;
152154
}
153155

154-
// if this is stable branch, we want autobuilder to know this is unaliased branch and therefore can reindex for search
155-
newPayload.stable = isStableBranch ? '-g' : '';
156156
newPayload.aliased = true;
157157

158158
// we use the primary alias for indexing search, not the original branch name (ie 'master'), for aliased repos
@@ -174,7 +174,7 @@ export const getDeployableJobs = async (values, entitlement, branchRepository: B
174174

175175
aliases.forEach(async (alias: string) => {
176176
if (alias !== urlSlug) {
177-
newPayload.stable = '';
177+
newPayload.stable = false;
178178
newPayload.urlSlug = alias;
179179
newPayload.primaryAlias = false;
180180
deployHelper(deployable, newPayload, jobTitle, jobUserName, jobUserEmail);
@@ -231,7 +231,7 @@ function createPayload(
231231
urlSlug,
232232
aliased = false,
233233
primaryAlias = false,
234-
stable = ''
234+
stable = false
235235
) {
236236
return {
237237
jobType,

src/entities/job.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export type Payload = {
3636
aliased: boolean | null | undefined;
3737
primaryAlias: string | null | undefined;
3838
repoBranches: any;
39-
stable: string | null | undefined;
39+
stable: boolean | null | undefined;
4040
isNextGen: boolean | null | undefined;
4141
regression: boolean | null | undefined;
4242
urlSlug: string | null | undefined;

src/job/jobHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ export abstract class JobHandler {
442442
// based on information about this build&deploy job
443443
// TODO: Give 'shouldGenerateSearchManifest' boolean to users' control
444444
shouldGenerateSearchManifest(): boolean {
445-
const doNotSearchProperties = ['docs-landing'];
445+
const doNotSearchProperties = ['docs-landing', 'docs-404', 'docs-meta'];
446446
if (doNotSearchProperties.includes(this.currJob.payload.repoName)) {
447447
return false;
448448
}

src/job/manifestJobHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ export class ManifestJobHandler extends JobHandler {
9494
`cd repos/${this.currJob.payload.repoName}`,
9595
'echo IGNORE: testing manifest generation deploy commands',
9696
'ls -al',
97-
`mut-index upload public -b ${b} -o ${f}/${maP}.json -u ${jUaP(url, muP)} ${globalSearch}`,
97+
`mut-index upload bundle.zip -b ${b} -o ${f}/${maP}.json -u ${jUaP(url, muP)} ${globalSearch}`,
9898
];
9999
}
100100

101101
// TODO: Can this function be merged with prepBuildCommands?
102102
prepStageSpecificNextGenCommands(): void {
103103
if (this.currJob?.buildCommands) {
104104
this.currJob.buildCommands[this.currJob.buildCommands.length - 1] = 'make get-build-dependencies';
105-
this.currJob.buildCommands.push('make next-gen-html');
105+
this.currJob.buildCommands.push('make next-gen-parse');
106106
}
107107
}
108108

src/job/productionJobHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class ProductionJobHandler extends JobHandler {
5454
] = `make next-gen-deploy MUT_PREFIX=${this.currJob.payload.mutPrefix}`;
5555
// TODO: Remove when satisfied with new manifestJobHandler infrastructure
5656
if (manifestPrefix) {
57-
const searchFlag = this.currJob.payload.stable;
57+
const searchFlag = this.currJob.payload.stable ? '-g' : '';
5858
this.currJob.deployCommands[
5959
this.currJob.deployCommands.length - 1
6060
] += ` MANIFEST_PREFIX=${manifestPrefix} GLOBAL_SEARCH_FLAG=${searchFlag}`;

tests/data/data.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ export class TestDataProvider {
148148
]);
149149
}
150150

151+
static getExpectedManifestBuildNextGenCommands(job: Job): Array<string> {
152+
const genericCommands = TestDataProvider.getCommonBuildCommands(job);
153+
return Array<string>().concat(genericCommands.slice(0, genericCommands.length - 1), [
154+
'make get-build-dependencies',
155+
'make next-gen-parse',
156+
]);
157+
}
158+
151159
static getExpectedStagingBuildNextGenCommands(job: Job): Array<string> {
152160
const genericCommands = TestDataProvider.getCommonBuildCommands(job);
153161
const commands = Array<string>().concat(genericCommands.slice(0, genericCommands.length - 1), [
@@ -283,9 +291,8 @@ export class TestDataProvider {
283291
]);
284292
if (job.payload.manifestPrefix) {
285293
// TODO: is job.payload.stableBranch supposed to be includeInGlobalSearch?
286-
ret[
287-
ret.length - 1
288-
] += ` MANIFEST_PREFIX=${job.payload.manifestPrefix} GLOBAL_SEARCH_FLAG=${job.payload.stableBranch}`;
294+
const stable = job.payload.stable ? '-g' : '';
295+
ret[ret.length - 1] += ` MANIFEST_PREFIX=${job.payload.manifestPrefix} GLOBAL_SEARCH_FLAG=${stable}`;
289296
}
290297
return ret;
291298
}

tests/data/fullDoc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default {
4141
url: 'https://github.com/mongodb/docs-java',
4242
newHead: null,
4343
primaryAlias: true,
44-
stable: '',
44+
stable: false,
4545
},
4646
logs: [
4747
'* Starting Job with ID: 6228fbb8f8498d4be9c237f9 and type: productionDeploy',

tests/data/fullDocWrongUrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default {
4141
url: 'https://github.com/mongodb/docs-java',
4242
newHead: null,
4343
primaryAlias: true,
44-
stable: '',
44+
stable: false,
4545
},
4646
logs: [
4747
'* Starting Job with ID: 6228fbb8f8498d4be9c237f9 and type: productionDeploy',

tests/jobManager.integration.test.ts

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)