2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 SUSE, Mirantis Inc., Enea Software 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 ##############################################################################
13 #----------------------------------------------------------------------
14 # This script is used by CI and executed by Jenkins jobs.
15 # You are not supposed to use this script manually if you don't know
17 #----------------------------------------------------------------------
19 # This function allows developers to specify the impacted scenario by
20 # requesting a RE-check via a gerrit change comment under a specific format.
22 # Patterns to be searched in change comment:
23 # recheck: <scenario-name>
24 # reverify: <scenario-name>
26 # recheck: os-odl-ovs-noha
27 # reverify: os-nosdn-nofeature-ha
29 function set_scenario() {
30 # process gerrit event comment text (if present)
31 DEPLOY_SCENARIO=$(echo "${GERRIT_EVENT_COMMENT_TEXT}" | \
32 grep -Po '(?!:(recheck|reverify):\s*)([-\w]+ha)')
33 if [ -z "${DEPLOY_SCENARIO}" ]; then
34 if [[ "$JOB_NAME" =~ baremetal ]]; then
35 DEPLOY_SCENARIO='os-nosdn-nofeature-ha'
37 DEPLOY_SCENARIO='os-nosdn-nofeature-noha'
40 # save the scenario names into java properties file
41 # so they can be injected to downstream jobs via envInject
42 echo "Recording the scenario '${DEPLOY_SCENARIO}' for downstream jobs"
43 echo "DEPLOY_SCENARIO=${DEPLOY_SCENARIO}" > "$WORK_DIRECTORY/scenario.properties"
46 # ensure GERRIT vars are set
47 [ -n "${GERRIT_CHANGE_NUMBER}" ] || exit 1
48 GERRIT_EVENT_COMMENT_TEXT="${GERRIT_EVENT_COMMENT_TEXT:-''}"
50 # this directory is where the temporary properties file will be stored
51 WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER
52 /bin/rm -rf "$WORK_DIRECTORY" && mkdir -p "$WORK_DIRECTORY"