Merge pull request #151 from andyzhangx/verify-helm-chart-files

test: add verify-helm-chart-files.sh script
This commit is contained in:
Andy Zhang 2021-02-05 22:28:04 +08:00 committed by GitHub
commit 87e6ba8084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 39 deletions

View File

@ -1,22 +1,22 @@
apiVersion: v1
entries:
csi-driver-nfs:
- apiVersion: v1
appVersion: v2.0.0
created: "2020-11-13T16:06:53.1675609+05:30"
description: CSI NFS Driver for Kubernetes
digest: 0a2a89ad91485b277e53bdf41a58c07dbc0f8910cb63494411e46bf17c4a7196
name: csi-driver-nfs
urls:
- https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts/v2.0.0/csi-driver-nfs-v2.0.0.tgz
version: v2.0.0
- apiVersion: v1
appVersion: latest
created: "2020-11-13T16:06:53.1671254+05:30"
created: 2021-02-05T13:28:16.728034918Z
description: CSI NFS Driver for Kubernetes
digest: 0e85c143ff5bc783089d2439e6b533949916657d50e9267d10b8add3dff027eb
digest: aa12e668649d4f9fc979389618992c1195847feff048dab0f2413ef02fbcc837
name: csi-driver-nfs
urls:
- https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts/latest/csi-driver-nfs-v3.0.0.tgz
version: v3.0.0
generated: "2020-11-13T16:06:53.1665574+05:30"
- apiVersion: v1
appVersion: v2.0.0
created: 2021-02-05T13:28:16.728270519Z
description: CSI NFS Driver for Kubernetes
digest: f537a133eaa965f1c053ffac130f82c9b2b624e1f8bd42937c9c48818464eaac
name: csi-driver-nfs
urls:
- https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/charts/v2.0.0/csi-driver-nfs-v2.0.0.tgz
version: v2.0.0
generated: 2021-02-05T13:28:16.727677516Z

View File

@ -24,5 +24,6 @@ ${PKG_ROOT}/hack/verify-golint.sh
${PKG_ROOT}/hack/verify-yamllint.sh
${PKG_ROOT}/hack/verify-boilerplate.sh
${PKG_ROOT}/hack/verify-spelling.sh
${PKG_ROOT}/hack/verify-helm-chart-files.sh
${PKG_ROOT}/hack/verify-helm-chart.sh
${PKG_ROOT}/hack/verify-gomod.sh

48
hack/verify-helm-chart-files.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# Copyright 2021 The Kubernetes 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.
set -euo pipefail
echo "begin to verify chart tgz files ..."
# verify whether chart config has changed
diff=`git diff`
if [[ -n "${diff}" ]]; then
echo "${diff}"
exit 1
fi
for dir in charts/*
do
if [ -d $dir ]; then
if [ -f $dir/*.tgz ]; then
echo "verify $dir ..."
tar -xvf $dir/*.tgz -C $dir/
fi
fi
done
diff=`git diff`
if [[ -n "${diff}" ]]; then
echo
echo
echo "${diff}"
echo
echo "latest chart config has changed, pls run \"helm package charts/latest/csi-driver-nfs -d charts/latest/\" to update tgz file"
exit 1
fi
echo "chart tgz files verified."

View File

@ -78,30 +78,3 @@ validate_image "${expected_node_driver_registrar}" "${node_driver_registrar}"
validate_image "${expected_nfs_image}" "${nfs_image}"
echo "Images in deploy/ matches those in the latest helm chart."
# verify whether chart config has changed
diff=`git diff`
if [[ -n "${diff}" ]]; then
echo "${diff}"
exit 1
fi
for dir in charts/*
do
if [ -d $dir ]; then
if [ -f $dir/*.tgz ]; then
echo "verify $dir ..."
tar -xvf $dir/*.tgz -C $dir/
fi
fi
done
diff=`git diff`
if [[ -n "${diff}" ]]; then
echo "${diff}"
echo
echo "latest chart config has changed, pls run \"helm package charts/latest/csi-driver-nfs -d charts/latest/\" to update tgz file"
exit 1
fi
echo "chart tgz files verified."