Skip to content

Commit c9ee916

Browse files
authored
ci(publish-maven): cache OWASP NVD data + raise timeout (#89)
1 parent 3c02d96 commit c9ee916

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

.github/workflows/_publish-maven.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
publish:
4545
name: Audit · Sign · Upload · Attest · Await approval
4646
runs-on: ubuntu-latest
47-
timeout-minutes: 30
47+
timeout-minutes: 90
4848
environment: maven-central-release
4949
permissions:
5050
contents: read
@@ -94,6 +94,28 @@ jobs:
9494
-DnewVersion="${RELEASE_VERSION}" \
9595
-DgenerateBackupPoms=false
9696
97+
- name: Compute weekly cache key for OWASP NVD data
98+
if: ${{ inputs.run-audit-profile }}
99+
id: nvd-cache-week
100+
run: echo "week=$(/bin/date -u +%GW%V)" >> "$GITHUB_OUTPUT"
101+
102+
# The OWASP dependency-check-maven plugin persists its synced NVD CVE
103+
# database under ~/.m2/repository/org/owasp/dependency-check-data. NIST's
104+
# NVD API can throttle a cold full sync (~364k+ records) to the point
105+
# where it blows past the job timeout; restoring last week's DB here
106+
# means subsequent runs only fetch the incremental delta instead of
107+
# resyncing from scratch. Keyed weekly (not on pom.xml) since the NVD
108+
# data changes independently of our dependencies; restore-keys fall back
109+
# to the newest available cache of any week if this week has none yet.
110+
- name: Restore cached OWASP dependency-check NVD data
111+
if: ${{ inputs.run-audit-profile }}
112+
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
113+
with:
114+
path: ~/.m2/repository/org/owasp/dependency-check-data
115+
key: owasp-dependency-check-nvd-${{ steps.nvd-cache-week.outputs.week }}
116+
restore-keys: |
117+
owasp-dependency-check-nvd-
118+
97119
- name: Full audit gate before release
98120
if: ${{ inputs.run-audit-profile }}
99121
env:
@@ -106,6 +128,16 @@ jobs:
106128
./mvnw --batch-mode verify -P audit -Ddependency-check.skip=true
107129
fi
108130
131+
# Save unconditionally (even on audit failure) so a partially-synced NVD
132+
# DB from a throttled run still speeds up the next attempt; actions/cache
133+
# skips the save if this exact key was already restored as an exact hit.
134+
- name: Save cached OWASP dependency-check NVD data
135+
if: ${{ inputs.run-audit-profile && !cancelled() }}
136+
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
137+
with:
138+
path: ~/.m2/repository/org/owasp/dependency-check-data
139+
key: owasp-dependency-check-nvd-${{ steps.nvd-cache-week.outputs.week }}
140+
109141
- name: Build + verify
110142
if: ${{ !inputs.run-audit-profile }}
111143
run: ./mvnw --batch-mode --no-transfer-progress verify -Dgpg.skip=true

0 commit comments

Comments
 (0)