X-Git-Url: https://gerrit.nordix.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=jjb%2Fcloud-infra%2Fscripts%2Fspinnaker-deploy.sh;fp=jjb%2Fcloud-infra%2Fscripts%2Fspinnaker-deploy.sh;h=bef1b12a9d0f209cdf1f40f0a73bc4297a1f4542;hb=a577ca9dd6c15baa64f7bc06d4414eaa3fca93b3;hp=0000000000000000000000000000000000000000;hpb=10f2224e6816d765aa7d0ab1f7acc457f92100ba;p=infra%2Fcicd.git diff --git a/jjb/cloud-infra/scripts/spinnaker-deploy.sh b/jjb/cloud-infra/scripts/spinnaker-deploy.sh new file mode 100644 index 00000000..bef1b12a --- /dev/null +++ b/jjb/cloud-infra/scripts/spinnaker-deploy.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +# ============LICENSE_START======================================================= +# Copyright (C) 2019 The Nordix Foundation. All rights reserved. +# ================================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +set -o errexit +set -o nounset + +cd $WORKSPACE +/bin/rm -f ../inventory.ini +echo "Info: Preparing for Spinnaker deployment" + +# checkout given engine version +if [[ "$ENGINE_VERSION" != "master" ]]; then + echo "Warning: Checking out $ENGINE_VERSION" + git checkout -q $ENGINE_VERSION +fi + +# checkout given engine refspec +if [[ "$ENGINE_REFSPEC" != "master" ]]; then + echo "Warning: Checking out engine $ENGINE_REFSPEC" + echo "-------------------------------------------------------------------------" + git fetch https://gerrit.nordix.org/infra/engine $ENGINE_REFSPEC && git checkout -q FETCH_HEAD + echo "-------------------------------------------------------------------------" +fi + +# update scenario version and refspec in engine/envine/var/sdf.yml +if [[ "$DEPLOY_SCENARIO_VERSION" != "master" && "$DEPLOY_SCENARIO_REFSPEC" != "master" ]]; then + echo "Warning: Adding $DEPLOY_SCENARIO_VERSION as scenario version and $DEPLOY_SCENARIO_REFSPEC as scenario refspec" +cat << EOF > $WORKSPACE/engine/var/sdf.yml +scenario: + $DEPLOY_SCENARIO: + scm: git + src: https://gerrit.nordix.org/infra/swconfig.git + version: $DEPLOY_SCENARIO_VERSION + refspec: $DEPLOY_SCENARIO_REFSPEC + provisioners: + - $PROVISIONER_TYPE + installers: + $INSTALLER_TYPE: + role: scenarios/$DEPLOY_SCENARIO/$INSTALLER_TYPE/role/$DEPLOY_SCENARIO + distros: + - $DISTRO +EOF + + echo "Info: Temporary SDF content" + echo "-------------------------------------------------------------------------" + cat $WORKSPACE/engine/var/sdf.yml + echo "-------------------------------------------------------------------------" +fi + +echo "Info: Starting K8S cluster creation and Spinnaker deployment" +echo "-------------------------------------------------------------------------" +cd $WORKSPACE +./engine/deploy.sh -c -r $PROVISIONER_TYPE -u /tmp/openrc \ + -s $DEPLOY_SCENARIO -e $HEAT_ENVIRONMENT_FILE + +cd $WORKSPACE +/bin/cp $WORKSPACE/.cache/config/inventory.ini ../inventory.ini + +# vim: set ts=2 sw=2 expandtab: