-
Notifications
You must be signed in to change notification settings - Fork 246
feat(web, ci): upload compass-web assets to an s3 bucket during publish COMPASS-10132 #7631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
c62496e
d8288cb
c0ec910
3e30d7d
0b0bfbd
79788db
263691e
70bddfd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,9 @@ variables: | |
| GITHUB_TOKEN: ${devtoolsbot_github_token} | ||
| DOWNLOAD_CENTER_AWS_ACCESS_KEY_ID: ${aws_key_evergreen_integrations} | ||
| DOWNLOAD_CENTER_AWS_SECRET_ACCESS_KEY: ${aws_secret_evergreen_integrations} | ||
| DOWNLOAD_CENTER_NEW_AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a bit of an overkill moving it here taking into account we will be using a different bucket, but this anyway seems more consistent with how we do it for other variables
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems OK. I have no real opinion. |
||
| DOWNLOAD_CENTER_NEW_AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} | ||
| DOWNLOAD_CENTER_NEW_AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN} | ||
| EVERGREEN_BUCKET_NAME: mciuploads | ||
| EVERGREEN_BUCKET_KEY_PREFIX: ${project}/${revision}_${revision_order_id} | ||
| MONGODB_RUNNER_LOG_DIR: ${workdir}/src/.testserver/ | ||
|
|
@@ -504,23 +507,39 @@ functions: | |
| publish: | ||
| - command: ec2.assume_role | ||
| params: | ||
| role_arn: 'arn:aws:iam::119629040606:role/s3-access.cdn-origin-compass' | ||
| role_arn: ${downloads_bucket_role_arn} | ||
| - command: shell.exec | ||
| params: | ||
| working_dir: src | ||
| shell: bash | ||
| env: | ||
| <<: *compass-env | ||
| DOWNLOAD_CENTER_NEW_AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} | ||
| DOWNLOAD_CENTER_NEW_AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} | ||
| DOWNLOAD_CENTER_NEW_AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN} | ||
| script: | | ||
| set -e | ||
| # Load environment variables | ||
| eval $(.evergreen/print-compass-env.sh) | ||
| echo "Uploading release assets to S3 and GitHub if needed..." | ||
| npm run --workspace mongodb-compass upload | ||
|
|
||
| publish-web: | ||
| - command: ec2.assume_role | ||
| params: | ||
| role_arn: ${downloads_bucket_role_arn} | ||
| - command: shell.exec | ||
| params: | ||
| working_dir: src | ||
| shell: bash | ||
| env: | ||
| <<: *compass-env | ||
| script: | | ||
| set -e | ||
| # Load environment variables | ||
| eval $(.evergreen/print-compass-env.sh) | ||
| echo "Compiling compass-web" | ||
| npm run --workspace @mongodb-js/compass-web compile | ||
| echo "Uploading release assets to S3" | ||
| npm run --workspace @mongodb-js/compass-web upload | ||
|
|
||
| publish-dev-release-info: | ||
| - command: shell.exec | ||
| params: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,16 +187,18 @@ export const lessLoader = (args: ConfigArgs) => ({ | |
| }); | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| export const assetsLoader = (_args: ConfigArgs) => ({ | ||
| test: /\.(jpe?g|png|svg|gif|woff|woff2|ttf|eot|otf)(\?.+?)?$/, | ||
| // asset (or asset auto) will either compile as data-uri or to a file path | ||
| // based on the size, this is a good strategy for loading assets in the GUI | ||
| type: 'asset', | ||
| parser: { | ||
| dataUrlCondition: { | ||
| maxSize: 2 * 1024, // 2kb | ||
| }, | ||
| }, | ||
| export const fontLoader = (_args: ConfigArgs) => ({ | ||
| test: /\.(woff|woff2|ttf|eot|otf)(\?.+?)?$/, | ||
| // fonts are always big and should be emitted as a separate file | ||
| type: 'asset/resource', | ||
| }); | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| export const imageLoader = (_args: ConfigArgs) => ({ | ||
| test: /\.(jpe?g|png|svg|gif)(\?.+?)?$/, | ||
| // it's convenient to inline images as data-urls to make sure that publised | ||
| // library artifacts only produce importable javascript assets | ||
| type: 'asset/inline', | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just easier not to deal with them for compass-web which is published as a library, they are all relatively small (the biggest is like 5kb) so data-urls work well enough |
||
| }); | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
|
|
@@ -223,7 +225,7 @@ export const sourceLoader = (args: ConfigArgs) => ({ | |
| nodeLoader(args).test, | ||
| cssLoader(args).test, | ||
| lessLoader(args).test, | ||
| assetsLoader(args).test, | ||
| resourceLoader(args).test, | ||
| sharedObjectLoader(args).test, | ||
| // Produced by html-webpack-plugin and should not be handled | ||
| /\.(ejs|html)$/, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by fix: at some point we updated the template (the .in file), but not the actual config