Skip to content

Commit 5e3a4ea

Browse files
authored
Merge pull request kubernetes-csi#1085 from bells17/ensure-vendor-checks-for-all-modules
Ensure vendor checks are run for all modules
2 parents 1c84a82 + 5e6eb91 commit 5e3a4ea

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@
1717
CMDS=snapshot-controller csi-snapshotter snapshot-validation-webhook
1818
all: build
1919
include release-tools/build.make
20+
21+
# The test-vendor-client target performs vendor checks in both
22+
# the external-snapshotter module and the client module.
23+
# This target has been added for the following reasons:
24+
# 1. The test-vendor target does not perform vendor checks for the client module.
25+
# 2. The test-vendor target cannot detect if vendor updates have been made in
26+
# the external-snapshotter module when changes are made in the client module.
27+
.PHONY: test-vendor-client
28+
test: test-vendor-client
29+
test-vendor-client:
30+
@ echo; echo "### $@:"
31+
@ cd client && ../release-tools/verify-vendor.sh
32+
@ hack/verify-vendor.sh

client/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/kubernetes-csi/external-snapshotter/client/v7
22

33
go 1.22.0
44

5-
toolchain go1.22.2
5+
toolchain go1.22.3
66

77
require (
88
k8s.io/api v0.30.0

hack/verify-vendor.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2024 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# This script is based on the following script:
18+
# release-tools/verify-vendor.sh
19+
20+
if ! (set -x; env GO111MODULE=on go mod tidy); then
21+
echo "ERROR: vendor check failed."
22+
exit 1
23+
elif [ "$(git status --porcelain -- go.mod go.sum | wc -l)" -gt 0 ]; then
24+
echo "ERROR: go module files *not* up-to-date, they did get modified by 'GO111MODULE=on go mod tidy':";
25+
git diff --color=always -- go.mod go.sum | cat
26+
exit 1
27+
else
28+
if ! (set -x; env GO111MODULE=on go mod vendor); then
29+
echo "ERROR: vendor check failed."
30+
exit 1
31+
elif [ "$(git status --porcelain -- vendor | wc -l)" -gt 0 ]; then
32+
echo "ERROR: vendor directory *not* up-to-date, it did get modified by 'GO111MODULE=on go mod vendor':"
33+
git status -- vendor
34+
git diff --color=always -- vendor | cat
35+
exit 1
36+
else
37+
echo "Go dependencies and vendor directory up-to-date."
38+
fi
39+
fi

0 commit comments

Comments
 (0)