Skip to content

Commit a06ecf3

Browse files
committed
fix kustomize install
Signed-off-by: Ashutosh Kumar <sonasingh46@gmail.com>
1 parent 078b71b commit a06ecf3

2 files changed

Lines changed: 52 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ jobs:
7575
7676
- name: Configure Kustomize
7777
run: |
78-
curl -s "https://raw.githubusercontent.com/\
79-
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
80-
echo "Kustomize Version"
78+
chmod +x hack/install_kustomize.sh
79+
./hack/install_kustomize.sh /usr/local/bin/
8180
kustomize version
8281
8382

hack/install_kustomize.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# Downloads the most recently released kustomize binary
4+
# to your current working directory.
5+
#
6+
# Fails if the file already exists.
7+
8+
where=$1
9+
if [ -f $where/kustomize ]; then
10+
echo "A file named kustomize already exists (remove it first)."
11+
exit 1
12+
fi
13+
14+
tmpDir=`mktemp -d`
15+
if [[ ! "$tmpDir" || ! -d "$tmpDir" ]]; then
16+
echo "Could not create temp dir."
17+
exit 1
18+
fi
19+
20+
function cleanup {
21+
rm -rf "$tmpDir"
22+
}
23+
24+
trap cleanup EXIT
25+
26+
pushd $tmpDir >& /dev/null
27+
28+
opsys=windows
29+
if [[ "$OSTYPE" == linux* ]]; then
30+
opsys=linux
31+
elif [[ "$OSTYPE" == darwin* ]]; then
32+
opsys=darwin
33+
fi
34+
35+
echo "Downloading kustomize..."
36+
37+
curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases |\
38+
grep browser_download |\
39+
grep $opsys |\
40+
cut -d '"' -f 4 |\
41+
grep /kustomize/v |\
42+
sort | tail -n 1 |\
43+
xargs curl -s -O -L
44+
45+
tar xzf ./kustomize_v*_${opsys}_amd64.tar.gz
46+
47+
sudo cp ./kustomize $where
48+
49+
popd >& /dev/null
50+
echo kustomize installed to $where

0 commit comments

Comments
 (0)