Skip to content

Commit 61e50a6

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

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

.github/workflows/govulncheck.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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: Setup Go
54+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
55+
with:
56+
go-version: 'stable'
57+
58+
- name: Install govulncheck
59+
run: go install golang.org/x/vuln/cmd/govulncheck@latest
60+
61+
- name: Run govulncheck on all components
62+
run: |
63+
# Define components to check
64+
declare -A components=(
65+
["data-models"]="data-models"
66+
["commons"]="commons"
67+
["platform-connectors"]="platform-connectors"
68+
["store-client-sdk"]="store-client-sdk"
69+
["health-events-analyzer"]="health-events-analyzer"
70+
["fault-quarantine-module"]="fault-quarantine-module"
71+
["fault-remediation-module"]="fault-remediation-module"
72+
["labeler-module"]="labeler-module"
73+
["node-drainer-module"]="node-drainer-module"
74+
["janitor"]="janitor"
75+
["syslog-health-monitor"]="health-monitors/syslog-health-monitor"
76+
["csp-health-monitor"]="health-monitors/csp-health-monitor"
77+
["tests"]="tests"
78+
["simple-health-client"]="tilt/simple-health-client"
79+
)
80+
81+
failed_components=()
82+
exit_code=0
83+
84+
echo "🔍 Running govulncheck on all components..."
85+
echo ""
86+
87+
for component in "${!components[@]}"; do
88+
path="${components[$component]}"
89+
echo "Checking $component (path: $path)..."
90+
91+
if govulncheck -C "$path" ./...; then
92+
echo "✅ $component: No vulnerabilities found"
93+
else
94+
echo "❌ $component: Vulnerabilities detected"
95+
failed_components+=("$component")
96+
exit_code=1
97+
fi
98+
echo ""
99+
done
100+
101+
echo "=== SUMMARY ==="
102+
if [ ${#failed_components[@]} -eq 0 ]; then
103+
echo "🎉 All components passed vulnerability checks!"
104+
else
105+
echo "🚨 Vulnerabilities found in ${#failed_components[@]} component(s):"
106+
for component in "${failed_components[@]}"; do
107+
echo " - $component"
108+
done
109+
echo ""
110+
echo "Please review and address the vulnerabilities in the components listed above."
111+
fi
112+
113+
exit $exit_code

0 commit comments

Comments
 (0)