diff options
author | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2016-01-09 16:01:50 +0100 |
---|---|---|
committer | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2016-01-12 17:58:00 +0000 |
commit | 9e3ac0eac66bc1d323b430c06ede76592aadcc58 (patch) | |
tree | 1fbd5b8cd0eba539d41e486d444eedf79b8e4734 /ci | |
parent | cefa3fdadc8c1bd6d8b92c5976f76dbbebc87992 (diff) |
Small fixes to the deployment scenario framework:
- Added deploy.sh -d option for dryrun. With -d + all the other mandatory
arguments, deploy.sh produces ci/config/dea.yaml and /ci/config/dha.yaml
with out actually deploying the stack.
- Bugfix to exit with rc <> 0 if deployment fails.
- Don't delete the programatically constructed dea.yaml or dha.yaml
under fuel/ci/config after deploy has finished.
dea.yaml and dha.yaml are needed functest, therefore these files
must not be deleted after deployment has finished. They will reside
in fuel/ci/config/.
- Dont merge the dha-override section in deployment scenarios with the final
dha.yaml unless the deployment is virtual. There is no way you can
programatically override physicall resources, wireing, ipmi set-up, etc. -
while you can for virtual environments.
VERIFIED
READY TO MERGE
Change-Id: If4dedc472e07ed60071ee34c73db29f3b9c45252
Signed-off-by: Jonas Bjurel <jonas.bjurel@ericsson.com>
(cherry picked from commit c6a9f766792032a4cc84bc801e15b05a29f09e8e)
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/deploy.sh | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/ci/deploy.sh b/ci/deploy.sh index d1f411fa5..539cbc833 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e ############################################################################## # Copyright (c) 2015 Ericsson AB and others. # jonas.bjurel@ericsson.com @@ -34,6 +35,8 @@ usage: `basename $0` -b base-uri -l lab-name -p pod-name -i iso OPTIONS: -b Base-uri for the stack-configuration structure + -d Dry-run + -l Lab-name -p Pod-name -s Deploy-scenario short-name/base-file-name @@ -48,6 +51,8 @@ and provides a fairly simple mechanism to execute a deployment. Input parameters to the build script is: -b Base URI to the configuration directory (needs to be provided in a URI style, it can be a local resource: file:// or a remote resource http(s)://) +-d Dry-run - - Produces deploy config files (config/dea.yaml and + config/dha.yaml), but does not execute deploy -l Lab name as defined in the configuration directory, e.g. lf -p POD name as defined in the configuration directory, e.g. pod-1 -s Deployment-scenario, this points to a deployment/test scenario file as @@ -60,6 +65,7 @@ Input parameters to the build script is: NOTE: Root priviledges are needed for this script to run + Examples: sudo `basename $0` -b file:///home/jenkins/lab-config -l lf -p pod1 -s ha_odl-l3_heat_ceilometer -i file:///home/jenkins/myiso.iso EOF @@ -74,9 +80,7 @@ EOF # clean() { echo "Cleaning up deploy tmp directories" - rm -rf ${SCRIPT_PATH}/config rm -rf ${SCRIPT_PATH}/ISO - rm -rf ${SCRIPT_PATH}/releng } # # END of deployment clean-up @@ -87,7 +91,7 @@ clean() { # SCRIPT_PATH=$(readlink -f $(dirname ${BASH_SOURCE[0]})) DEPLOY_DIR=$(cd ${SCRIPT_PATH}/../deploy; pwd) -RELENG_REPO=https://jonasbjurel@gerrit.opnfv.org/gerrit/releng +DRY_RUN=0 # # END of variables to customize ############################################################################ @@ -95,12 +99,15 @@ RELENG_REPO=https://jonasbjurel@gerrit.opnfv.org/gerrit/releng ############################################################################ # BEGIN of main # -while getopts "b:l:p:s:i:h" OPTION +while getopts "b:dl:p:s:i:h" OPTION do case $OPTION in b) BASE_CONFIG_URI=${OPTARG} ;; + d) + DRY_RUN=1 + ;; l) TARGET_LAB=${OPTARG} ;; @@ -146,9 +153,11 @@ if [ -z $BASE_CONFIG_URI ] || [ -z $TARGET_LAB ] || \ fi # Enable the automatic exit trap -set -o errexit trap do_exit SIGINT SIGTERM EXIT +# Set no restrictive umask so that Jenkins can removeeee any residuals +umask 0000 + clean pushd ${DEPLOY_DIR} > /dev/null @@ -157,24 +166,24 @@ pushd ${DEPLOY_DIR} > /dev/null echo "python deploy-config.py -dha ${BASE_CONFIG_URI}/labs/${TARGET_LAB}/${TARGET_POD}/fuel/config/dha.yaml -deab ${DEPLOY_DIR}/config/dea_base.yaml -deao ${BASE_CONFIG_URI}/labs/${TARGET_LAB}/${TARGET_POD}/fuel/config/dea-pod-override.yaml -scenario-base-uri ${DEPLOY_DIR}/scenario -scenario ${DEPLOY_SCENARIO} -plugins ${DEPLOY_DIR}/config/plugins -output ${SCRIPT_PATH}/config" + python deploy-config.py -dha ${BASE_CONFIG_URI}/labs/${TARGET_LAB}/${TARGET_POD}/fuel/config/dha.yaml -deab file://${DEPLOY_DIR}/config/dea_base.yaml -deao ${BASE_CONFIG_URI}/labs/${TARGET_LAB}/${TARGET_POD}/fuel/config/dea-pod-override.yaml -scenario-base-uri file://${DEPLOY_DIR}/scenario -scenario ${DEPLOY_SCENARIO} -plugins file://${DEPLOY_DIR}/config/plugins -output ${SCRIPT_PATH}/config -# Download iso if it doesn't already exists locally -if [[ $ISO == file://* ]]; then - ISO=${ISO#file://} -else - mkdir -p ${SCRIPT_PATH}/ISO - curl -o ${SCRIPT_PATH}/ISO/image.iso $ISO - ISO=${SCRIPT_PATH}/ISO/image.iso +if [ $DRY_RUN -eq 0 ]; then + # Download iso if it doesn't already exists locally + if [[ $ISO == file://* ]]; then + ISO=${ISO#file://} + else + mkdir -p ${SCRIPT_PATH}/ISO + curl -o ${SCRIPT_PATH}/ISO/image.iso $ISO + ISO=${SCRIPT_PATH}/ISO/image.iso + fi + # Start deployment + echo "python deploy.py -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO" + python deploy.py -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO fi -# Start deployment -echo "python deploy.py -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO" -python deploy.py -dea ${SCRIPT_PATH}/config/dea.yaml -dha ${SCRIPT_PATH}/config/dha.yaml -iso $ISO popd > /dev/null -# TBD: Upload the test-section of the scenario yaml file to the fuel master: -# var/www/test.yaml - # # END of main ############################################################################ |