22name : Generate and Sign Assertion Document
33
44on :
5- workflow_dispatch :
5+ workflow_call :
66 inputs :
7- branch :
7+ packageVersion :
8+ required : true
9+ type : string
10+ arm64_sha :
11+ required : true
812 type : string
9- description : " The branch to run the assertion workflow on"
10- required : false
11- default : main
13+ amd64_sha :
14+ required : true
15+ type : string
16+ secrets :
17+ ARTIFACTORY_USER :
18+ required : true
19+ ARTIFACTORY_TOKEN :
20+ required : true
1221
1322jobs :
1423 build-assertion-document :
@@ -19,68 +28,48 @@ jobs:
1928 id-token : write
2029 contents : read
2130 env :
22- GOPROXY : " https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@azr.artifactory.f5net.com/artifactory/api/go/f5-nginx-go-local-approved-dependency"
23- outputs :
24- agent_binary : ${{ steps.check_binary.outputs.agent_binary }}
25- goversionm : ${{ steps.godeps.outputs.goversionm }}
26- assertion_document : ${{ steps.assertiondoc.outputs.assertion-document-path }}
31+ GOPROXY : " https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@${{ secrets.ARTIFACTORY_URL }}"
2732 strategy :
28- matrix :
29- osarch : [amd64, arm64]
33+ matrix :
34+ osarch : [amd64, arm64]
3035 steps :
31- - uses : actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
32-
33- - name : Set up Go
34- uses : actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
36+ - name : Download nginx-agent binaries
37+ uses : actions/download-artifact@v3.0.2
3538 with :
36- go-version-file : go.mod
37- cache : false
39+ name : nginx-agent-binaries-${{ inputs.packageVersion }}
40+ path : ./artifacts
3841
3942 - name : Gather build dependencies
4043 id : godeps
4144 run : |
42- if [ -z ${{inputs.branch}} ]; then
43- echo "No branch input provided, using current branch: $GITHUB_REF_NAME"
44- else
45- echo "Checking out branch: ${{inputs.branch}}"
46- git checkout ${{inputs.branch}}
47- fi
48- echo "Current branch: $GITHUB_REF_NAME"
49- echo "branch_name=$GITHUB_REF_NAME" >> $GITHUB_ENV
50- GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//')
51- echo "GO_VERSION=$GO_VERSION" >> $GITHUB_ENV
52- echo "GO_VERSION=$GO_VERSION"
53- echo "time_start=$(date +%s)" >> $GITHUB_ENV
54- OSARCH=${{matrix.osarch}} make build
55- echo "time_end=$(date +%s)" >> $GITHUB_ENV
56- echo "Build time: $((time_end - time_start)) seconds"
57-
58- echo "Getting sha256sum of the built nginx-agent binary..."
59- echo "agent-digest=$(sha256sum build/nginx-agent | awk '{print $1}')" >> $GITHUB_ENV
60-
45+ ls -la artifacts/${{ matrix.osarch }}
46+ echo "agent_digest=$(cat artifacts/${{ matrix.osarch }}/nginx-agent.sha256)" >> $GITHUB_ENV
47+ echo "agent_buildstart=$(cat artifacts/${{ matrix.osarch }}/nginx-agent.buildstart)" >> $GITHUB_ENV
48+ echo "agent_buildend=$(cat artifacts/${{ matrix.osarch }}/nginx-agent.buildend)" >> $GITHUB_ENV
49+
6150 echo "Checking dependencies..."
62- go version -m build/nginx-agent > goversionm_${{ github.run_id }}_${{ github.run_number }}.txt
51+ go version -m build/${{ matrix.osarch }}/ nginx-agent > goversionm_${{ github.run_id }}_${{ github.run_number }}.txt
6352 ls -l goversionm_*.txt
6453 echo "goversionm=$(find -type f -name "goversionm*.txt" | head -n 1)" >> $GITHUB_ENV
6554
6655 - name : Generate Assertion Document
6756 id : assertiondoc
6857 uses : nginxinc/compliance-rules/.github/actions/assertion@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0
6958 with :
70- artifact-name : nginx-agent_${{ env.branch_name }}_${{ matrix.osarch }}
59+ artifact-name : nginx-agent_${{ github.ref_name }}_${{ matrix.osarch }}
7160 artifact-digest : ${{ env.agent-digest }}
7261 build-type : ' github'
7362 builder-id : ' github.com'
7463 builder-version : ' ${{env.GO_VERSION}}_test'
7564 invocation-id : ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
76- artifactory-user : ${{ secrets .ARTIFACTORY_USER }}
77- artifactory-api-token : ${{ secrets .ARTIFACTORY_TOKEN }}
65+ artifactory-user : ${{ inputs .ARTIFACTORY_USER }}
66+ artifactory-api-token : ${{ inputs .ARTIFACTORY_TOKEN }}
7867 artifactory-url : ${{ secrets.ARTIFACTORY_URL }}
7968 artifactory-repo : ' f5-nginx-go-local-approved-dependency'
80- assertion-doc-file : assertion_nginx-agent_${{env.branch_name }}_${{matrix.osarch}}.json
69+ assertion-doc-file : assertion_nginx-agent_${{ github.ref_name }}_${{matrix.osarch}}.json
8170 build-content-path : ${{ env.goversionm }}
82- started-on : ' ${{ env.time_start }}'
83- finished-on : ' ${{ env.time_end }}'
71+ started-on : ' ${{ env.agent_buildstart }}'
72+ finished-on : ' ${{ env.agent_buildend }}'
8473
8574 - name : Sign and Store Assertion Document
8675 id : sign
0 commit comments