Skip to content

Commit beda48b

Browse files
authored
chore(release): remove writes to old downloads bucket DEVPROD-17837 (#2518)
This commit removes all writes to the old downloads bucket. Traffic has been cut over for quite some time now, so we should no longer need this code.
1 parent 2dd54c7 commit beda48b

File tree

18 files changed

+116
-206
lines changed

18 files changed

+116
-206
lines changed

.evergreen.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4317,9 +4317,9 @@ functions:
43174317
working_dir: src
43184318
shell: bash
43194319
env:
4320-
DOWNLOAD_CENTER_AWS_KEY_NEW: ${AWS_ACCESS_KEY_ID}
4321-
DOWNLOAD_CENTER_AWS_SECRET_NEW: ${AWS_SECRET_ACCESS_KEY}
4322-
DOWNLOAD_CENTER_AWS_SESSION_TOKEN_NEW: ${AWS_SESSION_TOKEN}
4320+
DOWNLOAD_CENTER_AWS_KEY_ARTIFACTS: ${AWS_ACCESS_KEY_ID}
4321+
DOWNLOAD_CENTER_AWS_SECRET_ARTIFACTS: ${AWS_SECRET_ACCESS_KEY}
4322+
DOWNLOAD_CENTER_AWS_SESSION_TOKEN_ARTIFACTS: ${AWS_SESSION_TOKEN}
43234323
script: |
43244324
set -e
43254325
{
@@ -4391,9 +4391,9 @@ functions:
43914391
env:
43924392
devtoolsbot_npm_token: ${devtoolsbot_npm_token}
43934393
node_js_version: ${node_js_version}
4394-
DOWNLOAD_CENTER_AWS_KEY_NEW: ${AWS_ACCESS_KEY_ID}
4395-
DOWNLOAD_CENTER_AWS_SECRET_NEW: ${AWS_SECRET_ACCESS_KEY}
4396-
DOWNLOAD_CENTER_AWS_SESSION_TOKEN_NEW: ${AWS_SESSION_TOKEN}
4394+
DOWNLOAD_CENTER_AWS_KEY_ARTIFACTS: ${AWS_ACCESS_KEY_ID}
4395+
DOWNLOAD_CENTER_AWS_SECRET_ARTIFACTS: ${AWS_SECRET_ACCESS_KEY}
4396+
DOWNLOAD_CENTER_AWS_SESSION_TOKEN_ARTIFACTS: ${AWS_SESSION_TOKEN}
43974397
script: |
43984398
set -e
43994399
.evergreen/run-evergreen-release.sh publish

.evergreen/evergreen.yml.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -962,9 +962,9 @@ functions:
962962
working_dir: src
963963
shell: bash
964964
env:
965-
DOWNLOAD_CENTER_AWS_KEY_NEW: ${AWS_ACCESS_KEY_ID}
966-
DOWNLOAD_CENTER_AWS_SECRET_NEW: ${AWS_SECRET_ACCESS_KEY}
967-
DOWNLOAD_CENTER_AWS_SESSION_TOKEN_NEW: ${AWS_SESSION_TOKEN}
965+
DOWNLOAD_CENTER_AWS_KEY_ARTIFACTS: ${AWS_ACCESS_KEY_ID}
966+
DOWNLOAD_CENTER_AWS_SECRET_ARTIFACTS: ${AWS_SECRET_ACCESS_KEY}
967+
DOWNLOAD_CENTER_AWS_SESSION_TOKEN_ARTIFACTS: ${AWS_SESSION_TOKEN}
968968
script: |
969969
set -e
970970
{
@@ -1036,9 +1036,9 @@ functions:
10361036
env:
10371037
devtoolsbot_npm_token: ${devtoolsbot_npm_token}
10381038
node_js_version: ${node_js_version}
1039-
DOWNLOAD_CENTER_AWS_KEY_NEW: ${AWS_ACCESS_KEY_ID}
1040-
DOWNLOAD_CENTER_AWS_SECRET_NEW: ${AWS_SECRET_ACCESS_KEY}
1041-
DOWNLOAD_CENTER_AWS_SESSION_TOKEN_NEW: ${AWS_SESSION_TOKEN}
1039+
DOWNLOAD_CENTER_AWS_KEY_ARTIFACTS: ${AWS_ACCESS_KEY_ID}
1040+
DOWNLOAD_CENTER_AWS_SECRET_ARTIFACTS: ${AWS_SECRET_ACCESS_KEY}
1041+
DOWNLOAD_CENTER_AWS_SESSION_TOKEN_ARTIFACTS: ${AWS_SESSION_TOKEN}
10421042
script: |
10431043
set -e
10441044
.evergreen/run-evergreen-release.sh publish

.github/workflows/update-cta.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
required: false
1414
default: false
1515
environment:
16-
description: The environment to run the script in - must have the DOWNLOAD_CENTER_AWS_KEY and DOWNLOAD_CENTER_AWS_SECRET secrets configured
16+
description: The environment to run the script in
1717
type: environment
1818
required: true
1919
default: CTA-Production
@@ -31,8 +31,6 @@ jobs:
3131
npm_config_loglevel: verbose
3232
npm_config_foreground_scripts: "true"
3333
PUPPETEER_SKIP_DOWNLOAD: "true"
34-
DOWNLOAD_CENTER_AWS_KEY: ${{ secrets.DOWNLOAD_CENTER_AWS_KEY }}
35-
DOWNLOAD_CENTER_AWS_SECRET: ${{ secrets.DOWNLOAD_CENTER_AWS_SECRET }}
3634
steps:
3735
- uses: actions/checkout@v4
3836
- name: configure aws credentials
@@ -54,8 +52,8 @@ jobs:
5452
5553
- name: Update greeting CTA
5654
env:
57-
DOWNLOAD_CENTER_AWS_KEY_NEW: "${{ env.AWS_ACCESS_KEY_ID }}"
58-
DOWNLOAD_CENTER_AWS_SECRET_NEW: "${{ env.AWS_SECRET_KEY }}"
59-
DOWNLOAD_CENTER_AWS_SESSION_TOKEN_NEW: "${{ env.AWS_SESSION_TOKEN }}"
55+
DOWNLOAD_CENTER_AWS_KEY: "${{ env.AWS_ACCESS_KEY_ID }}"
56+
DOWNLOAD_CENTER_AWS_SECRET: "${{ env.AWS_SECRET_KEY }}"
57+
DOWNLOAD_CENTER_AWS_SESSION_TOKEN: "${{ env.AWS_SESSION_TOKEN }}"
6058
run: |
6159
npm run update-cta ${{ github.event.inputs.dry-run && '-- --dry-run' || '' }}

config/build.conf.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ module.exports = {
9595
branch: process.env.BRANCH_NAME,
9696
evgAwsKey: process.env.AWS_KEY,
9797
evgAwsSecret: process.env.AWS_SECRET,
98-
downloadCenterAwsKey: process.env.DOWNLOAD_CENTER_AWS_KEY,
99-
downloadCenterAwsSecret: process.env.DOWNLOAD_CENTER_AWS_SECRET,
100-
downloadCenterAwsKeyNew: process.env.DOWNLOAD_CENTER_AWS_KEY_NEW,
101-
downloadCenterAwsSecretNew: process.env.DOWNLOAD_CENTER_AWS_SECRET_NEW,
102-
downloadCenterAwsSessionTokenNew: process.env.DOWNLOAD_CENTER_AWS_SESSION_TOKEN_NEW,
98+
downloadCenterAwsKeyConfig: process.env.DOWNLOAD_CENTER_AWS_KEY,
99+
downloadCenterAwsSecretConfig: process.env.DOWNLOAD_CENTER_AWS_SECRET,
100+
downloadCenterAwsKeyArtifacts: process.env.DOWNLOAD_CENTER_AWS_KEY_ARTIFACTS,
101+
downloadCenterAwsSecretArtifacts: process.env.DOWNLOAD_CENTER_AWS_SECRET_ARTIFACTS,
102+
downloadCenterAwsSessionTokenArtifacts: process.env.DOWNLOAD_CENTER_AWS_SESSION_TOKEN_ARTIFACTS,
103103
injectedJsonFeedFile: path.join(ROOT, 'config', 'mongosh-versions.json'),
104104
githubToken: process.env.GITHUB_TOKEN,
105105
segmentKey: process.env.SEGMENT_API_KEY,

packages/build/src/config/config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ export interface Config {
3939
branch?: string;
4040
evgAwsKey?: string;
4141
evgAwsSecret?: string;
42-
downloadCenterAwsKey?: string;
43-
downloadCenterAwsSecret?: string;
44-
downloadCenterAwsKeyNew?: string;
45-
downloadCenterAwsSecretNew?: string;
46-
downloadCenterAwsSessionTokenNew?: string;
42+
downloadCenterAwsKeyConfig?: string;
43+
downloadCenterAwsSecretConfig?: string;
44+
downloadCenterAwsKeyArtifacts?: string;
45+
downloadCenterAwsSecretArtifacts?: string;
46+
downloadCenterAwsSessionTokenArtifacts?: string;
4747
injectedJsonFeedFile?: string;
4848
githubToken?: string;
4949
segmentKey?: string;

packages/build/src/config/redact-config.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ describe('config redact-config', function () {
66
const redactedKeys: Array<keyof Config> = [
77
'evgAwsKey',
88
'evgAwsSecret',
9-
'downloadCenterAwsKey',
10-
'downloadCenterAwsSecret',
9+
'downloadCenterAwsKeyConfig',
10+
'downloadCenterAwsSecretConfig',
11+
'downloadCenterAwsKeyArtifacts',
12+
'downloadCenterAwsSecretArtifacts',
13+
'downloadCenterAwsSessionTokenArtifacts',
1114
'githubToken',
1215
];
1316

packages/build/src/download-center/artifacts.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ describe('DownloadCenter artifacts', function () {
1919
__filename,
2020
'accessKey',
2121
'secretKey',
22+
'sessionToken',
2223
dlCenter as any
2324
);
2425

2526
expect(dlCenter).to.have.been.calledWith({
26-
bucket: 'downloads.10gen.com',
27+
bucket: 'cdn-origin-compass',
2728
accessKeyId: 'accessKey',
2829
secretAccessKey: 'secretKey',
30+
sessionToken: 'sessionToken',
2931
});
3032
expect(uploadAsset).to.have.been.calledWith(
3133
'compass/artifacts.spec.ts',

packages/build/src/download-center/artifacts.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,17 @@
11
import { DownloadCenter as DownloadCenterCls } from '@mongodb-js/dl-center';
22
import * as fs from 'fs';
33
import path from 'path';
4-
import {
5-
ARTIFACTS_BUCKET,
6-
ARTIFACTS_BUCKET_NEW,
7-
ARTIFACTS_FOLDER,
8-
} from './constants';
4+
import { ARTIFACTS_BUCKET, ARTIFACTS_FOLDER } from './constants';
95

106
export async function uploadArtifactToDownloadCenter(
11-
filePath: string,
12-
awsAccessKeyId: string,
13-
awsSecretAccessKey: string,
14-
DownloadCenter: typeof DownloadCenterCls = DownloadCenterCls
15-
): Promise<void> {
16-
const dlcenter = new DownloadCenter({
17-
bucket: ARTIFACTS_BUCKET,
18-
accessKeyId: awsAccessKeyId,
19-
secretAccessKey: awsSecretAccessKey,
20-
});
21-
22-
await dlcenter.uploadAsset(
23-
`${ARTIFACTS_FOLDER}/${path.basename(filePath)}`,
24-
fs.createReadStream(filePath)
25-
);
26-
}
27-
28-
export async function uploadArtifactToDownloadCenterNew(
297
filePath: string,
308
awsAccessKeyId: string,
319
awsSecretAccessKey: string,
3210
awsSessionToken: string,
3311
DownloadCenter: typeof DownloadCenterCls = DownloadCenterCls
3412
): Promise<void> {
3513
const dlcenter = new DownloadCenter({
36-
bucket: ARTIFACTS_BUCKET_NEW,
14+
bucket: ARTIFACTS_BUCKET,
3715
accessKeyId: awsAccessKeyId,
3816
secretAccessKey: awsSecretAccessKey,
3917
sessionToken: awsSessionToken,

packages/build/src/download-center/config.spec.ts

Lines changed: 27 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ describe('DownloadCenter config', function () {
242242
});
243243

244244
describe('createAndPublishDownloadCenterConfig', function () {
245-
let dlCenter: sinon.SinonStub;
245+
let dlCenterConfig: sinon.SinonStub;
246+
let dlCenterArtifacts: sinon.SinonStub;
246247
let uploadConfig: sinon.SinonStub;
247248
let downloadConfig: sinon.SinonStub;
248249
let uploadAsset: sinon.SinonStub;
@@ -254,9 +255,17 @@ describe('DownloadCenter config', function () {
254255
downloadConfig = sinon.stub();
255256
uploadAsset = sinon.stub();
256257
downloadAsset = sinon.stub();
257-
dlCenter = sinon.stub();
258+
dlCenterConfig = sinon.stub();
259+
dlCenterArtifacts = sinon.stub();
258260

259-
dlCenter.returns({
261+
dlCenterConfig.returns({
262+
downloadConfig,
263+
uploadConfig,
264+
uploadAsset,
265+
downloadAsset,
266+
});
267+
268+
dlCenterArtifacts.returns({
260269
downloadConfig,
261270
uploadConfig,
262271
uploadAsset,
@@ -280,21 +289,17 @@ describe('DownloadCenter config', function () {
280289
'',
281290
false,
282291
DUMMY_CTA_CONFIG,
283-
dlCenter as any,
292+
dlCenterConfig as any,
293+
dlCenterArtifacts as any,
284294
baseUrl
285295
);
286296

287-
expect(dlCenter).to.have.been.calledWith({
297+
expect(dlCenterConfig).to.have.been.calledWith({
288298
bucket: 'info-mongodb-com',
289299
accessKeyId: DUMMY_ACCESS_KEY,
290300
secretAccessKey: DUMMY_SECRET_KEY,
291301
});
292-
expect(dlCenter).to.have.been.calledWith({
293-
bucket: 'downloads.10gen.com',
294-
accessKeyId: DUMMY_ACCESS_KEY,
295-
secretAccessKey: DUMMY_SECRET_KEY,
296-
});
297-
expect(dlCenter).to.have.been.calledWith({
302+
expect(dlCenterArtifacts).to.have.been.calledWith({
298303
bucket: 'cdn-origin-compass',
299304
accessKeyId: DUMMY_ACCESS_KEY,
300305
secretAccessKey: DUMMY_SECRET_KEY,
@@ -331,7 +336,7 @@ describe('DownloadCenter config', function () {
331336
tutorial_link: 'test',
332337
});
333338

334-
expect(uploadAsset).to.be.calledTwice;
339+
expect(uploadAsset).to.be.calledOnce;
335340
const [assetKey] = uploadAsset.lastCall.args;
336341
expect(assetKey).to.equal('compass/mongosh.json');
337342
});
@@ -348,21 +353,17 @@ describe('DownloadCenter config', function () {
348353
'',
349354
false,
350355
DUMMY_CTA_CONFIG,
351-
dlCenter as any,
356+
dlCenterConfig as any,
357+
dlCenterArtifacts as any,
352358
baseUrl
353359
);
354360

355-
expect(dlCenter).to.have.been.calledWith({
361+
expect(dlCenterConfig).to.have.been.calledWith({
356362
bucket: 'info-mongodb-com',
357363
accessKeyId: DUMMY_ACCESS_KEY,
358364
secretAccessKey: DUMMY_SECRET_KEY,
359365
});
360-
expect(dlCenter).to.have.been.calledWith({
361-
bucket: 'downloads.10gen.com',
362-
accessKeyId: DUMMY_ACCESS_KEY,
363-
secretAccessKey: DUMMY_SECRET_KEY,
364-
});
365-
expect(dlCenter).to.have.been.calledWith({
366+
expect(dlCenterArtifacts).to.have.been.calledWith({
366367
bucket: 'cdn-origin-compass',
367368
accessKeyId: DUMMY_ACCESS_KEY,
368369
secretAccessKey: DUMMY_SECRET_KEY,
@@ -396,7 +397,7 @@ describe('DownloadCenter config', function () {
396397
tutorial_link: 'test',
397398
});
398399

399-
expect(uploadAsset).to.be.calledTwice;
400+
expect(uploadAsset).to.be.calledOnce;
400401
const [assetKey, uploadedAsset] = uploadAsset.lastCall.args;
401402
expect(assetKey).to.equal('compass/mongosh.json');
402403
const jsonFeedData = JSON.parse(uploadedAsset);
@@ -463,21 +464,17 @@ describe('DownloadCenter config', function () {
463464
),
464465
false,
465466
DUMMY_CTA_CONFIG,
466-
dlCenter as any,
467+
dlCenterConfig as any,
468+
dlCenterArtifacts as any,
467469
baseUrl
468470
);
469471

470-
expect(dlCenter).to.have.been.calledWith({
472+
expect(dlCenterConfig).to.have.been.calledWith({
471473
bucket: 'info-mongodb-com',
472474
accessKeyId: DUMMY_ACCESS_KEY,
473475
secretAccessKey: DUMMY_SECRET_KEY,
474476
});
475-
expect(dlCenter).to.have.been.calledWith({
476-
bucket: 'downloads.10gen.com',
477-
accessKeyId: DUMMY_ACCESS_KEY,
478-
secretAccessKey: DUMMY_SECRET_KEY,
479-
});
480-
expect(dlCenter).to.have.been.calledWith({
477+
expect(dlCenterArtifacts).to.have.been.calledWith({
481478
bucket: 'cdn-origin-compass',
482479
accessKeyId: DUMMY_ACCESS_KEY,
483480
secretAccessKey: DUMMY_SECRET_KEY,
@@ -514,7 +511,7 @@ describe('DownloadCenter config', function () {
514511
tutorial_link: 'test',
515512
});
516513

517-
expect(uploadAsset).to.be.calledTwice;
514+
expect(uploadAsset).to.be.calledOnce;
518515
const [assetKey, uploadedAsset] = uploadAsset.lastCall.args;
519516
expect(assetKey).to.equal('compass/mongosh.json');
520517
const jsonFeedData = JSON.parse(uploadedAsset);
@@ -621,8 +618,6 @@ describe('DownloadCenter config', function () {
621618
config,
622619
DUMMY_ACCESS_KEY,
623620
DUMMY_SECRET_KEY,
624-
DUMMY_ACCESS_KEY,
625-
DUMMY_SECRET_KEY,
626621
DUMMY_SESSION_TOKEN,
627622
dryRun,
628623
dlCenter as any
@@ -661,8 +656,6 @@ describe('DownloadCenter config', function () {
661656
config,
662657
DUMMY_ACCESS_KEY,
663658
DUMMY_SECRET_KEY,
664-
DUMMY_ACCESS_KEY,
665-
DUMMY_SECRET_KEY,
666659
DUMMY_SESSION_TOKEN,
667660
false,
668661
dlCenter as any
@@ -689,8 +682,6 @@ describe('DownloadCenter config', function () {
689682
ctas,
690683
DUMMY_ACCESS_KEY,
691684
DUMMY_SECRET_KEY,
692-
DUMMY_ACCESS_KEY,
693-
DUMMY_SECRET_KEY,
694685
DUMMY_SESSION_TOKEN,
695686
false,
696687
dlCenter as any
@@ -714,8 +705,6 @@ describe('DownloadCenter config', function () {
714705
config,
715706
DUMMY_ACCESS_KEY,
716707
DUMMY_SECRET_KEY,
717-
DUMMY_ACCESS_KEY,
718-
DUMMY_SECRET_KEY,
719708
DUMMY_SESSION_TOKEN,
720709
false,
721710
dlCenter as any
@@ -739,8 +728,6 @@ describe('DownloadCenter config', function () {
739728
config,
740729
DUMMY_ACCESS_KEY,
741730
DUMMY_SECRET_KEY,
742-
DUMMY_ACCESS_KEY,
743-
DUMMY_SECRET_KEY,
744731
DUMMY_SESSION_TOKEN,
745732
false,
746733
dlCenter as any
@@ -764,8 +751,6 @@ describe('DownloadCenter config', function () {
764751
config,
765752
DUMMY_ACCESS_KEY,
766753
DUMMY_SECRET_KEY,
767-
DUMMY_ACCESS_KEY,
768-
DUMMY_SECRET_KEY,
769754
DUMMY_SESSION_TOKEN,
770755
false,
771756
dlCenter as any
@@ -796,8 +781,6 @@ describe('DownloadCenter config', function () {
796781
config,
797782
DUMMY_ACCESS_KEY,
798783
DUMMY_SECRET_KEY,
799-
DUMMY_ACCESS_KEY,
800-
DUMMY_SECRET_KEY,
801784
DUMMY_SESSION_TOKEN,
802785
false,
803786
dlCenter as any
@@ -828,8 +811,6 @@ describe('DownloadCenter config', function () {
828811
config,
829812
DUMMY_ACCESS_KEY,
830813
DUMMY_SECRET_KEY,
831-
DUMMY_ACCESS_KEY,
832-
DUMMY_SECRET_KEY,
833814
DUMMY_SESSION_TOKEN,
834815
false,
835816
dlCenter as any

0 commit comments

Comments
 (0)