summaryrefslogtreecommitdiff
path: root/build/tools
diff options
context:
space:
mode:
authorJan Unterbrink <jan.unterbrink@subpath.de>2019-08-11 10:40:39 +0200
committerJan Unterbrink <jan.unterbrink@subpath.de>2019-08-15 21:00:22 +0200
commit3ec7dff49baf47ab1ebc0e58389d82a923220133 (patch)
tree53714ee93ed29594e9709047da60aa7da2f60851 /build/tools
parentMerge pull request #1011 from ziyi-yan/fix-edge-data-race (diff)
downloadkubeedge-3ec7dff49baf47ab1ebc0e58389d82a923220133.tar.gz
Add gomod verify scripts
adding verfify vendor script check if dependencies have been patched
Diffstat (limited to 'build/tools')
-rw-r--r--build/tools/verifyVendor.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/build/tools/verifyVendor.sh b/build/tools/verifyVendor.sh
new file mode 100644
index 000000000..371a5a819
--- /dev/null
+++ b/build/tools/verifyVendor.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+###
+#Copyright 2019 The KubeEdge Authors.
+#
+#Licensed under the Apache License, Version 2.0 (the "License");
+#you may not use this file except in compliance with the License.
+#You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing, software
+#distributed under the License is distributed on an "AS IS" BASIS,
+#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#See the License for the specific language governing permissions and
+#limitations under the License.
+###
+
+
+function checkModified {
+ modified=$( git status --short 2>/dev/null | grep -e "^.M" | wc -l)
+
+ if [ ${modified} -eq 0 ]; then
+ echo 0
+ return
+ fi
+
+ echo 2
+}
+
+go mod vendor
+ret=$(checkModified)
+if [ ${ret} -eq 0 ]; then
+ echo "SUCCESS: vendor is up to date"
+else
+ echo "FAILED: vendor needs an update; The diff is:"
+ git diff
+ exit 1
+fi
+
+go mod tidy
+ret=$(checkModified)
+if [ ${ret} -eq 0 ]; then
+ echo "SUCCESS: go.mod and go.sum are in tiny"
+else
+ echo "FAILED: go.mod / go.dum needs an update; The diff is:"
+ git diff
+ exit 1
+fi