22396e5b9d1a4b4cf79b2b034e6a81ab4e7b056a
[ci-management.git] / jjb / shell / kni_deploy_libvirt.sh
1 #!/bin/bash
2 #
3 # Copyright (c) 2019 Red Hat
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 -e -u -x -o pipefail
18
19 export PATH=$PATH:/usr/local/go/bin:/usr/local/bin
20 KNI_PATH='go/src/gerrit.akraino.org/kni'
21
22 echo '---> Starting kni installer generation'
23
24 mkdir -p $HOME/${KNI_PATH}/installer
25 export GOPATH=${WORKSPACE}
26
27 # do a host preparation and cleanup
28 bash utils/prep_host.sh
29 wget https://raw.githubusercontent.com/openshift/installer/master/scripts/maintenance/virsh-cleanup.sh
30 chmod a+x ./virsh-cleanup.sh
31 sudo bash -c "yes Y | ./virsh-cleanup.sh"
32
33 # first build kni installer
34 make build 2>&1 | tee ${WORKSPACE}/build.log
35
36 # now build the openshift-install binary and copy to gopath
37 make binary 2>&1 | tee ${WORKSPACE}/binary.log
38
39 # then start aws deploy
40 export MASTER_MEMORY_MB=24000
41 export CREDENTIALS=file://$(pwd)/akraino-secrets
42 export BASE_REPO="git::https://gerrit.akraino.org/r/kni/templates"
43 export BASE_PATH="libvirt/3-node"
44 export SITE_REPO="git::https://gerrit.akraino.org/r/kni/templates"
45 export SETTINGS_PATH="libvirt/sample_settings.yaml"
46 export INSTALLER_PATH="file://${HOME}/${KNI_PATH}/installer/bin/openshift-install"
47 make deploy 2>&1 | tee ${WORKSPACE}/libvirt_deploy.log
48 STATUS=$?
49
50 # output tfstate
51 echo "metadata.json for removing cluster"
52 cat $(pwd)/build/metadata.json
53
54 if [ $STATUS -ne 0 ]; then
55     echo "Error deploying in libvirt"
56     exit 1
57 fi
58
59 exit $STATUS