Use trivy action

This commit is contained in:
Amin Vakil 2021-03-07 16:54:19 +03:30
parent 7e3cf72dc4
commit cae30b99f4
No known key found for this signature in database
GPG key ID: 1EFC1864E9D9E56B

View file

@ -60,19 +60,17 @@ jobs:
- name: Check if the container is correctly stopped and removed.
run: docker stop ${DOCKERCONTAINER} && docker rm -fv ${DOCKERCONTAINER}
- name: Install trivy.
run: |
sudo curl -L https://github.com/aquasecurity/trivy/releases/download/v$TRIVY_VERSION/trivy_"$TRIVY_VERSION"_$(uname -s)-64bit.tar.gz -o /tmp/trivy.tar.gz
sudo tar -xzf /tmp/trivy.tar.gz -C /tmp
sudo mv /tmp/trivy /usr/local/bin/trivy
sudo chmod 755 /usr/local/bin/trivy
env:
TRIVY_VERSION: 0.16.0
- name: Run Trivy vulnerability scanner.
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ github.repository }}:${{ github.run_id }}
exit-code: '1'
- name: Run trivy.
run: |
trivy image --exit-code 1 ${GITHUB_REPOSITORY}:${GITHUB_RUN_ID}
trivy image --exit-code 1 ${GITHUB_REPOSITORY}:nossl
- name: Run Trivy vulnerability scanner.
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ github.repository }}:nossl
exit-code: '1'
deploy:
if: ${{ github.ref == 'refs/heads/master' }}