-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e5d4c0
commit 55d2de0
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Image Scan | ||
on: | ||
schedule: | ||
- cron: "49 8 * * *" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository_owner }} | ||
|
||
jobs: | ||
jobcontroller: | ||
name: Trivy image scan | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ./container/jobcontroller.D | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/jobcontroller:${{ github.sha }} | ||
|
||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/jobcontroller:${{ github.sha }} | ||
format: sarif | ||
output: trivy-results-jobcontroller.sarif | ||
ignore-unfixed: true | ||
exit-code: 1 | ||
|
||
- name: Print results | ||
run: cat trivy-results-jobcontroller.sarif | ||
if: failure() | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
if: failure() | ||
with: | ||
sarif_file: trivy-results-jobcontroller.sarif | ||
|
||
runner: | ||
name: Trivy runner image scan | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: ./container/runner.D | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner:${{ github.sha }} | ||
|
||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/runner:${{ github.sha }} | ||
format: sarif | ||
output: trivy-results-runner.sarif | ||
ignore-unfixed: true | ||
exit-code: 1 | ||
|
||
- name: Print results | ||
run: cat trivy-results-runner.sarif | ||
if: failure() | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
if: failure() | ||
with: | ||
sarif_file: trivy-results-runner.sarif |