Skip to content

Commit 82b5bf0

Browse files
authored
Merge pull request #760 from umagnus/helm_repo_test
feat: add helm repo install check
2 parents fb22031 + e9edc7b commit 82b5bf0

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

hack/verify-all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ ${PKG_ROOT}/hack/verify-yamllint.sh
2525
${PKG_ROOT}/hack/verify-boilerplate.sh
2626
${PKG_ROOT}/hack/verify-helm-chart-files.sh
2727
${PKG_ROOT}/hack/verify-helm-chart.sh
28+
${PKG_ROOT}/hack/verify-helm-chart-index.sh

hack/verify-helm-chart-index.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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 "Error: $1 is fail."
29+
echo "Error: wrong pkg in "${PKG_ROOT}${url#*master}
30+
exit 1
31+
fi
32+
}
33+
34+
function check_yaml() {
35+
grep http $INDEX | while read LINE
36+
do
37+
url=$(echo "$LINE" | awk -F " " '{print $2}')
38+
check_url $url
39+
done
40+
}
41+
42+
echo "begin to verify helm chart index ..."
43+
check_yaml
44+
echo "all url in helm chart index have been checked"

0 commit comments

Comments
 (0)