-
Notifications
You must be signed in to change notification settings - Fork 0
Revert "ci: add trivy image scanning prior to release image push" #24
New issue
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,7 @@ on: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
31
to
34
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| trivy-scan-and-test: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -69,7 +70,41 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| severity: 'CRITICAL,HIGH,MEDIUM,LOW' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit-code: '1' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run Go Unit Tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Comment Trivy Results on the Pull Request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '### Trivy Scan Results' > comment_trivy.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -s trivy-results.txt ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '#### Vulnerabilities Found' >> comment_trivy.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '```' >> comment_trivy.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat trivy-results.txt >> comment_trivy.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '```' >> comment_trivy.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '#### No vulnerabilities found :white_check_mark:' >> comment_trivy.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh pr comment ${{ github.event.pull_request.number }} --body-file comment_trivy.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+73
to
+86
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+73
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When this workflow is invoked via |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run Go Unit Tests and Comment Results | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: ${{ inputs.run_go_tests }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| working-directory: ${{ inputs.working_directory }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: go test -v ${{ inputs.test_path }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '### Go Unit Test Results' > comment_go_tests.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '| Test Name | Status |' >> comment_go_tests.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo '| --------- | ------ |' >> comment_go_tests.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run Go tests and check for failures in real-time | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| go test -v ${{ inputs.test_path }} | grep -E '^(--- PASS|--- FAIL)' | sed -E 's/^(--- PASS: )(.*)/\|\2\|Pass\|/; s/^(--- FAIL: )(.*)/\|\2\|Fail\|/' >> comment_go_tests.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Post test results to PR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| gh pr comment ${{ github.event.pull_request.number }} --body-file comment_go_tests.md | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Check for failed tests and exit if any test fails | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if go test -v ${{ inputs.test_path }} | grep -q '^--- FAIL'; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "There are failed tests. Failing the job." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+98
to
+108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Comment on lines
+98
to
+108
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This revert collapses the previous three-step sequence (build locally → scan with Trivy → push) into a single build-and-push step. As a result, Docker images are now pushed to the GCP registry and immediately deployed to GKE / Cloud Run without any image-layer vulnerability gate. The filesystem scan in
trivy-go-tests.yamlruns against source files on pull requests, but it does not cover the final built image and does not run in this deployment pipeline. Any critical or high CVE introduced into a base image or installed dependency layer would reach production undetected.