-
Notifications
You must be signed in to change notification settings - Fork 85
CLOUDP-319858: Auto-update SBOM report in codebase #3902
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
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
7b9f213
WIP
blva 9441335
update
blva e3ba295
update
blva 3387c48
update
blva cddaf93
shell check
blva 9fd512d
update
blva 5a5616a
update
blva 8e016b3
update working dir
blva bc4398f
update
blva 1b834db
updatE
blva f6c1bf6
update
blva d92703c
update
blva b37caf0
undo change
blva d664e08
update
blva 13c177c
update
blva 9e8914d
update
blva 3f768de
update
blva 4092348
Address comment: update link
blva 9189f5e
CLOUDP-319858: Auto-update SBOM report in codebase
blva b562bf8
update gitignore
blva 65f5fc1
update
blva 61b189f
update
blva a231345
Merge remote-tracking branch 'origin/master' into CLOUDP-319858
blva 31ae5b1
remove ssdlc report gen from sbom upload task
blva b4ce956
update report gen
blva bd8894f
update
blva 1ba9ef9
update
blva 9eca2a2
update
blva 9bdee99
Create jira ticket
blva 4882767
shellcheck
blva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
name: Update Compliance Report | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'atlascli tag version (e.g. 1.42.2)' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
update-compliance-report: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: GitHubSecurityLab/actions-permissions/monitor@v1 | ||
with: | ||
config: ${{ vars.PERMISSIONS_CONFIG }} | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Extract AUTHOR and VERSION | ||
id: extract | ||
run: | | ||
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then | ||
# Expect input like 'atlascli/v1.42.2' or '1.42.2' | ||
TAG="${{ github.event.inputs.tag }}" | ||
VERSION="${TAG#atlascli/v}" | ||
AUTHOR="${{ github.actor }}" | ||
else | ||
# GITHUB_REF is refs/tags/atlascli/v1.42.2 | ||
VERSION="${GITHUB_REF#refs/tags/atlascli/v}" | ||
AUTHOR="${{ github.event.release.author.login }}" | ||
fi | ||
echo "author=$AUTHOR" >> "$GITHUB_OUTPUT" | ||
echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
- name: Run gen-ssdlc-report.sh | ||
env: | ||
AUTHOR: ${{ steps.extract.outputs.author }} | ||
VERSION: ${{ steps.extract.outputs.version }} | ||
run: ./build/package/gen-ssdlc-report.sh | ||
- name: set Apix Bot token | ||
id: app-token | ||
uses: mongodb/apix-action/token@3024080388613583e3bd119bfb1ab4b4dbf43c42 | ||
with: | ||
app-id: ${{ secrets.APIXBOT_APP_ID }} | ||
private-key: ${{ secrets.APIXBOT_APP_PEM }} | ||
- name: Find JIRA ticket | ||
id: find | ||
uses: mongodb/apix-action/find-jira@3024080388613583e3bd119bfb1ab4b4dbf43c42 | ||
with: | ||
token: ${{ secrets.JIRA_API_TOKEN }} | ||
jql: project = CLOUDP AND status NOT IN (Closed, Resolved) AND summary ~ "Update Compliance Report" | ||
- name: Set JIRA ticket (find) | ||
if: steps.find.outputs.found == 'true' | ||
run: | | ||
echo "JIRA_KEY=${{steps.find.outputs.issue-key}}" >> "$GITHUB_ENV" | ||
- name: Create JIRA ticket | ||
uses: mongodb/apix-action/create-jira@3024080388613583e3bd119bfb1ab4b4dbf43c42 | ||
id: create | ||
if: steps.find.outputs.found == 'false' | ||
with: | ||
token: ${{ secrets.JIRA_API_TOKEN }} | ||
project-key: CLOUDP | ||
summary: "[AtlasCLI] Update Compliance Report" | ||
issuetype: Story | ||
description: Update Compliance Report | ||
components: AtlasCLI | ||
assignee: ${{ secrets.ASSIGNEE_JIRA_TICKET }} | ||
extra-data: | | ||
{ | ||
"fields": { | ||
"fixVersions": [ | ||
{ | ||
"id": "41805" | ||
} | ||
], | ||
"customfield_12751": [ | ||
{ | ||
"id": "22223" | ||
} | ||
], | ||
"customfield_10257": { | ||
"id": "11861" | ||
} | ||
} | ||
} | ||
- name: Set JIRA ticket (create) | ||
if: steps.find.outputs.found == 'false' | ||
run: | | ||
echo "JIRA_KEY=${{steps.create.outputs.issue-key}}" >> "$GITHUB_ENV" | ||
- uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e | ||
id: pr | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
committer: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>" | ||
author: "${{ steps.app-token.outputs.user-name }} <${{ steps.app-token.outputs.user-email }}>" | ||
title: "${{ env.JIRA_KEY }}: Update compliance report for v${{ steps.extract.outputs.version }}" | ||
commit-message: "${{ env.JIRA_KEY }}: Update compliance report for v${{ steps.extract.outputs.version }}" | ||
delete-branch: true | ||
base: master | ||
branch: ${{ env.JIRA_KEY }} | ||
labels: | | ||
compliance | ||
auto | ||
auto_close_jira | ||
body: | | ||
## Proposed changes | ||
Update compliance report for v${{ steps.extract.outputs.version }} | ||
_Jira ticket:_ ${{ env.JIRA_KEY }} | ||
|
||
Note: Jira ticket will be closed automatically when this PR is merged. | ||
|
||
- name: Set auto merge | ||
env: | ||
GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
run: | | ||
gh pr merge "${{ steps.pr.outputs.pull-request-url }}" --auto --squash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
*.so | ||
*.dylib | ||
bin/** | ||
compliance/** | ||
dist/** | ||
# mac notarization service | ||
linux_amd64/** | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there a risk that gen-ssdlc-report.sh run on a codebase that no longer reflect the tag? What I mean here is that I don't see any step where you are getting the CLI codebase at the release tag so the ssdlc report may includes code changes that were merged after the release tag was created.
[solution] I think you should update the checkout step to download the codebase at the release tag
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.
good point, but since the report simply links to the tag link I think it will always show the sbom report that was generated upon tag release, right?
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.
ah, I don't know what
gen-ssdlc-report.sh
does 😅 Feel free to ignore the comment if the script does not actually do anything related to the codebase.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.
not for now, but its a good point! thanks