From: Yolanda Robla Date: Wed, 20 Nov 2019 12:38:47 +0000 (+0100) Subject: Add new script for adding baremetal to CI X-Git-Tag: akraino_r2~8 X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=commitdiff_plain;h=49e90ad59f7df6c0841113d8801492c40544a184;p=kni%2Finstaller.git Add new script for adding baremetal to CI Signed-off-by: Yolanda Robla Change-Id: I88595855023af9bfa7a10522c50d1e0a2b4b078a --- diff --git a/ci/kni_deploy_baremetal.sh b/ci/kni_deploy_baremetal.sh new file mode 100644 index 0000000..ed3d7ce --- /dev/null +++ b/ci/kni_deploy_baremetal.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# Copyright (c) 2019 Red Hat +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e -u -x -o pipefail + +SITE_NAME="testing.baremetal.edge-sites.net" +MATCHBOX_ENDPOINT="http://172.22.0.1:8080" + +rm -rf $HOME/.kni/$SITE_NAME +pushd $HOME/go/src/gerrit.akraino.org/kni/installer +./knictl fetch_requirements file://${WORKSPACE}/$SITE_NAME +./knictl prepare_manifests $SITE_NAME +popd + +pushd $HOME/go/src/gerrit.akraino.org/kni/installer +./knictl deploy_masters $SITE_NAME +$HOME/.kni/$SITE_NAME/requirements/openshift-install wait-for bootstrap-complete --dir $HOME/.kni/$SITE_NAME/baremetal_automation/ocp/ +popd + +pushd $HOME/.kni/$SITE_NAME/baremetal_automation/kickstart +bash add_kickstart_for_centos.sh +cp centos-worker-kickstart.cfg $HOME/.kni/$SITE_NAME/baremetal_automation/matchbox-data/var/lib/matchbox/assets +popd + +mount -o loop /opt/images/CentOS-7-x86_64-DVD-1810.iso /mnt/ +cp -ar /mnt/. $HOME/.kni/$SITE_NAME/baremetal_automation/matchbox-data/var/lib/matchbox/assets/centos7/ +chmod -R 755 $HOME/.kni/$SITE_NAME/baremetal_automation/matchbox-data/var/lib/matchbox/assets/centos7/ +umount /mnt + +# replace the settings_upi.env settings +sed -i "s#export KUBECONFIG_PATH=.*#export KUBECONFIG_PATH=$HOME/.kni/$SITE_NAME/baremetal_automation/ocp/auth/kubeconfig#g" /root/settings_upi.env +sed -i "s#export OS_INSTALL_ENDPOINT=.*#export OS_INSTALL_ENDPOINT=$MATCHBOX_ENDPOINT/assets/centos7#g" /root/settings_upi.env + +pushd $HOME/go/src/gerrit.akraino.org/kni/installer +./knictl deploy_workers $SITE_NAME + +# just sleep for some time, and workers should be up +sleep 20m +popd + +echo "Cluster successfully deployed! Start applying workloads" + +rm -rf $HOME/.kni/$SITE_NAME/baremetal_automation/build/openshift-patches/99-ifcfg-*.yaml + +pushd $HOME/go/src/gerrit.akraino.org/kni/installer +./knictl apply_workloads $SITE_NAME --kubeconfig $HOME/.kni/$SITE_NAME/baremetal_automation/ocp/auth/kubeconfig + +STATUS=$? +popd + +if [ $STATUS -ne 0 ]; then + echo "Error applying workloads to baremetal" + exit 1 +fi + +# now destroy the cluster +pushd $HOME/go/src/gerrit.akraino.org/kni/installer +./knictl destroy_cluster $SITE_NAME +popd