|
32 | 32 | args: --timeout 10m --verbose --issues-exit-code=0 |
33 | 33 | only-new-issues: true |
34 | 34 |
|
| 35 | + code-scan: |
| 36 | + name: Code Scan |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: Checkout code |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Run Trivy vulnerability scanner in repo mode |
| 43 | + uses: aquasecurity/[email protected] |
| 44 | + continue-on-error: true |
| 45 | + with: |
| 46 | + scan-type: "fs" |
| 47 | + ignore-unfixed: true |
| 48 | + exit-code: "1" |
| 49 | + format: "sarif" |
| 50 | + output: "trivy-results.sarif" |
| 51 | + severity: "CRITICAL,HIGH,MEDIUM" |
| 52 | + |
| 53 | + - name: Upload Trivy scan results to GitHub Security tab |
| 54 | + uses: github/codeql-action/upload-sarif@v3 |
| 55 | + with: |
| 56 | + sarif_file: "trivy-results.sarif" |
| 57 | + |
35 | 58 | govulncheck: |
36 | 59 | runs-on: ubuntu-latest |
37 | 60 | name: Run govulncheck |
@@ -103,27 +126,35 @@ jobs: |
103 | 126 | uses: docker/setup-buildx-action@v3 |
104 | 127 | with: |
105 | 128 | platforms: ${{ matrix.platform }} |
| 129 | + driver: docker-container |
| 130 | + use: true |
106 | 131 |
|
107 | 132 | - name: Build Images |
108 | 133 | uses: docker/build-push-action@v6 |
109 | 134 | with: |
110 | 135 | context: . |
111 | 136 | platforms: ${{ matrix.platform }} |
112 | | - load: true |
113 | 137 | push: false |
114 | 138 | tags: quay.io/jetstack/version-checker:${{github.sha}} |
115 | 139 | cache-from: type=gha |
116 | 140 | cache-to: type=gha,mode=max |
| 141 | + # https://github.com/docker/buildx/issues/1714 |
| 142 | + # Whilst trivy says it supports .tar etc, it wouldn't work in gha or locally on my machine. |
| 143 | + outputs: |- |
| 144 | + type=oci,tar=false,compression=uncompressed,dest=./.oci-image |
117 | 145 | attests: |- |
118 | | - type=sbom,generator=image |
| 146 | + type=sbom |
119 | 147 | type=provenance,mode=max |
120 | 148 |
|
121 | 149 | - name: Run Trivy vulnerability scanner |
122 | 150 | uses: aquasecurity/[email protected] |
123 | 151 | with: |
124 | | - image-ref: "quay.io/jetstack/version-checker:${{github.sha}}" |
| 152 | + input: ./.oci-image |
125 | 153 | format: "table" |
126 | 154 | exit-code: "1" |
127 | 155 | ignore-unfixed: true |
128 | 156 | vuln-type: "os,library" |
129 | 157 | severity: "CRITICAL,HIGH" |
| 158 | + |
| 159 | + - name: "Cleanup OCI Image from FS" |
| 160 | + run: rm -rf ./.oci-image |
0 commit comments