-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #165 from MTES-MCT/update-trvy-job
refactor(ci): scan file system instead of building a container
- Loading branch information
Showing
3 changed files
with
14 additions
and
51 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
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 |
---|---|---|
|
@@ -30,51 +30,12 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Get frontend version | ||
uses: avides/[email protected] | ||
id: frontend_version | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
file-to-check: frontend/package.json | ||
only-return-version: true | ||
|
||
- name: use-version-from-check | ||
run: echo "The version we just got is ${{ steps.frontend_version.outputs.version }}" | ||
|
||
- name: Build image | ||
uses: docker/build-push-action@v4 | ||
env: | ||
GITHUB_SHA: ${{ github.sha }} | ||
VERSION: ${{ steps.frontend_version.outputs.version }} | ||
ENV_PROFILE: "prod" | ||
with: | ||
context: . | ||
builder: ${{ steps.buildx.outputs.name }} | ||
file: infra/docker/app/DockerfileCI | ||
push: true | ||
tags: | | ||
ghcr.io/mtes-mct/rapportnav2/rapportnav-app:${{ github.sha }} | ||
build-args: | | ||
VERSION=${{ env.VERSION }} | ||
ENV_PROFILE=${{ env.ENV_PROFILE }} | ||
GITHUB_SHA=${{ github.sha }} | ||
- name: Run Trivy on OS | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: "ghcr.io/mtes-mct/rapportnav2/rapportnav-app:${{ github.sha }}" | ||
format: sarif | ||
scan-type: "fs" | ||
ignore-unfixed: true | ||
format: "sarif" | ||
vuln-type: "os" | ||
output: "trivy-results-os.sarif" | ||
severity: "LOW,MEDIUM,HIGH,CRITICAL" | ||
|
@@ -88,8 +49,9 @@ jobs: | |
- name: Run Trivy on libraries | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: "ghcr.io/mtes-mct/rapportnav2/rapportnav-app:${{ github.sha }}" | ||
format: sarif | ||
scan-type: "fs" | ||
ignore-unfixed: true | ||
format: "sarif" | ||
vuln-type: "library" | ||
output: "trivy-results-libs.sarif" | ||
severity: "HIGH,CRITICAL" | ||
|
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