Skip to content

CLOUDP-315271: Onboard Kundukto to CI #3862

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

Open
wants to merge 17 commits into
base: CLOUDP-227276_ssdlc_phase_2
Choose a base branch
from

Conversation

cveticm
Copy link
Collaborator

@cveticm cveticm commented Apr 29, 2025

Proposed changes

Adds new evergreen task "generate_and_upload_sbom" to generate an SBOM and package it in the release.
Adds new file build/ci/purls.txt which is a list of purls built from the binary.
This step of work does the following:

  1. New task "generate_and_upload_sbom":
    1. Creates Silkbomb tokens
    2. Generates a list of purls from the linux binary
    3. Generates an non-augemented SBOM in dir compliance/.
    4. Creates a Kondukto token
    5. Uploads the SBOM to the mongodb_mongodb-atlas-cli Kondukto project
  2. Modification to release process
    1. Includes the SBOM in release page.
  3. New purls check
    1. A new make command generates build/ci/purls.txt for visibility to devs on the implications their changes have to the sbom
    2. A new EVG check that purls.txt is up-to-date

This PR does not:

  1. Generate SSDLC report (future work of CLOUDP-315269)
  2. Generate augmented SBOMs (future work of CLOUDP-315270)
  3. Generate a purls list for any other OS (future work of CLOUDP-316920

Jira ticket: CLOUDP-315271

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation in document requirements section listed in CONTRIBUTING.md (if appropriate)
  • I have addressed the @mongodb/docs-cloud-team comments (if appropriate)
  • I have updated test/README.md (if an e2e test has been added)
  • I have run make fmt and formatted my code

@@ -55,6 +55,7 @@ archives:
- LICENSE
- LICENSING-NOTES.txt
- third_party_notices/**/*
- compliance/**/*
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This directory currently holds the generated SBOM.
It will also hold the generated SSDLC report after future work.

Copy link
Collaborator

Choose a reason for hiding this comment

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

there are no expectations to produce this report with the release, any reason we are including it?

Copy link
Collaborator Author

@cveticm cveticm Apr 30, 2025

Choose a reason for hiding this comment

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

In the scope we have as a goal to include SSDLC report as a part of release.
The rationale is that releases provide a convenient place to store the report and enable customers to access the report on release. And then up-to-date reports with augmented SBOMs can be provided to customers on request.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have questions about the utility of packaging it with the bin, I don't see any other binary doing it, AKO for example is commited to the repo and not shipped

Then if we really want to ship it then I wonder why not use https://goreleaser.com/customization/sbom/#usage

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@fmenezes any opinion on shifting approach of where we store the report?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just got off a call with @cveticm basically there are 3 approaches:

The reason why we wanted to do on releases page was to make it same for CLI and Local Dev, also bear in mind our policy does not specify where to store these and most projects simply upload to S3.

Copy link
Collaborator

Choose a reason for hiding this comment

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

also bear in mind our policy does not specify where to store these

Yes and my initial point, there's no expectation to be proactive about these and only to make it available upon request

Copy link
Collaborator

Choose a reason for hiding this comment

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

Store in the release package (used by ops manager)

Thanks for reminding me of this I downloaded OM to see where they are but since it's 2GB package I forgot to check

in ops manager they are included in the notices folder, which in the CLI is the thirdparty notice folder

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think putting the compliance report on the GitHub release page makes the most sense. It allows customers to grab the report easily before downloading any packages.
I also think that being proactive about making these reports available could reflect well on our SSDLC policy to customers.

Let me know if either of you have strong objections

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's proceed with the releases page we might amend README/docs about it

@cveticm cveticm marked this pull request as ready for review April 29, 2025 16:50
@cveticm cveticm requested a review from a team as a code owner April 29, 2025 16:50
@cveticm cveticm requested review from gssbzn and fmenezes April 30, 2025 10:42
@cveticm cveticm changed the base branch from master to CLOUDP-227276_ssdlc_phase_2 April 30, 2025 11:45
Copy link
Collaborator

Choose a reason for hiding this comment

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

general design comment, can we commit the purl file and make it a CI check (GH or EVG no preference) that is kept up to date, this is similar to how other repos manage this file

Copy link
Collaborator

Choose a reason for hiding this comment

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

check the library owners check which is kind of similar

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would't go for this approach we would jump from 2 files storing dependency information (library_owners.json and go.mod) to 3 files (library_owners.json, go.mod and purls.txt).

I would prefer for the tooling to translate dependencies into purls and later json on the fly as needed.

I'm inclined to even remove library_owners.json, given only our team has code in atlasCLI since the kubernetes plugin extraction.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm ok to remove lib owners (same reason) but I see value on purls being committed given shipped dependencies are not the same as the ones in go.mod and this raises awareness when adding new libs and the implications, this also comes with the comment that I'd like if purls are auto generated by the precommit hook, similar to mms

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have no strong opinion here. Having the purl file committed could definitely help with making dependencies more visible, but I see @fmenezes's point about not wanting to manage yet another file.

I can create a make command to generate purls from the binary and set up a GH action to check that it's up-to-date similar to how we do the docs check.

@fmenezes, any strong feelings about this idea?

Copy link
Collaborator

Choose a reason for hiding this comment

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

sure that is fine, we can commit it but bear in mind the extra checks

echo "Generating PURLs..."
cd "$WORKDIR/src/github.com/mongodb/mongodb-atlas-cli"

go build -C cmd/atlas -o tmp_binary
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can use make build git is already set up to ignore the files generated by that command, and that build process is hook to generate a similar binary to what we ship with go releaser

@github-actions github-actions bot removed the atlascli label May 1, 2025
- workdir
binary: make
args:
- gen-purls
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we shouldn't do it anymore, we should make sure the file is fully updated

# Authenticate Docker to AWS ECR
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 901841024863.dkr.ecr.us-east-1.amazonaws.com

cd "$WORKDIR/src/github.com/mongodb/mongodb-atlas-cli"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need this we can set working dir at evergreen function

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 901841024863.dkr.ecr.us-east-1.amazonaws.com

cd "$WORKDIR/src/github.com/mongodb/mongodb-atlas-cli"
mkdir ./compliance
Copy link
Collaborator

@fmenezes fmenezes May 1, 2025

Choose a reason for hiding this comment

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

nit: for empty folders you can commit a complicance/.gitkeep empty file to keep folder on source code

- AWS_SESSION_TOKEN
- workdir
binary: build/package/generate-sbom.sh
"write kondukto credentials":
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should merge "write kondukto credentials" and "run silkbomb" and make sure to add a rm kondukto_credentials.env in the end

@@ -533,6 +533,21 @@ functions:
binary: make
args:
- otel
"check purls":
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

.PHONY: gen-purls
gen-purls: # Generate purls on linux os
@echo "==> Generating purls"
GOOS=linux GOARCH=amd64 go build -trimpath -mod=readonly -o bin/atlas-linux ./cmd/atlas
Copy link
Collaborator

Choose a reason for hiding this comment

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

why hardcode to linux?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

there are some dependencies which are used only by some builds. For the moment, we will only generate purls for linux (in the interest of reducing this PRs scope) and will include generation for all builds, compiling them into one list which will be used for sbom generation in CLOUDP-316920

Copy link
Collaborator

Choose a reason for hiding this comment

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

move to /scripts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This script is only run as part of CI and other scripts live in this dir such as check-licenses.sh so IMO it makes more sense to keep this script within ./build/ci

@@ -149,6 +149,15 @@ gen-docs: gen-docs-metadata ## Generate docs for atlascli commands
@echo "==> Generating docs"
go run -ldflags "$(LINKER_FLAGS)" ./tools/cmd/docs

.PHONY: gen-purls
gen-purls: # Generate purls on linux os
Copy link
Collaborator

Choose a reason for hiding this comment

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

will hooking this to the pre commit be a separate task?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't intended to since, as a part of CI, we do a check to see if purls.txt is up-to-date. Devs would have to manually run this command. My intent here was to give devs visual on changes to sbom because of their work.

I'm happy to include this command in pre commit. To verify @gssbzn, this would make the CI check is redundant, correct?

Copy link
Collaborator

Choose a reason for hiding this comment

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

this would make the CI check is redundant, correct?

No cause having the pre commit installed is opt-in, and you can also do git commit --no-verify so you still need to check the files is up to date on the CI

Also just inc ase, ideally this should only run if the go.mod is modified

Copy link
Contributor

github-actions bot commented May 2, 2025

Coverage Report 📈

Branch Commit Coverage
CLOUDP-227276_ssdlc_phase_2 36f21cd 37.1%
CLOUDP-315271_onboard_silkbomb_kundukto_to_ci 3633dd4 37.8%
Difference .7%

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