-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
fixes #962
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Update trivy cache | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "30 0 * * *" | ||
|
||
jobs: | ||
update_trivy_cache: | ||
environment: AWS | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Run install dependencies | ||
run: | | ||
sudo apt update && sudo apt install -y awscli curl wget apt-transport-https gnupg lsb-release | ||
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add - | ||
echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list | ||
sudo apt-get update | ||
sudo apt-get install trivy | ||
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
|
||
- name: Fetch trivy databases | ||
run: | | ||
trivy image --download-java-db-only | ||
trivy image --download-db-only | ||
- name: Create tar gz databases | ||
run: | | ||
pushd $HOME/.cache | ||
tar -czf trivy_cache.tar.gz ./trivy | ||
popd | ||
- name: Copy trivy databases | ||
run: aws s3 cp "$HOME/.cache/trivy_cache.tar.gz" "$TRIVY_CACHE_LOCATION/trivy_cache.tar.gz" | ||
env: # Set the secret as an env variable | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_SECRET }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} | ||
TRIVY_CACHE_LOCATION: ${{ secrets.TRIVY_CACHE_LOCATION }} | ||
|
||
- name: Report failure Status to Slack channel | ||
id: report-failure-status-slack | ||
# Also run this step in case of failures | ||
if: ${{ always() }} | ||
uses: ravsamhq/notify-slack-action@v2 | ||
with: | ||
status: ${{ job.status }} | ||
token: ${{ github.token }} | ||
notification_title: "Update trivy build in {repo} has {status_message}" | ||
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" | ||
notify_when: "failure,cancelled,warnings,skipped" | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
ca-certificates|20230311ubuntu0.22.04.1 | ||
ca-certificates|20240203~22.04.1 | ||
curl|7.81.0-1ubuntu1.18 | ||
openjdk-17-jdk-headless|17.0.12+7-1ubuntu2~22.04 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
ca-certificates|20230311ubuntu0.22.04.1 | ||
ca-certificates|20240203~22.04.1 | ||
curl|7.81.0-1ubuntu1.18 |