We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I thought this would be easy but I was wrong. Consider the following Github action:
name: Daily Pull and Vulnerability Scan on: schedule: - cron: "0 0 * * *" # Runs daily at midnight UTC workflow_dispatch: # Allows manual trigger jobs: pull-and-scan: runs-on: ubuntu-latest steps: - name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASS }} - name: Pull Docker image run: | IMAGE_NAME="example-image-name:latest" docker pull $IMAGE_NAME env: IMAGE_NAME: example-image-name:latest - name: Scan Docker image with Trivy id: scan_image uses: aquasecurity/trivy-action@master with: image-ref: example-image-name:latest ignore-unfixed: true # Optional: set to false to capture all vulnerabilities format: "table" # Output format exit-code: '123' - name: Check if vulnerabilities are found id: check_scan run: | # Fail the job if vulnerabilities were found if [[ "${{ steps.scan_image.outputs.results }}" != "" ]]; then echo "Vulnerabilities found!" echo "needs_rebuild=true" >> $GITHUB_ENV else echo "No vulnerabilities found." echo "needs_rebuild=false" >> $GITHUB_ENV fi - name: Build and push Docker image if: env.needs_rebuild == 'true' id: push uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile push: true tags: example-image-name:latest
It never reaches the portion to decide what to do if vulnerabilities are found:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I thought this would be easy but I was wrong. Consider the following Github action:
It never reaches the portion to decide what to do if vulnerabilities are found:
The text was updated successfully, but these errors were encountered: