-
Notifications
You must be signed in to change notification settings - Fork 104
Security: Add assertion document generation #1281
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 19 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
309e4d8
Add assertion document generation workflow
sean-breen 851c54a
run workflow on feature branch push for test
sean-breen cd2bfd3
fix binary path
sean-breen 76d8db4
remove variable for binary name
sean-breen a804e7b
hardcode string for test
sean-breen 72e9ea1
runnin job via workflow_dispatch to not delay other CI
sean-breen 49a37b7
execute on PR
sean-breen b7bd9d5
fix branch name
sean-breen 56fed82
try again
sean-breen afe16f1
try again
sean-breen 9c5ee3f
add start and end times for binary build
sean-breen 6d88471
add write permission for signing job
sean-breen eedd67d
fix perms
sean-breen 69bfddf
change target branch for actions to feat/cosign-installation
sean-breen 6ba8b1d
remove push trigger
sean-breen a3d591f
Merge branch 'main' into add-dependency-assertion
sean-breen 5d90039
use compliance-scans main branch
sean-breen f11416b
fix trigger
sean-breen 88c6d60
remove push trigger
sean-breen d28b266
use commit id
sean-breen ec9162b
use commit id
sean-breen b3729e8
Merge branch 'main' into add-dependency-assertion
sean-breen ea1fe70
update actions version to 0.3.0
sean-breen 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,89 @@ | ||
|
|
||
| name: Generate and Sign Assertion Document | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| branch: | ||
| type: string | ||
| description: "The branch to run the assertion workflow on" | ||
| required: false | ||
| default: main | ||
|
|
||
| jobs: | ||
| build-assertion-document: | ||
| name: Build and Generate Assertion Document | ||
| runs-on: ubuntu-22.04 | ||
| if: ${{ !github.event.pull_request.head.repo.fork }} | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| env: | ||
| GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-local-approved-dependency" | ||
| outputs: | ||
| agent_binary: ${{ steps.check_binary.outputs.agent_binary }} | ||
| goversionm: ${{ steps.godeps.outputs.goversionm }} | ||
| assertion_document: ${{ steps.assertiondoc.outputs.assertion-document-path }} | ||
| strategy: | ||
| matrix: | ||
| osarch: [amd64, arm64] | ||
| steps: | ||
| - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: false | ||
|
|
||
| - name: Gather build dependencies | ||
| id: godeps | ||
| run: | | ||
| if [ -z ${{inputs.branch}} ]; then | ||
| echo "No branch input provided, using current branch: $GITHUB_REF_NAME" | ||
| else | ||
| echo "Checking out branch: ${{inputs.branch}}" | ||
| git checkout ${{inputs.branch}} | ||
| fi | ||
| echo "Current branch: $GITHUB_REF_NAME" | ||
| echo "branch_name=$GITHUB_REF_NAME" >> $GITHUB_ENV | ||
| GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//') | ||
| echo "GO_VERSION=$GO_VERSION" >> $GITHUB_ENV | ||
| echo "GO_VERSION=$GO_VERSION" | ||
| echo "time_start=$(date +%s)" >> $GITHUB_ENV | ||
| OSARCH=${{matrix.osarch}} make build | ||
| echo "time_end=$(date +%s)" >> $GITHUB_ENV | ||
| echo "Build time: $((time_end - time_start)) seconds" | ||
|
|
||
| echo "Getting sha256sum of the built nginx-agent binary..." | ||
| echo "agent-digest=$(sha256sum build/nginx-agent | awk '{print $1}')" >> $GITHUB_ENV | ||
|
|
||
| echo "Checking dependencies..." | ||
| go version -m build/nginx-agent > goversionm_${{ github.run_id }}_${{ github.run_number }}.txt | ||
| ls -l goversionm_*.txt | ||
| echo "goversionm=$(find -type f -name "goversionm*.txt" | head -n 1)" >> $GITHUB_ENV | ||
|
|
||
| - name: Generate Assertion Document | ||
| id: assertiondoc | ||
| uses: nginxinc/compliance-rules/.github/actions/assertion@main | ||
| with: | ||
| artifact-name: nginx-agent_${{ env.branch_name }}_${{ matrix.osarch }} | ||
| artifact-digest: ${{ env.agent-digest }} | ||
| build-type: 'github' | ||
| builder-id: 'github.com' | ||
| builder-version: '${{env.GO_VERSION}}_test' | ||
| invocation-id: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }} | ||
| artifactory-user: ${{ secrets.ARTIFACTORY_USER }} | ||
| artifactory-api-token: ${{ secrets.ARTIFACTORY_TOKEN }} | ||
| artifactory-url: ${{ secrets.ARTIFACTORY_URL }} | ||
| artifactory-repo: 'f5-nginx-go-local-approved-dependency' | ||
| assertion-doc-file: assertion_nginx-agent_${{env.branch_name}}_${{matrix.osarch}}.json | ||
| build-content-path: ${{ env.goversionm }} | ||
| started-on: '${{ env.time_start }}' | ||
| finished-on: '${{ env.time_end }}' | ||
|
|
||
| - name: Sign and Store Assertion Document | ||
| id: sign | ||
| uses: nginxinc/compliance-rules/.github/actions/sign@main | ||
| with: | ||
| assertion-doc: ${{ steps.assertiondoc.outputs.assertion-document-path }} | ||
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.
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.
can we use a commit id instead of a branch name?
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.
Added the commit id from current main, will update with a version tag once it's available
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.
Added the commit sha for
v0.3.0release