Skip to content

Commit 9936e85

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

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

.github/workflows/govulncheck.yml

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

0 commit comments

Comments
 (0)