8000 Merge pull request #1281 from nginx/add-dependency-assertion · nginx/agent@ec0cb2a · GitHub
[go: up one dir, main page]

Skip to content

Commit ec0cb2a

Browse files
authored
Merge pull request #1281 from nginx/add-dependency-assertion
Security: Add assertion document generation
2 parents a520f9b + ea1fe70 commit ec0cb2a

File tree

< 8000 div class="d-md-none">

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

.github/workflows/assertion.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
2+
name: Generate and Sign Assertion Document
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
branch:
8+
type: string
9+
description: "The branch to run the assertion workflow on"
10+
required: false
11+
default: main
12+
13+
jobs:
14+
build-assertion-document:
15+
name: Build and Generate Assertion Document
16+
runs-on: ubuntu-22.04
17+
if: ${{ !github.event.pull_request.head.repo.fork }}
18+
permissions:
19+
id-token: write
20+
contents: read
21+
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 }}
27+
strategy:
28+
matrix:
29+
osarch: [amd64, arm64]
30+
steps:
31+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
32+
33+
- name: Set up Go
34+
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
35+
with:
36+
go-version-file: go.mod
37+
cache: false
38+
39+
- name: Gather build dependencies
40+
id: godeps
41+
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+
61+
echo "Checking dependencies..."
62+
go version -m build/nginx-agent > goversionm_${{ github.run_id }}_${{ github.run_number }}.txt
63+
ls -l goversionm_*.txt
64+
echo "goversionm=$(find -type f -name "goversionm*.txt" | head -n 1)" >> $GITHUB_ENV
65+
66+
- name: Generate Assertion Document
67+
id: assertiondoc
68+
uses: nginxinc/compliance-rules/.github/actions/assertion@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0
69+
with:
70+
artifact-name: nginx-agent_${{ env.branch_name }}_${{ matrix.osarch }}
71+
artifact-digest: ${{ env.agent-digest }}
72+
build-type: 'github'
73+
builder-id: 'github.com'
74+
builder-version: '${{env.GO_VERSION}}_test'
75+
invocation-id: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
76+
artifactory-user: ${{ secrets.ARTIFACTORY_USER }}
77+
artifactory-api-token: ${{ secrets.ARTIFACTORY_TOKEN }}
78+
artifactory-url: ${{ secrets.ARTIFACTORY_URL }}
79+
artifactory-repo: 'f5-nginx-go-local-approved-dependency'
80+
assertion-doc-file: assertion_nginx-agent_${{env.branch_name}}_${{matrix.osarch}}.json
81+
build-content-path: ${{ env.goversionm }}
82+
started-on: '${{ env.time_start }}'
83+
finished-on: '${{ env.time_end }}'
84+
85+
- name: Sign and Store Assertion Document
86+
id: sign
87+
uses: nginxinc/compliance-rules/.github/actions/sign@83e452166aaf0ad8f07caf91a4f1f903b3dea1e6 # v0.3.0
88+
with:
89+
assertion-doc: ${{ steps.assertiondoc.outputs.assertion-document-path }}

0 commit comments

Comments
 (0)
0