Skip to content

Commit

Permalink
ci(trivy): fix scan failures due to TOOMANYREQUESTS DB error
Browse files Browse the repository at this point in the history
Primary Changes
----------------
1. Updated the ci.yaml to make the trivy scan
   run only on the weekends

Fixes #3652

Signed-off-by: aldousalvarez <[email protected]>
  • Loading branch information
aldousalvarez committed Nov 29, 2024
1 parent 7579bc1 commit ba179c3
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ jobs:
- name: Set output
id: set-output
run: echo "run-coverage=${{ env.RUN_CODE_COVERAGE }}" >> "$GITHUB_OUTPUT"

check-day:
runs-on: ubuntu-22.04
outputs:
day_of_week: ${{ steps.get_day.outputs.day_of_week }}
steps:
- name: Get current day
id: get_day
run: |
# Get the current day of the week (1 = Monday, 7 = Sunday)
echo "day_of_week=$(date +'%u')" >> "$GITHUB_OUTPUT"
- name: Get current day and time
run: echo "Day of the Week from check-day ${{ needs.check-day.outputs.day_of_week }}"

Check failure on line 63 in .github/workflows/ci.yaml

View workflow job for this annotation

GitHub Actions / ActionLint / Lint_GitHub_Actions

property "check-day" is not defined in object type {}

compute_changed_packages:
needs: check-ci-skip
Expand Down Expand Up @@ -445,6 +458,7 @@ jobs:
needs:
- build-dev
- compute_changed_packages
- check-day
if: needs.compute_changed_packages.outputs.cmd-api-server-changed == 'true'
env:
DEV_BUILD_DISABLED: false
Expand Down Expand Up @@ -493,7 +507,7 @@ jobs:
--tag cmd-api-server \
--tag "ghcr.io/hyperledger/cactus-cmd-api-server:$(date +"%Y-%m-%dT%H-%M-%S" --utc)-dev-$(git rev-parse --short HEAD)"
- if: ${{ env.RUN_TRIVY_SCAN == 'true' }}
- if: ${{ env.RUN_TRIVY_SCAN == 'true' && (needs.check-day.outputs.day_of_week == '6' || needs.check-day.outputs.day_of_week == '7') }}
name: Run Trivy vulnerability scan for cmd-api-server
uses: aquasecurity/[email protected]
with:
Expand Down Expand Up @@ -1375,6 +1389,7 @@ jobs:
needs:
- build-dev
- compute_changed_packages
- check-day
if: needs.compute_changed_packages.outputs.plugin-ledger-connector-corda-changed == 'true'
env:
FREE_UP_GITHUB_RUNNER_DISK_SPACE_DISABLED: false
Expand Down Expand Up @@ -1417,7 +1432,7 @@ jobs:
working-directory: packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/
run: ./gradlew clean build -Pversion=dev -DrootProjectName=cacti-connector-corda-server

- if: ${{ env.RUN_TRIVY_SCAN == 'true' }}
- if: ${{ env.RUN_TRIVY_SCAN == 'true' && (needs.check-day.outputs.day_of_week == '6' || needs.check-day.outputs.day_of_week == '7') }}
name: Run Trivy vulnerability scan for cactus-connector-corda-server
uses: aquasecurity/[email protected]
with:
Expand Down Expand Up @@ -2274,12 +2289,13 @@ jobs:
run: DOCKER_BUILDKIT=1 docker build ./tools/docker/daml-all-in-one/ -f ./tools/docker/daml-all-in-one/Dockerfile

ghcr-keychain-vault-server:
needs: check-day
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: ghcr.io/hyperledger/cactus-keychain-vault-server
run: DOCKER_BUILDKIT=1 docker build ./packages/cactus-plugin-keychain-vault/src/cactus-keychain-vault-server/ -f ./packages/cactus-plugin-keychain-vault/src/cactus-keychain-vault-server/Dockerfile -t cactus-keychain-vault-server
- if: ${{ env.RUN_TRIVY_SCAN == 'true' }}
- if: ${{ env.RUN_TRIVY_SCAN == 'true' && (needs.check-day.outputs.day_of_week == '6' || needs.check-day.outputs.day_of_week == '7') }}}}
name: Run Trivy vulnerability scan for cactus-keychain-vault-server
uses: aquasecurity/[email protected]
with:
Expand Down

0 comments on commit ba179c3

Please sign in to comment.