Skip to content

Commit 8f9e214

Browse files
committed
add govulncheck for scanning vulnerabilities
Signed-off-by: Davanum Srinivas <[email protected]>
1 parent 2419fbd commit 8f9e214

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

.github/workflows/govulncheck.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Go Vulnerability Check
16+
17+
on:
18+
push:
19+
branches:
20+
- main
21+
- "pull-request/[0-9]+"
22+
paths-ignore:
23+
- '**/*.md'
24+
- 'docs/**'
25+
- 'LICENSE'
26+
- '.github/ISSUE_TEMPLATE/**'
27+
- '.github/headers/**'
28+
tags:
29+
- 'v*'
30+
workflow_dispatch:
31+
schedule:
32+
- cron: '0 6 * * *'
33+
34+
concurrency:
35+
group: ${{ github.workflow }}-${{ github.ref }}
36+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
37+
38+
permissions:
39+
contents: read
40+
security-events: write
41+
pull-requests: write
42+
43+
jobs:
44+
govulncheck:
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 30
47+
permissions:
48+
contents: read
49+
security-events: write
50+
steps:
51+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
52+
53+
- name: Run govulncheck on all components
54+
run: |
55+
# Define components to check
56+
declare -A components=(
57+
["data-models"]="data-models"
58+
["commons"]="commons"
59+
["platform-connectors"]="platform-connectors"
60+
["store-client-sdk"]="store-client-sdk"
61+
["health-events-analyzer"]="health-events-analyzer"
62+
["fault-quarantine-module"]="fault-quarantine-module"
63+
["fault-remediation-module"]="fault-remediation-module"
64+
["labeler-module"]="labeler-module"
65+
["node-drainer-module"]="node-drainer-module"
66+
["janitor"]="janitor"
67+
["syslog-health-monitor"]="health-monitors/syslog-health-monitor"
68+
["csp-health-monitor"]="health-monitors/csp-health-monitor"
69+
["tests"]="tests"
70+
["simple-health-client"]="tilt/simple-health-client"
71+
)
72+
73+
failed_components=()
74+
exit_code=0
75+
76+
echo "🔍 Running govulncheck on all components..."
77+
echo ""
78+
79+
for component in "${!components[@]}"; do
80+
path="${components[$component]}"
81+
echo "Checking $component (path: $path)..."
82+
83+
if govulncheck -C "$path" ./...; then
84+
echo "✅ $component: No vulnerabilities found"
85+
else
86+
echo "❌ $component: Vulnerabilities detected"
87+
failed_components+=("$component")
88+
exit_code=1
89+
fi
90+
echo ""
91+
done
92+
93+
echo "=== SUMMARY ==="
94+
if [ ${#failed_components[@]} -eq 0 ]; then
95+
echo "🎉 All components passed vulnerability checks!"
96+
else
97+
echo "🚨 Vulnerabilities found in ${#failed_components[@]} component(s):"
98+
for component in "${failed_components[@]}"; do
99+
echo " - $component"
100+
done
101+
echo ""
102+
echo "Please review and address the vulnerabilities in the components listed above."
103+
fi
104+
105+
exit $exit_code

0 commit comments

Comments
 (0)