Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3780,6 +3780,23 @@ functions:
# - signature_tag (either 'signed' or 'unsigned')
###
add_crypt_shared_and_sbom:
- command: ec2.assume_role
display_name: Assume IAM role with permissions to pull Kondukto API token
params:
role_arn: ${kondukto_role_arn}
- command: shell.exec
display_name: Pull Kondukto API token from AWS Secrets Manager and write it to file
params:
silent: true
shell: bash
working_dir: src
include_expansions_in_env: [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL!

script: |
# use AWS CLI to get the Kondukto API token from AWS Secrets Manager
kondukto_token=$(aws secretsmanager get-secret-value --secret-id "kondukto-token" --region "us-east-1" --query 'SecretString' --output text)
set -e
# set the KONDUKTO_TOKEN environment variable
echo "KONDUKTO_TOKEN=$kondukto_token" > /tmp/kondukto_credentials.env
- command: subprocess.exec
params:
working_dir: src
Expand All @@ -3791,9 +3808,7 @@ functions:
ARTIFACTORY_USERNAME: ${artifactory_username}
ARTIFACTORY_PASSWORD: ${artifactory_password}
# for Silk SBOM integration
SILK_ASSET_GROUP: mongosh-${executable_os_id}
SILK_CLIENT_ID: ${silk_client_id}
SILK_CLIENT_SECRET: ${silk_client_secret}
KONDUKTO_BRANCH: ${branch_name}_${executable_os_id}
create_static_analysis_report:
- command: s3.get
params:
Expand Down
16 changes: 5 additions & 11 deletions .evergreen/download-crypt-shared-and-generate-sbom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,15 @@ cat dist/.purls.txt

set +x
echo "${ARTIFACTORY_PASSWORD}" | docker login artifactory.corp.mongodb.com --username "${ARTIFACTORY_USERNAME}" --password-stdin
cat << EOF > silkbomb.env
SILK_CLIENT_ID=${SILK_CLIENT_ID}
SILK_CLIENT_SECRET=${SILK_CLIENT_SECRET}
EOF
set -x

trap_handler() {
rm -f silkbomb.env
rm -f /tmp/kondukto_credentials.env
}
trap trap_handler ERR EXIT

docker pull artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:1.0
docker run --rm -v ${PWD}:/pwd artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:1.0 update \
docker pull artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:2.0
docker run --rm -v ${PWD}:/pwd artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:2.0 update \
--purls /pwd/dist/.purls.txt --sbom-out /pwd/dist/.sbom-lite.json
docker run --env-file silkbomb.env --rm -v ${PWD}:/pwd artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:1.0 upload \
--silk-asset-group "${SILK_ASSET_GROUP}" --sbom-in /pwd/dist/.sbom-lite.json
docker run --env-file silkbomb.env --rm -v ${PWD}:/pwd artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:1.0 download \
--silk-asset-group "${SILK_ASSET_GROUP}" --sbom-out /pwd/dist/.sbom.json
docker run --env-file /tmp/kondukto_credentials.env --rm -v ${PWD}:/pwd artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:2.0 augment \
--repo mongodb-js/mongosh --branch ${KONDUKTO_BRANCH} --sbom-in /pwd/dist/.sbom-lite.json -sbom-out /pwd/dist/.sbom.json