2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Ericsson AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
14 trap cleanup_and_upload EXIT
16 function fix_ownership() {
17 if [ -z "${JOB_URL+x}" ]; then
18 echo "Not running as part of Jenkins. Handle the logs manually."
20 # Make sure cache exists
21 [[ ! -d ${HOME}/.cache ]] && mkdir ${HOME}/.cache
23 sudo chown -R jenkins:jenkins $WORKSPACE
24 sudo chown -R jenkins:jenkins ${HOME}/.cache
28 function cleanup_and_upload() {
34 # check distro to see if we support it
35 if [[ ! "$DISTRO" =~ (xenial|centos7|suse) ]]; then
36 echo "Distro $DISTRO is not supported!"
40 # remove previously cloned repos
41 sudo /bin/rm -rf /opt/openstack-ansible /opt/stack /opt/releng /opt/functest
46 # openstack-ansible enables strict host key checking by default
47 export ANSIBLE_HOST_KEY_CHECKING=False
55 # ensure the branches to use are set
56 export OPNFV_BRANCH=${OPNFV_BRANCH:-master}
57 export OPENSTACK_BRANCH=${OPENSTACK_BRANCH:-master}
60 sudo git clone -b $OPNFV_BRANCH https://gerrit.opnfv.org/gerrit/releng /opt/releng
62 # this script will be reused for promoting openstack-ansible versions and using
63 # promoted openstack-ansible versions as part of xci daily.
64 USE_PROMOTED_VERSIONS=${USE_PROMOTED_VERSIONS:-false}
65 if [ $USE_PROMOTED_VERSIONS = "true" ]; then
66 echo "TBD: Will use the promoted versions of openstack/opnfv projects"
69 cd /opt/releng/prototypes/openstack-ansible/scripts
70 sudo -E ./osa-deploy.sh