Skip to content

CDRIVER-5904 update scripts and release instructions for SilkBomb 2.0 #1882

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

Merged
merged 13 commits into from
Feb 24, 2025

Conversation

eramongodb
Copy link
Contributor

@eramongodb eramongodb commented Feb 20, 2025

Resolves CDRIVER-5904 for the master branch (EVG project: mongo-c-driver). Verified by this patch. Followup to #1875.

Applies similar changes to mongodb/mongo-cxx-driver#1344 but for the C Driver. Unlike the C++ Driver, the C Driver's sbom task only performs validate + augment and simply uploads the Augmented SBOM file (no diffs) so it may be examined and downloaded during release steps when needed.

Due to the current inability to download the Augmented SBOM outside of Evergreen with SilkBomb 2.0, the +sbom-download target and related commands, flags, and instructions are removed. In their place, a new release requirement is that etc/augmented-sbom.json is present when running +release-archive or +signed-release (this file does not need to be committed into the repo, it just needs to be present).

This file must be downloaded from a recent execution of the sbom task (a patch build is OK!) during the release process prior to executing +release-archive or +signed-release. If the Augmented SBOM is not present, the COPY command in +release-archive will fail with the following error (paraphrased for brevity):

prefix=[...] ref=HEAD
--> COPY etc/augmented-sbom.json cyclonedx.sbom.json
[no output]
ERROR Earthfile:202:4
      The command
          COPY etc/augmented-sbom.json cyclonedx.sbom.json
      failed: failed to walk [...]/etc: lstat [...]/etc: no such file or directory

The +sbom-update and the new +sbom-validate Earthly commands do not require being run inside Evergreen.

Copy link
Contributor

@vector-of-bool vector-of-bool left a comment

Choose a reason for hiding this comment

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

LGTM with minor tweaks. The failing tasks appear to be unrelated caused by flakiness in the docker hub gateway (sad).

@@ -269,7 +270,7 @@ signed-release:
LET rel_tgz = "$rel_dir/$stem.tar.gz"
LET rel_asc = "$rel_dir/$stem.tar.gz.asc"
# Make the release archive:
COPY (+release-archive/ --branch=$sbom_branch --prefix=$stem --ref=$ref) $rel_dir/
COPY (+release-archive/ --prefix=$stem --ref=$ref) $rel_dir/
Copy link
Contributor

Choose a reason for hiding this comment

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

Can delete the ARG sbom_branch above since it is now unused.

Earthfile Outdated
sbom-download:
# sbom-validate:
# Validate the SBOM Lite for the given branch.
sbom-validate:
FROM artifactory.corp.mongodb.com/dockerhub/library/alpine:3.20
Copy link
Contributor

@vector-of-bool vector-of-bool Feb 20, 2025

Choose a reason for hiding this comment

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

This FROM line can be deleted since the next line overrides it immediately. It looks like the duplicate FROM was present in the prior version. That was a mistake.

2. Set the Earthly secrets required for the :any:`+sign-file` and
:any:`+sbom-download` targets.
2. Set the Earthly secrets required for the :any:`+sign-file` target.
3. Download a recent augmented SBOM from Evergreen and save it to `etc/augmented-sbom.json`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
3. Download a recent augmented SBOM from Evergreen and save it to `etc/augmented-sbom.json`.
3. Download a recent augmented SBOM from Evergreen, created by the standalone `sbom` task in the "SBOM" variant, and save it to `etc/augmented-sbom.json`.

Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that silk asset groups are no longer required with Silkbomb 2?

Copy link
Contributor Author

@eramongodb eramongodb Feb 20, 2025

Choose a reason for hiding this comment

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

Correct. The --repo and --branch flags are now sufficient to associate uploaded/augmented SBOMs with a given project and branch. Asset group management is no longer necessary. 👏

Comment on lines 16 to 19
command -v jq >/dev/null || {
echo "missing required program jq" 1>&2
exit 1
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is jq actually required? It doesn't appear to be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not (used for diffs in the C++ Driver, which are not present here).

Copy link
Contributor

Choose a reason for hiding this comment

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

This could be moved to an Earthfile task, but would require another step to auth podman/Docker with Artifactory. It's fine as a standalone script since it's fairly trivial.

@eramongodb
Copy link
Contributor Author

Added the +sbom-generate-new-serial-number Earthly target, which may be used to generate a new unique serial number and reset the SBOM version to 1 following a release via the new SilkBomb 2.0 --generate-new-serial-number flag.

Comment on lines 216 to 217
Equivalent to `+sbom-generate` but uses the `--generate-new-serial-number`
flag to generate a new unique serial number and reset the SBOM version to 1.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this docs line may fail, requiring two backticks around --generate-new-serial-number. Recommend testing docs changes with make -C docs/dev serve.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch and thank you for the tip. Testing doc generation caught additional obsolete references to the old +sbom-download target. Inspected the generated HTMLs and updated accordingly.

Comment on lines 100 to 101
The augmented SBOM is produced automatically and asynchronously as part of an
external process that is not contained within the repository itself. The
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The augmented SBOM is produced automatically and asynchronously as part of an
external process that is not contained within the repository itself. The
The augmented SBOM is produced as part of an
external process that is not contained within the repository itself. The

I expect producing the augmented SBOM is no longer asynchronous with the silkbomb augment command.

@eramongodb eramongodb merged commit 53f9fec into mongodb:master Feb 24, 2025
1 check was pending
@eramongodb eramongodb deleted the cdriver-5904 branch February 24, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants