|
| 1 | +--- |
| 2 | +name: Security Scanning 🕵️ |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +jobs: |
| 13 | + setup-matrix: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 17 | + steps: |
| 18 | + - name: Source checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - id: set-matrix |
| 22 | + run: echo "matrix=$(jq -c . build_versions.json)" >> $GITHUB_OUTPUT |
| 23 | + |
| 24 | + scan_ci_container: |
| 25 | + name: 'Scan CI container' |
| 26 | + runs-on: ubuntu-latest |
| 27 | + permissions: |
| 28 | + actions: read |
| 29 | + contents: read |
| 30 | + security-events: write |
| 31 | + needs: setup-matrix |
| 32 | + strategy: |
| 33 | + matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} |
| 34 | + steps: |
| 35 | + - name: Checkout repository |
| 36 | + uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Build CI container |
| 39 | + uses: docker/build-push-action@v6 |
| 40 | + with: |
| 41 | + tags: 'ci/voxbox:${{ matrix.rubygem_puppet }}' |
| 42 | + push: false |
| 43 | + build-args: | |
| 44 | + BASE_IMAGE=${{ matrix.base_image }} |
| 45 | + RUBYGEM_PUPPET=${{ matrix.rubygem_puppet }} |
| 46 | + RUBYGEM_FACTER=${{ matrix.facter_version }} |
| 47 | + RUBYGEM_VOXPUPULI_TEST=${{ matrix.rubygem_voxpupuli_test }} |
| 48 | + RUBYGEM_VOXPUPULI_ACCEPTANCE=${{ matrix.rubygem_voxpupuli_acceptance }} |
| 49 | + RUBYGEM_VOXPUPULI_RELEASE=${{ matrix.rubygem_voxpupuli_release }} |
| 50 | + RUBYGEM_PUPPET_METADATA=${{ matrix.rubygem_puppet_metadata }} |
| 51 | + RUBYGEM_OVERCOMMIT=${{ matrix.rubygem_overcommit }} |
| 52 | + RUBYGEM_MODULESYNC=${{ matrix.rubygem_modulesync }} |
| 53 | + RUBYGEM_BUNDLER=${{ matrix.rubygem_bundler }} |
| 54 | +
|
| 55 | + - name: Scan image with Anchore Grype |
| 56 | + uses: anchore/scan-action@v4 |
| 57 | + id: scan |
| 58 | + with: |
| 59 | + image: 'ci/voxbox:${{ matrix.rubygem_puppet }}' |
| 60 | + fail-build: false |
| 61 | + |
| 62 | + - name: Inspect action SARIF report |
| 63 | + run: jq . ${{ steps.scan.outputs.sarif }} |
| 64 | + |
| 65 | + - name: Upload Anchore scan SARIF report |
| 66 | + uses: github/codeql-action/upload-sarif@v3 |
| 67 | + with: |
| 68 | + sarif_file: ${{ steps.scan.outputs.sarif }} |
0 commit comments