Skip to content

Commit 18269c6

Browse files
authored
feat: add CodeQL and lint workflows for analysis and fix lint (#1)
* ci: add CodeQL and lint workflows for analysis Signed-off-by: Gaius <[email protected]> * chore(deps): Update module paths and dependencies for model-csi-driver Signed-off-by: Gaius <[email protected]> * fix(service): handle invalid inspection result in puller Signed-off-by: Gaius <[email protected]> --------- Signed-off-by: Gaius <[email protected]>
1 parent d3d47be commit 18269c6

34 files changed

+259
-147
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CodeQL Analysis
2+
3+
on:
4+
push:
5+
branches: [main, release-*]
6+
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
7+
pull_request:
8+
branches: [main, release-*]
9+
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
10+
schedule:
11+
- cron: '0 4 * * *'
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
analyze:
18+
name: Analyze
19+
runs-on: ubuntu-latest
20+
21+
permissions:
22+
security-events: write
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
language: [go]
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
32+
33+
- name: Initialize CodeQL
34+
uses: github/codeql-action/init@76621b61decf072c1cee8dd1ce2d2a82d33c17ed
35+
with:
36+
languages: ${{ matrix.language }}
37+
38+
- name: Autobuild
39+
uses: github/codeql-action/autobuild@76621b61decf072c1cee8dd1ce2d2a82d33c17ed
40+
41+
- name: Perform CodeQL Analysis
42+
uses: github/codeql-action/analyze@76621b61decf072c1cee8dd1ce2d2a82d33c17ed

.github/workflows/lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main, release-*]
6+
pull_request:
7+
branches: [main, release-*]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lint:
14+
name: Lint
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 30
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
20+
with:
21+
fetch-depth: '0'
22+
23+
- name: Golangci lint
24+
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd
25+
with:
26+
version: v2.0

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ release:
2121
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -tags disable_libgit2 -ldflags '${RELEASE_INFO} -w -extldflags "-static"' -o ./ ./cmd/model-csi-cli
2222

2323
test:
24-
@CGO_ENABLED=1 go test -tags disable_libgit2 -coverprofile cover.out.tmp -race -v -timeout 10m github.com/CloudNativeAI/model-csi-driver/pkg/server | tee coverage.log
24+
@CGO_ENABLED=1 go test -tags disable_libgit2 -coverprofile cover.out.tmp -race -v -timeout 10m github.com/modelpack/model-csi-driver/pkg/server | tee coverage.log
2525

2626
test-local:
27-
go test -tags disable_libgit2 -race -c -o ./unit.test github.com/CloudNativeAI/model-csi-driver/pkg/server
27+
go test -tags disable_libgit2 -race -c -o ./unit.test github.com/modelpack/model-csi-driver/pkg/server
2828
sudo CONFIG_PATH=./misc/config.test.yaml ./unit.test -test.timeout 1h -test.v -test.run ^TestServer$

cmd/model-csi-cli/main.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212
"github.com/sirupsen/logrus"
1313
"github.com/urfave/cli/v2"
1414

15-
"github.com/CloudNativeAI/model-csi-driver/pkg/client"
16-
"github.com/CloudNativeAI/model-csi-driver/pkg/logger"
17-
"github.com/CloudNativeAI/model-csi-driver/pkg/status"
15+
"github.com/modelpack/model-csi-driver/pkg/client"
16+
"github.com/modelpack/model-csi-driver/pkg/logger"
17+
"github.com/modelpack/model-csi-driver/pkg/status"
1818
)
1919

2020
var revision string
@@ -141,11 +141,19 @@ func main() {
141141
}
142142

143143
tw := tabwriter.NewWriter(os.Stdout, 1, 8, 1, '\t', 0)
144-
fmt.Fprintf(tw, "%s\t%s\t%s\n", "Mount ID", "Reference", "State")
144+
if _, err := fmt.Fprintf(tw, "%s\t%s\t%s\n", "Mount ID", "Reference", "State"); err != nil {
145+
return errors.Wrap(err, "write header")
146+
}
147+
145148
for _, mount := range mounts {
146-
fmt.Fprintf(tw, "%s\t%s\t%s\n", mount.MountID, mount.Reference, mount.State)
149+
if _, err := fmt.Fprintf(tw, "%s\t%s\t%s\n", mount.MountID, mount.Reference, mount.State); err != nil {
150+
return errors.Wrap(err, "write mount")
151+
}
152+
}
153+
154+
if err := tw.Flush(); err != nil {
155+
return errors.Wrap(err, "flush output")
147156
}
148-
tw.Flush()
149157

150158
return nil
151159
},

cmd/model-csi-driver/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import (
99
"github.com/sirupsen/logrus"
1010
"github.com/urfave/cli/v2"
1111

12-
"github.com/CloudNativeAI/model-csi-driver/pkg/config"
13-
"github.com/CloudNativeAI/model-csi-driver/pkg/logger"
14-
"github.com/CloudNativeAI/model-csi-driver/pkg/server"
12+
"github.com/modelpack/model-csi-driver/pkg/config"
13+
"github.com/modelpack/model-csi-driver/pkg/logger"
14+
"github.com/modelpack/model-csi-driver/pkg/server"
1515
)
1616

1717
var revision string

go.mod

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
module github.com/CloudNativeAI/model-csi-driver
1+
module github.com/modelpack/model-csi-driver
22

33
go 1.24.2
44

55
require (
6-
github.com/CloudNativeAI/modctl v0.0.4-rc.1
7-
github.com/CloudNativeAI/model-spec v0.0.6
86
github.com/container-storage-interface/spec v1.2.0
97
github.com/containerd/containerd v1.7.27
108
github.com/dustin/go-humanize v1.0.1
119
github.com/google/uuid v1.6.0
1210
github.com/labstack/echo/v4 v4.13.3
1311
github.com/moby/sys/mountinfo v0.7.2
12+
github.com/modelpack/modctl v0.1.0-alpha.0
13+
github.com/modelpack/model-spec v0.0.7
1414
github.com/opencontainers/go-digest v1.0.0
1515
github.com/opencontainers/image-spec v1.1.1
1616
github.com/pkg/errors v0.9.1
1717
github.com/prometheus/client_golang v1.22.0
1818
github.com/rexray/gocsi v1.2.2
1919
github.com/sirupsen/logrus v1.9.3
20-
github.com/stretchr/testify v1.10.0
20+
github.com/stretchr/testify v1.11.0
2121
github.com/urfave/cli/v2 v2.27.6
2222
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0
2323
go.opentelemetry.io/otel v1.37.0
2424
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0
2525
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.37.0
2626
go.opentelemetry.io/otel/sdk v1.37.0
2727
go.opentelemetry.io/otel/trace v1.37.0
28-
golang.org/x/net v0.40.0
29-
golang.org/x/sync v0.15.0
30-
google.golang.org/grpc v1.72.0
28+
golang.org/x/net v0.42.0
29+
golang.org/x/sync v0.16.0
30+
google.golang.org/grpc v1.75.0
3131
gopkg.in/yaml.v2 v2.4.0
3232
k8s.io/api v0.28.4
3333
k8s.io/apimachinery v0.28.4
3434
k8s.io/client-go v0.28.4
3535
)
3636

3737
require (
38-
d7y.io/api/v2 v2.1.39 // indirect
38+
d7y.io/api/v2 v2.1.57 // indirect
3939
dario.cat/mergo v1.0.2 // indirect
4040
github.com/BurntSushi/toml v1.5.0 // indirect
4141
github.com/Microsoft/go-winio v0.6.2 // indirect
4242
github.com/ProtonMail/go-crypto v1.3.0 // indirect
4343
github.com/VividCortex/ewma v1.2.0 // indirect
4444
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
45-
github.com/antgroup/hugescm v0.18.0 // indirect
45+
github.com/antgroup/hugescm v0.18.3 // indirect
4646
github.com/avast/retry-go/v4 v4.6.1 // indirect
4747
github.com/beorn7/perks v1.0.1 // indirect
4848
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
@@ -56,6 +56,7 @@ require (
5656
github.com/distribution/distribution/v3 v3.0.0 // indirect
5757
github.com/distribution/reference v0.6.0 // indirect
5858
github.com/docker/go-metrics v0.0.1 // indirect
59+
github.com/dragonflyoss/model-spec v0.0.6 // indirect
5960
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
6061
github.com/emirpasic/gods v1.18.1 // indirect
6162
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
@@ -81,7 +82,7 @@ require (
8182
github.com/json-iterator/go v1.1.12 // indirect
8283
github.com/kevinburke/ssh_config v1.2.0 // indirect
8384
github.com/klauspost/compress v1.18.0 // indirect
84-
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
85+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
8586
github.com/labstack/gommon v0.4.2 // indirect
8687
github.com/libgit2/git2go/v34 v34.0.0 // indirect
8788
github.com/mailru/easyjson v0.7.7 // indirect
@@ -125,14 +126,14 @@ require (
125126
go.opentelemetry.io/otel/sdk/log v0.13.0 // indirect
126127
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
127128
go.opentelemetry.io/proto/otlp v1.6.0 // indirect
128-
golang.org/x/crypto v0.39.0 // indirect
129-
golang.org/x/oauth2 v0.28.0 // indirect
130-
golang.org/x/sys v0.33.0 // indirect
131-
golang.org/x/term v0.32.0 // indirect
132-
golang.org/x/text v0.26.0 // indirect
129+
golang.org/x/crypto v0.41.0 // indirect
130+
golang.org/x/oauth2 v0.30.0 // indirect
131+
golang.org/x/sys v0.35.0 // indirect
132+
golang.org/x/term v0.34.0 // indirect
133+
golang.org/x/text v0.28.0 // indirect
133134
golang.org/x/time v0.8.0 // indirect
134-
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2 // indirect
135-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect
135+
google.golang.org/genproto/googleapis/api v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
136+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
136137
google.golang.org/protobuf v1.36.6 // indirect
137138
gopkg.in/inf.v0 v0.9.1 // indirect
138139
gopkg.in/warnings.v0 v0.1.2 // indirect

0 commit comments

Comments
 (0)