Skip to content
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

security workflow does not repeat nightly scans #481

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 1 addition & 37 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
branches:
- renovate/**
pull_request:
schedule:
- cron: "14 3 * * *" # Daily at 3:14 AM

jobs:
build:
Expand Down Expand Up @@ -42,38 +40,4 @@ jobs:
severity: "CRITICAL,HIGH"
env:
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db

- name: Run Trivy in report mode
# Only generate sarif when running nightly on the main branch.
if: ${{ github.event_name == 'schedule' }}
uses: aquasecurity/[email protected]
with:
image-ref: ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_IMAGE_TAG }}
format: "template"
template: "@/contrib/sarif.tpl"
output: "trivy-results.sarif"
ignore-unfixed: false # Get full report when running nightly.
severity: "CRITICAL,HIGH"
env:
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db

- name: Upload Trivy scan results to GitHub Security tab
# Only upload sarif when running nightly on the main branch.
if: ${{ github.event_name == 'schedule' }}
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"

notify-failure:
if: ${{ github.event_name == 'schedule' && failure() }}
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Notify failure via Slack
uses: archive/github-actions-slack@master
with:
slack-bot-user-oauth-access-token: ${{ secrets.COREINT_SLACK_TOKEN }}
slack-channel: ${{ secrets.CAOS_COREINT_SLACK_CHANNEL }}
slack-text: "❌ `'newrelic/infrastructure-bundle'`: [security pipeline failed](${{ github.server_url }}/newrelic/infrastructure-bundle/actions/runs/${{ github.run_id }})."
Comment on lines -69 to -79
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get we remove the repeated Trivy check, but do we want to get rid of the notify failure step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only notifies failure if github.event_name == 'schedule' .
We are no longer running this with schedule because we have the nightly.
For failure on push PR the action will upload the results to the workflow on both success and failure.

TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db
Loading