1
1
#! /bin/bash
2
2
3
3
KUBEVIRT_TEMPLATE_DIR=" ${1:- $(dirname " ${BASH_SOURCE} " )} "
4
+ CDI_TEMPLATE_DIR=" ${KUBEVIRT_TEMPLATE_DIR} /cdi"
4
5
5
6
echo " Download release templates from KubeVirt"
6
7
vm_template_url=" https://raw.githubusercontent.com/kubevirt/kubevirt"
7
8
manifest_url=" https://github.com/kubevirt/kubevirt/releases/download"
8
-
9
+ cdi_manifest_url= " https://github.com/kubevirt/containerized-data-importer/releases/download "
9
10
10
11
if [ -z " ${version} " ]; then
11
12
version=$( git ls-remote --tags https://github.com/kubevirt/kubevirt | sed ' s/.*refs\/tags\///g' | grep -v ' \^{}' )
@@ -36,3 +37,24 @@ for item in ${version}; do
36
37
wget -O " ${KUBEVIRT_TEMPLATE_DIR} /${item} /kubevirt.yaml" " ${manifest_url} /${item} /kubevirt.yaml"
37
38
echo " Download for ${item} complete"
38
39
done
40
+
41
+ if [ -z " ${cdi_version} " ]; then
42
+ cdi_version=$( git ls-remote --tags https://github.com/kubevirt/containerized-data-importer | sed ' s/.*refs\/tags\///g' | grep -v ' \^{}' )
43
+ fi
44
+
45
+ for item in ${cdi_version} ; do
46
+ echo ${item}
47
+ echo " Downloading template for ${item} "
48
+ if [ ! -d " ${item} " ]; then
49
+ mkdir " ${CDI_TEMPLATE_DIR} /${item} "
50
+ fi
51
+ major=` echo ${item} | cut -dv -f2 | cut -d. -f1`
52
+ minor=` echo ${item} | cut -dv -f2 | cut -d. -f2`
53
+ patch=` echo ${item} | cut -dv -f2 | cut -d. -f3`
54
+ if [ " $major " -ge " 1" ] && [ " $minor " -ge 2 ]; then
55
+ # We support j2 template since v1.2.0
56
+ wget -O " ${CDI_TEMPLATE_DIR} /${item} /cdi-controller.yaml.j2" " ${cdi_manifest_url} /${item} /cdi-controller.yaml.j2"
57
+ fi
58
+ wget -O " ${CDI_TEMPLATE_DIR} /${item} /cdi-controller.yaml" " ${cdi_manifest_url} /${item} /cdi-controller.yaml"
59
+ echo " Download for ${item} complete"
60
+ done
0 commit comments