Skip to content

Commit 001373d

Browse files
authored
DRIVERS-3110 Follow up for Kondukto migration (#74)
1 parent 46329d5 commit 001373d

File tree

7 files changed

+29
-88
lines changed

7 files changed

+29
-88
lines changed

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,17 +258,10 @@ filename along with the resulting location in the bucket is printed.
258258
## Create Release Branch
259259

260260
Use this action to create a release branch and populate it with metadata.
261-
It will create a new Silk Asset Group, update the SBOM-lite file,
262-
update the ``SILK_ASSET_GROUP`` and ``EVERGREEN_PROJECT`` env variables
261+
It will update ``EVERGREEN_PROJECT`` env variable
263262
in the release workflow file, bump the version to a
264263
prerelease version, and push the changes.
265264

266-
> [!Note]
267-
> You will need to wait overnight before making a release on
268-
> the new branch to allow Silk to be populated, so it is recommended to
269-
> make a minor/major release prior to creating a release branch, or create the
270-
> release branch at least one day before a planned release.
271-
272265
```yaml
273266
- name: Setup
274267
uses: mongodb-labs/drivers-github-tools/setup@v2

create-branch/action.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ inputs:
2323
release_workflow_path:
2424
description: The path to the release workflow file
2525
default: .github/workflows/release.yml
26-
sbom_file_path:
27-
description: The path of the sbom-lite file
28-
default: sbom.json
29-
silk_group_prefix:
30-
description: The prefix to use for the silk asset group, defaults to the repo name
3126
artifactory_image:
3227
description: Image to use for artifactory
3328
default: artifactory.corp.mongodb.com/release-tools-container-registry-public-local
34-
29+
# Unused inputs, to be removed in V3.
30+
sbom_file_path:
31+
description: The path of the sbom-lite file
32+
default: sbom.json
33+
silk_group_prefix:
34+
description: The prefix to use for the silk asset group, defaults to the repo name
3535
runs:
3636
using: composite
3737
steps:
@@ -43,7 +43,6 @@ runs:
4343
SBOM_FILE_PATH: ${{ inputs.sbom_file_path }}
4444
RELEASE_WORKFLOW_PATH: ${{ inputs.release_workflow_path }}
4545
EVERGREEN_PROJECT: ${{ inputs.evergreen_project }}
46-
SILK_PREFIX: ${{ inputs.silk_group_prefix }}
4746
ARTIFACTORY_IMAGE: ${{ inputs.artifactory_image }}
4847
run: ${{ github.action_path }}/create-branch.sh
4948
- uses: mongodb-labs/drivers-github-tools/bump-version@v2

create-branch/create-branch.sh

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -9,66 +9,7 @@ git ls-remote --exit-code --heads https://github.com/${OWNER_REPO}.git refs/head
99
git fetch origin $BRANCH || true
1010
git checkout $BRANCH
1111

12-
echo "Get silk creds."
13-
# shellcheck disable=SC2046
14-
export $(grep -v '^#' $SILKBOMB_ENVFILE | xargs -0)
15-
16-
echo "Get a silk token."
17-
SILK_JWT_TOKEN=$(curl -s -X POST "https://silkapi.us1.app.silk.security/api/v1/authenticate" \
18-
-H "accept: application/json" -H "Content-Type: application/json" \
19-
-d '{ "client_id": "'${SILK_CLIENT_ID}'", "client_secret": "'${SILK_CLIENT_SECRET}'" }' \
20-
| jq -r '.token')
21-
22-
echo "Get the silk asset group prefix."
23-
if [ -z "${SILK_PREFIX:-}" ]; then
24-
REPO="${OWNER_REPO##*/}"
25-
SILK_PREFIX=${REPO}
26-
fi
27-
SILK_GROUP="${SILK_PREFIX}-${BRANCH}"
28-
29-
echo "Create the silk asset group."
30-
json_payload=$(cat <<EOF
31-
{
32-
"active": true,
33-
"name": "${SILK_GROUP}",
34-
"code_repo_url": "https://github.com/${OWNER_REPO}",
35-
"branch": "${BRANCH}",
36-
"metadata": {
37-
"sbom_lite_path": "${SBOM_FILE_PATH}"
38-
},
39-
"file_paths": [],
40-
"asset_id": "$SILK_GROUP"
41-
}
42-
EOF
43-
)
44-
curl -X 'POST' \
45-
'https://silkapi.us1.app.silk.security/api/v1/raw/asset_group' \
46-
-H "accept: application/json" -H "Authorization: ${SILK_JWT_TOKEN}" \
47-
-H 'Content-Type: application/json' \
48-
-d "$json_payload"
49-
50-
echo "SILK_ASSET_GROUP=$SILK_GROUP" >> $GITHUB_STEP_SUMMARY
51-
52-
echo "Create a temp sbom."
53-
TMP_SBOM=sbom-for-${BRANCH}.json
54-
podman run --platform="linux/amd64" --rm -v "$(pwd)":/pwd \
55-
${ARTIFACTORY_IMAGE}/silkbomb:1.0 \
56-
update --sbom-out /pwd/${TMP_SBOM}
57-
58-
echo "Get the new timestamp and serial number."
59-
set -x
60-
SERIAL=$(jq -r '.serialNumber' ${TMP_SBOM})
61-
TIMESTAMP=$(jq -r '.metadata.timestamp' ${TMP_SBOM})
62-
rm ${TMP_SBOM}
63-
64-
cat ${SBOM_FILE_PATH}
65-
echo "Replace the values in the existing sbom."
66-
cat <<< "$(jq --indent 4 '.serialNumber = "'${SERIAL}'"' ${SBOM_FILE_PATH})" > ${SBOM_FILE_PATH}
67-
cat <<< "$(jq --indent 4 '.metadata.timestamp = "'${TIMESTAMP}'"' ${SBOM_FILE_PATH})" > ${SBOM_FILE_PATH}
68-
cat ${SBOM_FILE_PATH}
69-
70-
echo "Update the workflow with the silk asset group and evergreen project."
71-
sed -i 's/SILK_ASSET_GROUP:.*/SILK_ASSET_GROUP: '${SILK_GROUP}'/' ${RELEASE_WORKFLOW_PATH}
12+
echo "Update the workflow with the new evergreen project."
7213
sed -i 's/EVERGREEN_PROJECT:.*/EVERGREEN_PROJECT: '${EVERGREEN_PROJECT}'/' ${RELEASE_WORKFLOW_PATH}
7314

7415
echo "Add the changed files."

full-report/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ inputs:
1818
sbom_file_name:
1919
description: The name of the augmented sbom file.
2020
default: cyclonedx.sbom.json
21-
# No longer used.
22-
silk_asset_group:
23-
description: The Silk Asset Group for the Project
2421
third_party_dependency_tool:
2522
description: The name of the tool used to track 3rd party dependencies.
2623
default: Silk
@@ -34,6 +31,9 @@ inputs:
3431
description: The distribution filename or glob pattern
3532
token:
3633
description: The GitHub access token
34+
# No longer used, to be removed in V3.
35+
silk_asset_group:
36+
description: The Silk Asset Group for the Project
3737

3838
runs:
3939
using: composite

golang/publish/action.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ inputs:
77
prev_version:
88
description: The previous version
99
required: true
10-
silk_asset_group:
11-
description: The Silk Asset Group
12-
required: true
1310
evergreen_project:
1411
description: The evergreen project name.
1512
required: true
@@ -18,6 +15,11 @@ inputs:
1815
default: "true"
1916
token:
2017
description: The GitHub token
18+
# No longer used, to be removed in V3.
19+
silk_asset_group:
20+
description: The Silk Asset Group for the Project
21+
required: false
22+
2123
runs:
2224
using: composite
2325
steps:
@@ -30,7 +32,7 @@ runs:
3032
with:
3133
product_name: mongo-go-driver
3234
release_version: ${{ inputs.version }}
33-
silk_asset_group: ${{ inputs.silk_asset_group }}
35+
sbom_in_file: sbom.json
3436
evergreen_project: ${{ inputs.evergreen_project }}
3537
evergreen_commit: ${{ steps.evergreen-commit.outputs.commit }}
3638
security_report_location: ${{ env.SECURITY_REPORT_URL }}

python/post-publish/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ inputs:
2020
kondukto_sub_project:
2121
description: The Kondukto sub-project name (appended to the branch name)
2222
required: false
23-
# No longer used.
24-
silk_asset_group:
25-
description: The Silk Asset Group for the Project
26-
required: false
2723
evergreen_project:
2824
description: The evergreen project name.
2925
required: true
@@ -41,6 +37,10 @@ inputs:
4137
dry_run:
4238
description: Whether this is a dry run
4339
required: true
40+
# No longer used, to be removed in V3.
41+
silk_asset_group:
42+
description: The Silk Asset Group for the Project
43+
required: false
4444

4545
runs:
4646
using: composite

sbom/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ inputs:
1313
artifactory_image:
1414
description: Image to use for artifactory
1515
default: artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:2.0
16-
# no longer used
16+
# No longer used, to be removed in V3.
1717
silk_asset_group:
1818
description: The Silk Asset Group for the Project
1919
required: false
@@ -29,13 +29,19 @@ runs:
2929
ARTIFACTORY_IMAGE: ${{ inputs.artifactory_image }}
3030
SBOM_FILE_NAME: ${{ inputs.sbom_file_name }}
3131
run: |
32-
set -eux
32+
set -eu
3333
if [ -n "${KONDUKTO_SUB_PROJECT}" ]; then
3434
KONDUKTO_BRANCH="${GITHUB_REF_NAME}_${KONDUKTO_SUB_PROJECT}"
3535
else
3636
KONDUKTO_BRANCH="${GITHUB_REF_NAME}"
3737
fi
3838
echo "Generating SBOM file for ${KONDUKTO_BRANCH}..."
39+
echo "Updating SBOM file..."
40+
podman run --platform="linux/amd64" -it --rm -v ${RELEASE_ASSETS}:/pwd -v $(pwd):/repo \
41+
--env-file=${KONDUKTO_ENVFILE} \
42+
${ARTIFACTORY_IMAGE} \
43+
update --sbom-in /repo/${SBOM_IN_PATH} --sbom-out /pwd/cyclonedx.sbom.json --generate-new-serial-number
44+
echo "Augumenting SBOM file..."
3945
podman run --platform="linux/amd64" -it --rm -v ${RELEASE_ASSETS}:/pwd -v $(pwd):/repo \
4046
--env-file=${KONDUKTO_ENVFILE} \
4147
${ARTIFACTORY_IMAGE} \

0 commit comments

Comments
 (0)