Skip to content

Commit 1e0288e

Browse files
committed
test: add helm repo install check
chmod fix chart check
1 parent ffdbd3e commit 1e0288e

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

hack/verify-all.sh

+1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ ${PKG_ROOT}/hack/verify-yamllint.sh
2424
${PKG_ROOT}/hack/verify-boilerplate.sh
2525
${PKG_ROOT}/hack/verify-helm-chart-files.sh
2626
${PKG_ROOT}/hack/verify-helm-chart.sh
27+
${PKG_ROOT}/hack/verify-helm-chart-index.sh
2728
${PKG_ROOT}/hack/verify-gomod.sh

hack/verify-helm-chart-index.sh

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
# Copyright 2020 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+
set -euo pipefail
18+
19+
readonly PKG_ROOT="$(git rev-parse --show-toplevel)"
20+
21+
INDEX=${PKG_ROOT}/charts/index.yaml
22+
23+
function check_url() {
24+
url=$1
25+
result=$(curl -I -m 5 -s -w "%{http_code}\n" -o /dev/null $1)
26+
if [ $result -ne 200 ]
27+
then
28+
echo "warning: $1 is invalid"
29+
local=${PKG_ROOT}${url#*master}
30+
echo "check whether $local exists"
31+
if [ -f "$local" ]
32+
then
33+
echo "$local exists"
34+
else
35+
echo "$local does not exist"
36+
exit 1
37+
fi
38+
fi
39+
}
40+
41+
function check_yaml() {
42+
grep http $INDEX | while read LINE
43+
do
44+
url=$(echo "$LINE" | awk -F " " '{print $2}')
45+
check_url $url
46+
done
47+
}
48+
49+
echo "begin to verify all URLs in $INDEX ..."
50+
check_yaml
51+
echo "all URLs in $INDEX are valid"

0 commit comments

Comments
 (0)