Skip to content

Commit 6e1e15f

Browse files
RATIS-2372. Add weekly CVE vulnerability check workflow for Apache Ratis (#1328)
Signed-off-by: OneSizeFitsQuorum <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent bc9fab8 commit 6e1e15f

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: vulnerability-check
17+
18+
on:
19+
schedule:
20+
# Run at 16:00 UTC every Sunday (Monday 00:00 CST)
21+
- cron: "0 16 * * 0"
22+
workflow_dispatch:
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.ref }}
26+
cancel-in-progress: true
27+
28+
env:
29+
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
30+
MAVEN_ARGS: --batch-mode --no-transfer-progress
31+
32+
jobs:
33+
dependency-check:
34+
if: ${{ github.event_name == 'workflow_dispatch' || github.repository == 'apache/ratis' }}
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
- name: Set up JDK 11
40+
uses: actions/setup-java@v4
41+
with:
42+
distribution: corretto
43+
java-version: 11
44+
45+
- name: Do Maven install
46+
shell: bash
47+
run: mvn $MAVEN_ARGS clean install -DskipTests
48+
49+
- name: Do the dependency-check:aggregate
50+
shell: bash
51+
run: mvn $MAVEN_ARGS org.owasp:dependency-check-maven:aggregate -DossIndexUsername=${{ secrets.OSS_INDEX_USER }} -DossIndexPassword=${{ secrets.OSS_INDEX_TOKEN }} -DnvdApiKey=${{ secrets.NVD_API_KEY }}
52+
53+
- name: Generate report date for artifact name
54+
run: |
55+
utc_time="${{ github.run_started_at }}"
56+
target_time=$(TZ=Asia/Shanghai date -d "$utc_time" +"%Y-%m-%d")
57+
echo "REPORT_DATE=$target_time" >> $GITHUB_ENV
58+
59+
- name: Upload Artifact
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: vulnerability-check-result-${{ env.REPORT_DATE }}
63+
path: target/dependency-check-report.html
64+
retention-days: 15

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,11 @@
726726
</execution>
727727
</executions>
728728
</plugin>
729+
<plugin>
730+
<groupId>org.owasp</groupId>
731+
<artifactId>dependency-check-maven</artifactId>
732+
<version>12.1.9</version>
733+
</plugin>
729734
</plugins>
730735
<resources>
731736
<resource>

0 commit comments

Comments
 (0)