mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
[3.5]Add trivy scan as a job in release workflow
Signed-off-by: ArkaSaha30 <arkasaha30@gmail.com>
This commit is contained in:
parent
01851daabe
commit
1404f5aabd
42
.github/workflows/release.yaml
vendored
42
.github/workflows/release.yaml
vendored
@ -4,10 +4,10 @@ jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
||||
- id: goversion
|
||||
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/setup-go@v2
|
||||
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
||||
with:
|
||||
go-version: ${{ steps.goversion.outputs.goversion }}
|
||||
- name: release
|
||||
@ -30,3 +30,41 @@ jobs:
|
||||
- name: test-image
|
||||
run: |
|
||||
VERSION=3.5.99 ./scripts/test_images.sh
|
||||
- name: save-image
|
||||
run: |
|
||||
docker image save -o /tmp/etcd-img.tar gcr.io/etcd-development/etcd
|
||||
- name: upload-image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: etcd-img
|
||||
path: /tmp/etcd-img.tar
|
||||
retention-days: 1
|
||||
trivy-scan:
|
||||
needs: main
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platforms: [amd64, arm64, ppc64le, s390x]
|
||||
permissions:
|
||||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: get-image
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: etcd-img
|
||||
path: /tmp
|
||||
- name: load-image
|
||||
run: |
|
||||
docker load < /tmp/etcd-img.tar
|
||||
- name: trivy-scan
|
||||
uses: aquasecurity/trivy-action@d710430a6722f083d3b36b8339ff66b32f22ee55 # v0.19.0
|
||||
with:
|
||||
image-ref: 'gcr.io/etcd-development/etcd:v3.5.99-${{ matrix.platforms }}'
|
||||
severity: 'CRITICAL,HIGH'
|
||||
format: 'sarif'
|
||||
output: 'trivy-results-${{ matrix.platforms }}.sarif'
|
||||
- name: upload scan results
|
||||
uses: github/codeql-action/upload-sarif@956f09c2ef1926b580554b9014cfb8a51abf89dd # v2.16.6
|
||||
with:
|
||||
sarif_file: 'trivy-results-${{ matrix.platforms }}.sarif'
|
||||
|
37
.github/workflows/trivy-nightly-scan.yaml
vendored
37
.github/workflows/trivy-nightly-scan.yaml
vendored
@ -1,37 +0,0 @@
|
||||
name: Trivy Nightly Scan
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 2 * * *' # run at 2 AM UTC
|
||||
|
||||
permissions: read-all
|
||||
jobs:
|
||||
nightly-scan:
|
||||
name: Trivy Scan nightly
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# maintain the versions of etcd that need to be actively
|
||||
# security scanned
|
||||
versions: [v3.5.6]
|
||||
permissions:
|
||||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
|
||||
with:
|
||||
ref: release-3.5
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@9ab158e8597f3b310480b9a69402b419bc03dbd5 # master
|
||||
with:
|
||||
image-ref: 'gcr.io/etcd-development/etcd:${{ matrix.versions }}'
|
||||
severity: 'CRITICAL,HIGH'
|
||||
format: 'template'
|
||||
template: '@/contrib/sarif.tpl'
|
||||
output: 'trivy-results-3-5.sarif'
|
||||
|
||||
- name: Upload Trivy scan results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@a669cc5936cc5e1b6a362ec1ff9e410dc570d190 # v2.1.36
|
||||
with:
|
||||
sarif_file: 'trivy-results-3-5.sarif'
|
Loading…
x
Reference in New Issue
Block a user