Skip to content

Commit ae02c62

Browse files
committed
testing
1 parent 38f9671 commit ae02c62

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

.evergreen/functions.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,18 @@ functions:
504504
content_type: application/x-gzip
505505

506506
publish:
507+
- command: ec2.assume_role
508+
params:
509+
role_arn: "arn:aws:iam::119629040606:role/s3-access.cdn-origin-compass"
507510
- command: shell.exec
508511
params:
509512
working_dir: src
510513
shell: bash
511514
env:
512515
<<: *compass-env
516+
DOWNLOAD_CENTER_NEW_AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
517+
DOWNLOAD_CENTER_NEW_AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
518+
DOWNLOAD_CENTER_NEW_AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
513519
script: |
514520
set -e
515521
# Load environment variables

packages/hadron-build/commands/upload.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const {
1919
getKeyPrefix,
2020
downloadManifest,
2121
uploadAsset,
22+
uploadAssetNew,
2223
uploadManifest,
2324
} = require('../lib/download-center');
2425

@@ -235,6 +236,7 @@ async function uploadAssetsToDownloadCenter(assets, channel, dryRun) {
235236
);
236237
if (!dryRun) {
237238
await uploadAsset(channel, asset);
239+
await uploadAssetNew(channel, asset);
238240
}
239241
cli.info(`${asset.name}: upload to download center completed.`);
240242
});

packages/hadron-build/lib/download-center.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const { DownloadCenter } = require('@mongodb-js/dl-center');
66
const download = require('download');
77

88
const DOWNLOADS_BUCKET = 'downloads.10gen.com';
9+
const DOWNLOADS_BUCKET_NEW = 'cdn-origin-compass';
910
const MANIFEST_BUCKET = 'info-mongodb-com';
1011
const MANIFEST_OBJECT_KEY = 'com-download-center/compass.json';
1112

@@ -32,10 +33,31 @@ const getDownloadCenter = (bucketConfig) => {
3233
});
3334
};
3435

36+
const getDownloadCenterNew = (bucketConfig) => {
37+
requireEnvironmentVariables([
38+
'DOWNLOAD_CENTER_NEW_AWS_ACCESS_KEY_ID',
39+
'DOWNLOAD_CENTER_NEW_AWS_SECRET_ACCESS_KEY',
40+
'DOWNLOAD_CENTER_NEW_AWS_SESSION_TOKEN',
41+
]);
42+
43+
return new DownloadCenter({
44+
...bucketConfig,
45+
accessKeyId: process.env.DOWNLOAD_CENTER_NEW_AWS_ACCESS_KEY_ID,
46+
secretAccessKey: process.env.DOWNLOAD_CENTER_NEW_AWS_SECRET_ACCESS_KEY,
47+
sessionToken: process.env.DOWNLOAD_CENTER_NEW_AWS_SESSION_TOKEN,
48+
});
49+
};
50+
3551
const getKeyPrefix = (channel) => {
3652
return channel && channel !== 'stable' ? `compass/${channel}` : 'compass';
3753
};
3854

55+
const uploadAssetNew = async (channel, asset) => {
56+
const dlCenterNew = getDownloadCenterNew({ bucket: DOWNLOADS_BUCKET_NEW });
57+
const objectKey = `${getKeyPrefix(channel)}/${asset.name}`;
58+
return dlCenterNew.uploadAsset(objectKey, fs.createReadStream(asset.path));
59+
};
60+
3961
const uploadAsset = async (channel, asset) => {
4062
const dlCenter = getDownloadCenter({ bucket: DOWNLOADS_BUCKET });
4163
const objectKey = `${getKeyPrefix(channel)}/${asset.name}`;

0 commit comments

Comments
 (0)