forked from lilyLuLiu/crc-trigger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload-bundle-s3.sh
More file actions
executable file
·54 lines (45 loc) · 1.45 KB
/
upload-bundle-s3.sh
File metadata and controls
executable file
·54 lines (45 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
if [ $# == 0 ] ; then
echo "USAGE: \$1 The bundle Version"
exit 1;
fi
function verify_bundle_exist() {
check_address=${1}/sha256sum.txt
#echo "verify existing of $check_address"
valid_code=$(curl -s -fI -o /dev/null -w "%{http_code}" $check_address)
#echo $valid_code
if [ $valid_code != 200 ]; then
echo "The url of $check_address not accessible"
return 1
fi
return 0
}
if [ -d "test" ];then
rm -r test
fi
mkdir test
bundle_version=$1
presets=(openshift microshift)
for i in ${presets[@]}; do
echo "creating yaml file for $i $bundle_version upload "
file="test/upload-bundle-$i.yaml"
cp -r template/upload-bundle-template.yaml $file
bundleUrl="https://cdk-builds.usersys.redhat.com/builds/crc/bundles/$i/${bundle_version}"
if [ $i == "openshift" ]; then
bundlename="crc_libvirt_${bundle_version}_arm64.crcbundle"
else
bundlename="crc_microshift_libvirt_${bundle_version}_arm64.crcbundle"
fi
echo "$bundleUrl/$bundlename"
if ! verify_bundle_exist "$bundleUrl"; then
echo "The bundle $bundleUrl/$bundlename do not exist, so it will be removed"
rm $file
continue
fi
sed -i'' -e "s#<Bundle_url>#$bundleUrl#g" $file
sed -i'' -e "s#<Preset>#$i#g" $file
sed -i'' -e "s#<Bundle_version>#${bundle_version}#g" $file
sed -i'' -e "s#<Bundle_name>#${bundlename}#g" $file
done
oc project | grep "devtoolsqe--pipeline"
oc create -f test