Skip to content

Commit d205808

Browse files
authored
Merge pull request #969 from Automattic/reproducible-builds
feat: reproducible builds
2 parents f3b944a + dc85c05 commit d205808

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

.github/actions/build-docker-image/action.yml

+19-18
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ inputs:
5252
runs:
5353
using: composite
5454
steps:
55+
- name: Set up Docker
56+
uses: crazy-max/ghaction-setup-docker@v3
57+
with:
58+
daemon-config: |
59+
{
60+
"features": {
61+
"containerd-snapshotter": true
62+
}
63+
}
64+
5565
- name: Set up QEMU
5666
uses: docker/setup-qemu-action@v3
5767

@@ -72,15 +82,18 @@ runs:
7282
context: ${{ inputs.context }}
7383
file: ${{ inputs.file }}
7484
platforms: ${{ inputs.platforms }}
75-
push: ${{ inputs.push }}
76-
sbom: true
85+
outputs: |
86+
type=docker,rewrite-timestamp=true
87+
type=image,push=${{ inputs.push }},rewrite-timestamp=true
7788
tags: |
7889
${{ inputs.primaryTag }}
7990
${{ inputs.tags }}
8091
build-args: ${{ inputs.args }}
8192
cache-from: ${{ inputs.cache-from }}
8293
cache-to: ${{ inputs.cache-to }}
8394
no-cache: ${{ inputs.no-cache }}
95+
env:
96+
SOURCE_DATE_EPOCH: 0
8497

8598
- name: Get image name
8699
shell: bash
@@ -112,18 +125,6 @@ runs:
112125
push-to-registry: true
113126
if: inputs.push == 'true'
114127

115-
- name: Load image to local Docker
116-
uses: docker/build-push-action@v6
117-
with:
118-
load: true
119-
push: false
120-
context: ${{ inputs.context }}
121-
file: ${{ inputs.file }}
122-
tags: |
123-
${{ inputs.primaryTag }}
124-
${{ inputs.tags }}
125-
build-args: ${{ inputs.args }}
126-
127128
- name: Generate filename for SARIF
128129
shell: bash
129130
id: filename
@@ -158,7 +159,7 @@ runs:
158159
-v $(pwd)/.cache:/root/.cache \
159160
-v $(pwd):/workdir \
160161
-w /workdir \
161-
aquasec/trivy:0.56.1 image --format json --ignore-unfixed --pkg-types os --scanners vuln --db-repository ghcr.io/aquasecurity/trivy-db:2,public.ecr.aws/aquasecurity/trivy-db:2 ${{ inputs.primaryTag }} --output trivy.json
162+
aquasec/trivy:0.57.1 image --format json --ignore-unfixed --pkg-types os --scanners vuln --db-repository ghcr.io/aquasecurity/trivy-db:2,public.ecr.aws/aquasecurity/trivy-db:2 ${{ inputs.primaryTag }} --output trivy.json
162163
sudo chmod a+r -R .cache
163164
164165
- name: Calculate database hash
@@ -179,12 +180,12 @@ runs:
179180
if: steps.old_hash.outputs.hash != steps.new_hash.outputs.hash && steps.new_hash.outputs.hash != ''
180181

181182
- name: Print report
182-
uses: docker://aquasec/trivy:0.56.1
183+
uses: docker://aquasec/trivy:0.57.1
183184
with:
184185
args: convert --format=table trivy.json
185186

186187
- name: Generate SARIF
187-
uses: docker://aquasec/trivy:0.56.1
188+
uses: docker://aquasec/trivy:0.57.1
188189
with:
189190
args: convert --format=sarif --output=${{ steps.filename.outputs.filename }} trivy.json
190191
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
@@ -197,7 +198,7 @@ runs:
197198
continue-on-error: true
198199

199200
- name: Prepare markdown report
200-
uses: docker://aquasec/trivy:0.56.1
201+
uses: docker://aquasec/trivy:0.57.1
201202
with:
202203
args: convert --format=template --template=@.github/actions/build-docker-image/markdown.tpl --output=trivy.md trivy.json
203204
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name

0 commit comments

Comments
 (0)