Skip to content

Commit 6433ead

Browse files
committed
fix: Fix build workflow
Reclaim space before building docker images (no space left on runner) Avoid cleaning docker image while reclaiming runner space (trivy locally build its scanner image) Remove large-packages workaround (no more needed) Upgrade the GitHub actions to their latest versions (some were deprecated)
1 parent 3a22858 commit 6433ead

File tree

4 files changed

+23
-24
lines changed

4 files changed

+23
-24
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
workflow_dispatch:
1414

1515
jobs:
16-
build_push_and_check:
16+
build_push_check:
1717
name: Build docker image, publish it and run vuln scanner against it
1818
permissions:
1919
contents: read # for actions/checkout to fetch code
@@ -22,16 +22,20 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout repository
25-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
25+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7
2626
- name: Set up Docker Buildx
2727
id: buildx
28-
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # 2.4.1
28+
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # 3.6.1
2929
- name: Login to ghcr.io
30-
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # 2.1.0
30+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # 3.3.0
3131
with:
3232
registry: ghcr.io
3333
username: ${{ github.actor }}
3434
password: ${{ secrets.GITHUB_TOKEN }}
35+
- name: Free Disk Space (Ubuntu) # Reclaim disk space for build
36+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
37+
with:
38+
docker-images: false # Do not remove locally built images (including trivy scanner)
3539
- name: Build images
3640
id: build
3741
run: ./build
@@ -41,33 +45,28 @@ jobs:
4145
run: ./build --describe >> $GITHUB_STEP_SUMMARY
4246
- name: Push images
4347
run: ./build --push
44-
- name: Free Disk Space (Ubuntu) # Required by trivy to have enough space to scan full image
45-
uses: jlumbroso/free-disk-space@76866dbe54312617f00798d1762df7f43def6e5c # v1.2.0
46-
with:
47-
large-packages: false # Temporary fix for https://github.com/jlumbroso/free-disk-space/issues/4
4848
- name: Run Trivy vulnerability scanner
49-
uses: aquasecurity/trivy-action@41f05d9ecffa2ed3f1580af306000f734b733e54 # v0.11.2
49+
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # v0.24.0
5050
with:
5151
image-ref: '${{ steps.build.outputs.LATEST_IMAGE_TAG }}'
5252
format: 'sarif'
5353
output: 'trivy-results.sarif'
5454
severity: 'CRITICAL,HIGH'
5555
limit-severities-for-sarif: true
5656
- name: Upload Trivy scan results to GitHub Security tab
57-
uses: github/codeql-action/upload-sarif@v2
57+
uses: github/codeql-action/upload-sarif@v3
5858
with:
5959
sarif_file: 'trivy-results.sarif'
60+
6061
keepalive-job:
6162
name: Keep repository alive to prevent workflows to be disabled
6263
if: ${{ always() }}
63-
needs: build_push_and_check
64+
needs: build_push_check
6465
permissions:
65-
actions: write
66+
actions: write # for gautamkrishnar/keepalive-workflow to keep the workflow alive
6667
runs-on: ubuntu-latest
6768
steps:
6869
- name: Checkout repository
69-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
70+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7
7071
- name: Keep workflow alive
71-
uses: gautamkrishnar/keepalive-workflow@306efe4fc63923e36571682b4f4b3e3eee8b6625 # v1.2.6
72-
with:
73-
use_api: true
72+
uses: gautamkrishnar/keepalive-workflow@24ba73b43d5ea8d2b3d56fb9b8de951ba9a3dd18 # v2.0.6

.github/workflows/docker-tag.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
packages: write
1515
steps:
1616
- name: Checkout repository
17-
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # 3.3.0
17+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 4.1.7
1818
- name: Login to ghcr.io
19-
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # 2.1.0
19+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # 3.3.0
2020
with:
2121
registry: ghcr.io
2222
username: ${{ github.actor }}

.github/workflows/registry-cleanup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
packages: write
1414
steps:
1515
- name: Prune untagged images
16-
uses: vlaurin/action-ghcr-prune@0a539594d122b915e71c59733a5b115bfaaf5d52 #v0.5.0
16+
uses: vlaurin/action-ghcr-prune@0cf7d39f88546edd31965acba78cdcb0be14d641 #v0.6.0
1717
with:
1818
token: ${{ secrets.GITHUB_TOKEN }}
1919
organization: Datadog

.github/workflows/vuln-check.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424
- name: Checkout code
2525
uses: actions/checkout@v3
2626

27-
- name: Free Disk Space (Ubuntu) # Required by trivy to have enough space to scan full image
28-
uses: jlumbroso/free-disk-space@76866dbe54312617f00798d1762df7f43def6e5c # v1.2.0
27+
- name: Free Disk Space (Ubuntu) # Reclaim disk space for scan
28+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
2929
with:
30-
large-packages: false # Temporary fix for https://github.com/jlumbroso/free-disk-space/issues/4
30+
docker-images: false # Do not remove locally built images (including trivy scanner)
3131

3232
- name: Run Trivy vulnerability scanner
33-
uses: aquasecurity/trivy-action@41f05d9ecffa2ed3f1580af306000f734b733e54 # v0.11.2
33+
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # v0.24.0
3434
with:
3535
image-ref: 'ghcr.io/datadog/dd-trace-java-docker-build:latest'
3636
format: 'sarif'
@@ -39,7 +39,7 @@ jobs:
3939
limit-severities-for-sarif: true
4040

4141
- name: Upload Trivy scan results to GitHub Security tab
42-
uses: github/codeql-action/upload-sarif@v2
42+
uses: github/codeql-action/upload-sarif@v3
4343
if: always()
4444
with:
4545
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)