mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 15:06:50 +00:00
actions: trivy cache
This commit is contained in:
parent
8a54e1947c
commit
2dac0af430
19
.github/workflows/build_package.yml
vendored
19
.github/workflows/build_package.yml
vendored
@ -67,7 +67,21 @@ jobs:
|
||||
docker build . --file .github/Dockerfile_PreBuild_OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:$GITHUB_SHA-OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:latest-OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:develop-OC
|
||||
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }} --all-tags
|
||||
echo docker done
|
||||
|
||||
- id: trivy-db
|
||||
name: Check trivy db sha
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
endpoint='/orgs/aquasecurity/packages/container/trivy-db/versions'
|
||||
headers='Accept: application/vnd.github+json'
|
||||
jqFilter='.[] | select(.metadata.container.tags[] | contains("latest")) | .name | sub("sha256:";"")'
|
||||
sha=$(gh api -H "${headers}" "${endpoint}" | jq --raw-output "${jqFilter}")
|
||||
echo "Trivy DB sha256:${sha}"
|
||||
echo "::set-output name=sha::${sha}"
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: .trivy
|
||||
key: ${{ runner.os }}-trivy-db-${{ steps.trivy-db.outputs.sha }}
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
@ -78,6 +92,9 @@ jobs:
|
||||
security-checks: 'vuln'
|
||||
severity: 'CRITICAL,HIGH'
|
||||
timeout: '30m'
|
||||
cache-dir: .trivy
|
||||
- name: Fix .trivy permissions
|
||||
run: sudo chown -R $(stat . -c %u:%g) .trivy
|
||||
- name: Upload Trivy scan results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user