-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(security): Automatically scan container images (#2242)
* ci(security): Automatically scan container images Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com> * Fix bad image Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com> * Add resource discovery Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com> * build-args -> build-arg Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com> * Bump to fix vulernabilities Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com> * Try template Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com> * Folders are not supported Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com> * Fix wrong parameter name Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com> * Remove duplication Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com> --------- Signed-off-by: Tom Kerkhove <kerkhove.tom@gmail.com>
- Loading branch information
1 parent
e0bb9f3
commit 7aa1818
Showing
5 changed files
with
62 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,22 @@ | ||
name: CI - Container | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- .github/workflows/ci-container.yml | ||
- src/** | ||
|
||
jobs: | ||
scan_scaper: | ||
name: Scan Scraper Agent | ||
uses: ./.github/workflows/templates-scan-image.yml | ||
with: | ||
image_name: local/scraper:${{ github.sha }} | ||
project_name: Promitor.Agents.Scraper | ||
scan_resource_discovery: | ||
name: Scan Resource Discovery Agent | ||
uses: ./.github/workflows/templates-scan-image.yml | ||
with: | ||
image_name: local/resource-discovery:${{ github.sha }} | ||
project_name: Promitor.Agents.ResourceDiscovery |
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,34 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
image_name: | ||
required: true | ||
type: string | ||
project_name: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
scan: | ||
name: Scan Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout code | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build an image from Dockerfile | ||
run: | | ||
docker build ./src/ --file ./src/${{ inputs.project_name }}/Dockerfile.linux --build-arg VERSION="1.2.3" -t ${{ inputs.image_name }} | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: '${{ inputs.image_name }}' | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: 'trivy-results.sarif' |
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
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
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