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

Commit 28ef394

Browse files
authored
DOP-3437: Remove DevHub code from Autobuilder (#772)
1 parent 1ddaf72 commit 28ef394

File tree

6 files changed

+2
-97
lines changed

6 files changed

+2
-97
lines changed

api/controllers/v1/dochub.ts

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { FastlyConnector } from '../../../src/services/cdn';
22
import { ConsoleLogger } from '../../../src/services/logger';
33
import { CDNCreds } from '../../../src/entities/creds';
4-
import * as c from 'config';
5-
import * as crypto from 'crypto';
6-
import * as mongodb from 'mongodb';
7-
import { JobRepository } from '../../../src/repositories/jobRepository';
84

95
export const UpsertEdgeDictionaryItem = async (event: any = {}): Promise<any> => {
106
const body = JSON.parse(event.body);
@@ -22,63 +18,3 @@ export const UpsertEdgeDictionaryItem = async (event: any = {}): Promise<any> =>
2218
body: 'success',
2319
};
2420
};
25-
26-
async function prepDochubPushPayload() {
27-
return {
28-
title: 'DevHub CMS Prod Build',
29-
user: 'jestapinski',
30-
31-
status: 'inQueue',
32-
createdTime: new Date(),
33-
startTime: null,
34-
endTime: null,
35-
priority: 1,
36-
error: {},
37-
result: null,
38-
payload: {
39-
jobType: 'productionDeploy',
40-
source: 'strapi',
41-
action: 'push',
42-
repoName: 'devhub-content',
43-
branchName: 'master',
44-
isFork: true,
45-
private: true,
46-
isXlarge: true,
47-
repoOwner: '10gen',
48-
url: 'https://github.com/10gen/devhub-content',
49-
newHead: null,
50-
urlSlug: null,
51-
prefix: '',
52-
project: 'devhub-content',
53-
},
54-
logs: [],
55-
};
56-
}
57-
58-
export const TriggerBuild = async (event: any = {}, context: any = {}): Promise<any> => {
59-
const client = new mongodb.MongoClient(c.get('dbUrl'));
60-
await client.connect();
61-
const db = client.db(c.get('dbName'));
62-
const consoleLogger = new ConsoleLogger();
63-
const jobRepository = new JobRepository(db, c, consoleLogger);
64-
// TODO: Make job be of type Job
65-
const job = await prepDochubPushPayload();
66-
67-
try {
68-
consoleLogger.info(job.title, 'Creating Job');
69-
const jobId = await jobRepository.insertJob(job, c.get('jobsQueueUrl'));
70-
consoleLogger.info(job.title, `Created Job ${jobId}`);
71-
return {
72-
statusCode: 202,
73-
headers: { 'Content-Type': 'text/plain' },
74-
body: jobId,
75-
};
76-
} catch (err) {
77-
consoleLogger.error('TriggerBuild', err);
78-
return {
79-
statusCode: 500,
80-
headers: { 'Content-Type': 'text/plain' },
81-
body: err.message,
82-
};
83-
}
84-
};

infrastructure/ecs-main/ecs_service.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ Resources:
5252
Value: ${self:custom.npmBase64Auth}
5353
- Name: NPM_EMAIL
5454
Value: ${self:custom.npmEmail}
55-
- Name: AWS_ACCESS_KEY_ID_DEVHUB
56-
Value: ${self:custom.awsKeyDevhub}
57-
- Name: AWS_SECRET_ACCESS_KEY_DEVHUB
58-
Value: ${self:custom.awsSecretDevhub}
5955
- Name: GATSBY_BASE_URL
6056
Value: ${self:custom.gatsbyBaseUrl}
6157
- Name: PREVIEW_BUILD_ENABLED
@@ -74,10 +70,6 @@ Resources:
7470
Value: ${self:custom.fastlyAtlasToken}
7571
- Name: FASTLY_ATLAS_SERVICE_ID
7672
Value: ${self:custom.fastlyAtlasServiceId}
77-
- Name: FASTLY_DEVHUB_TOKEN
78-
Value: ${self:custom.fastlyDevhubToken}
79-
- Name: FASTLY_DEVHUB_SERVICE_ID
80-
Value: ${self:custom.fastlyDevhubServiceId}
8173
- Name: FASTLY_OPS_MANAGER_TOKEN
8274
Value: ${self:custom.fastlyOpsManagerToken}
8375
- Name: FASTLY_OPS_MANAGER_SERVICE_ID

infrastructure/ecs-main/serverless.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,10 @@ custom:
9393
atlasBucketName: docs-atlas-${self:provider.stage}
9494
atlasOsbBucketName: docs-atlas-osb-${self:provider.stage}
9595
atlasGovBucketName: docs-govcloud-${self:provider.stage}
96-
devhubBucketName: docs-devhub-${self:provider.stage}
9796
cloudManagerBucketName: docs-cloudmanager-${self:provider.stage}
9897
opsManagerBucketName: docs-opsmanager-${self:provider.stage}
9998
npmBase64Auth: ${ssm:/env/${self:provider.stage}/docs/worker_pool/npm/auth}
10099
npmEmail: ${ssm:/env/${self:provider.stage}/docs/worker_pool/npm/email}
101-
awsKeyDevhub: ${ssm:/env/${self:provider.stage}/docs/worker_pool/devhub/aws/key}
102-
awsSecretDevhub: ${ssm:/env/${self:provider.stage}/docs/worker_pool/devhub/aws/secret}
103100
gatsbyBaseUrl: ${ssm:/env/${self:provider.stage}/docs/worker_pool/frontend/base_url}
104101
previewBuildEnabled: ${ssm:/env/${self:provider.stage}/docs/worker_pool/flag/preview_build/enabled}
105102
gatsbyTestEmbedVersions: ${ssm:/env/${self:provider.stage}/docs/worker_pool/flag/embedded_versions}
@@ -111,8 +108,6 @@ custom:
111108
fastlyAtlasServiceId: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/atlas/service_id}
112109
fastlyOpsManagerToken: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/opsmanager/token}
113110
fastlyOpsManagerServiceId: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/opsmanager/service_id}
114-
fastlyDevhubToken: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/devhub/token}
115-
fastlyDevhubServiceId: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/devhub/service_id}
116111
fastlyDochubToken: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/dochub/token}
117112
fastlyDochubServiceId: ${ssm:/env/${self:provider.stage}/docs/worker_pool/fastly/docs/dochub/service_id}
118113
cSharpBucketName: docs-csharp-${self:provider.stage}

src/job/stagingJobHandler.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ export class StagingJobHandler extends JobHandler {
5555
prepStageSpecificNextGenCommands(): void {
5656
if (this.currJob.buildCommands) {
5757
this.currJob.buildCommands[this.currJob.buildCommands.length - 1] = 'make next-gen-html';
58-
if (this.currJob.payload.repoName === 'devhub-content-integration') {
59-
this.currJob.buildCommands[this.currJob.buildCommands.length - 1] += ` STRAPI_PUBLICATION_STATE=preview`;
60-
} else {
61-
this.currJob.buildCommands.push(`make oas-page-build MUT_PREFIX=${this.currJob.payload.mutPrefix}`);
62-
}
58+
this.currJob.buildCommands.push(`make oas-page-build MUT_PREFIX=${this.currJob.payload.mutPrefix}`);
6359
}
6460
}
6561
async deploy(): Promise<CommandExecutorResponse> {

tests/data/data.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,7 @@ export class TestDataProvider {
162162
const commands = Array<string>().concat(genericCommands.slice(0, genericCommands.length - 1), [
163163
'make next-gen-html',
164164
]);
165-
if (job.payload.repoName == 'devhub-content-integration') {
166-
commands[commands.length - 1] += ` STRAPI_PUBLICATION_STATE=preview`;
167-
} else {
168-
commands.push(`make oas-page-build MUT_PREFIX=${job.payload.mutPrefix}`);
169-
}
165+
commands.push(`make oas-page-build MUT_PREFIX=${job.payload.mutPrefix}`);
170166
return commands;
171167
}
172168

tests/unit/job/stagingJobHandler.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,6 @@ describe('StagingJobHandler Tests', () => {
6464
);
6565
});
6666

67-
test('Execute nextgen build runs successfully for devhub integration', async () => {
68-
jobHandlerTestHelper.job.payload.repoName = 'devhub-content-integration';
69-
jobHandlerTestHelper.setStageForDeploySuccess(true, false);
70-
await jobHandlerTestHelper.jobHandler.execute();
71-
expect(jobHandlerTestHelper.job.payload.isNextGen).toEqual(true);
72-
expect(jobHandlerTestHelper.job.buildCommands).toEqual(
73-
TestDataProvider.getExpectedStagingBuildNextGenCommands(jobHandlerTestHelper.job)
74-
);
75-
});
76-
7767
test('Execute nextgen build runs successfully and results in summary message', async () => {
7868
jobHandlerTestHelper.setStageForDeploySuccess(true, false);
7969
await jobHandlerTestHelper.jobHandler.execute();

0 commit comments

Comments
 (0)