summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xjjb/functest/functest-alpine.sh4
-rw-r--r--jjb/functest/functest-daily-jobs.yml4
-rw-r--r--jjb/functest/functest-docker.yml (renamed from jjb/releng/functest-docker.yml)14
-rw-r--r--jjb/functest/xtesting-docker.yml221
-rw-r--r--jjb/releng/opnfv-docker.yml4
-rw-r--r--jjb/xci/bifrost-verify-jobs.yml7
-rwxr-xr-xjjb/xci/xci-cleanup.sh8
-rw-r--r--jjb/xci/xci-daily-jobs.yml6
-rw-r--r--jjb/xci/xci-merge-jobs.yml10
-rwxr-xr-xjjb/xci/xci-promote.sh3
-rwxr-xr-xjjb/xci/xci-run-functest.sh12
-rwxr-xr-xjjb/xci/xci-set-scenario.sh193
-rwxr-xr-xjjb/xci/xci-start-deployment.sh3
-rwxr-xr-xjjb/xci/xci-start-new-vm.sh3
-rw-r--r--jjb/xci/xci-verify-jobs.yml14
15 files changed, 438 insertions, 68 deletions
diff --git a/jjb/functest/functest-alpine.sh b/jjb/functest/functest-alpine.sh
index 541cc786c..432bbbb8b 100755
--- a/jjb/functest/functest-alpine.sh
+++ b/jjb/functest/functest-alpine.sh
@@ -177,9 +177,9 @@ if [[ ${DEPLOY_SCENARIO} =~ ^os-.* ]]; then
run_tiers ${tiers}
else
if [ ${DEPLOY_TYPE} == 'baremetal' ]; then
- tiers=(healthcheck smoke patrole features vnf parser)
+ tiers=(healthcheck smoke features vnf parser)
else
- tiers=(healthcheck smoke patrole features)
+ tiers=(healthcheck smoke features)
fi
run_tiers ${tiers}
fi
diff --git a/jjb/functest/functest-daily-jobs.yml b/jjb/functest/functest-daily-jobs.yml
index 099d01a59..a58e0bf3f 100644
--- a/jjb/functest/functest-daily-jobs.yml
+++ b/jjb/functest/functest-daily-jobs.yml
@@ -197,9 +197,9 @@
- 'suite':
job-timeout: 60
- 'daily':
- job-timeout: 300
+ job-timeout: 360
- 'arm-daily':
- job-timeout: 300
+ job-timeout: 360
jobs:
- 'functest-{installer}-{pod}-{testsuite}-{stream}'
diff --git a/jjb/releng/functest-docker.yml b/jjb/functest/functest-docker.yml
index 7c576cf00..909c7b079 100644
--- a/jjb/releng/functest-docker.yml
+++ b/jjb/functest/functest-docker.yml
@@ -29,7 +29,6 @@
- 'features'
- 'components'
- 'parser'
- - 'patrole'
- 'smoke'
- 'vnf'
- 'restapi'
@@ -73,7 +72,7 @@
disabled: '{obj:disabled}'
parameters:
- - job-parameters:
+ - functest-job-parameters:
project: '{project}'
branch: '{branch}'
slave_label: 'opnfv-build-ubuntu'
@@ -129,10 +128,6 @@
<<: *build-job-settings
- name: 'functest-parser-docker-build-arm64-{stream}'
<<: *build-job-settings
- - name: 'functest-patrole-docker-build-amd64-{stream}'
- <<: *build-job-settings
- - name: 'functest-patrole-docker-build-arm64-{stream}'
- <<: *build-job-settings
- name: 'functest-smoke-docker-build-amd64-{stream}'
<<: *build-job-settings
- name: 'functest-smoke-docker-build-arm64-{stream}'
@@ -158,8 +153,6 @@
<<: *manifest-job-settings
- name: 'functest-parser-docker-manifest-{stream}'
<<: *manifest-job-settings
- - name: 'functest-patrole-docker-manifest-{stream}'
- <<: *manifest-job-settings
- name: 'functest-smoke-docker-manifest-{stream}'
<<: *manifest-job-settings
- name: 'functest-vnf-docker-manifest-{stream}'
@@ -175,7 +168,7 @@
name: 'functest-{image}-docker-build-{arch_tag}-{stream}'
disabled: '{obj:disabled}'
parameters:
- - job-parameters:
+ - functest-job-parameters:
project: '{project}'
branch: '{branch}'
slave_label: '{slave_label}'
@@ -237,7 +230,7 @@
# parameter macro
- parameter:
- name: job-parameters
+ name: functest-job-parameters
parameters:
- project-parameter:
project: '{project}'
@@ -297,3 +290,4 @@
jalausuch@suse.com morgan.richomme@orange.com
cedric.ollivier@orange.com feng.xiaowei@zte.com.cn
juha.kosonen@nokia.com wangwulin@huawei.com
+ valentin.boucher@kontron.com
diff --git a/jjb/functest/xtesting-docker.yml b/jjb/functest/xtesting-docker.yml
new file mode 100644
index 000000000..dc26344e3
--- /dev/null
+++ b/jjb/functest/xtesting-docker.yml
@@ -0,0 +1,221 @@
+---
+##############################################
+# job configuration for docker build and push
+##############################################
+- project:
+
+ name: xtesting-docker
+
+ project: functest-xtesting
+
+ stream:
+ - master:
+ branch: '{stream}'
+ disabled: false
+
+ arch_tag:
+ - 'amd64':
+ slave_label: 'opnfv-build-ubuntu'
+ - 'arm64':
+ slave_label: 'opnfv-build-ubuntu-arm'
+
+ # settings for jobs run in multijob phases
+ build-job-settings: &build-job-settings
+ current-parameters: false
+ git-revision: true
+ node-parameters: false
+ predefined-parameters: |
+ PUSH_IMAGE=$PUSH_IMAGE
+ COMMIT_ID=$COMMIT_ID
+ GERRIT_REFNAME=$GERRIT_REFNAME
+ DOCKERFILE=$DOCKERFILE
+ kill-phase-on: FAILURE
+ abort-all-jobs: false
+
+ manifest-job-settings: &manifest-job-settings
+ current-parameters: false
+ git-revision: true
+ node-parameters: false
+ predefined-parameters:
+ GERRIT_REFNAME=$GERRIT_REFNAME
+ kill-phase-on: FAILURE
+ abort-all-jobs: false
+
+ # yamllint enable rule:key-duplicates
+ jobs:
+ - "xtesting-docker-{stream}"
+ - "xtesting-docker-build-{arch_tag}-{stream}"
+ - "xtesting-docker-manifest-{stream}"
+
+########################
+# job templates
+########################
+- job-template:
+ name: 'xtesting-docker-{stream}'
+
+ project-type: multijob
+
+ disabled: '{obj:disabled}'
+
+ parameters:
+ - xtesting-job-parameters:
+ project: '{project}'
+ branch: '{branch}'
+ slave_label: 'opnfv-build-ubuntu'
+ arch_tag: 'amd64'
+
+ properties:
+ - throttle:
+ max-per-node: 1
+ option: 'project'
+
+ scm:
+ - git-scm
+
+ triggers:
+ - pollscm:
+ cron: "*/30 * * * *"
+ - gerrit-trigger-tag-created:
+ project: '{project}'
+
+ builders:
+ - multijob:
+ name: 'build xtesting images'
+ execution-type: PARALLEL
+ projects:
+ - name: 'xtesting-docker-build-amd64-{stream}'
+ <<: *build-job-settings
+ - name: 'xtesting-docker-build-arm64-{stream}'
+ <<: *build-job-settings
+ - multijob:
+ name: 'publish xtesting manifests'
+ execution-type: PARALLEL
+ projects:
+ - name: 'xtesting-docker-manifest-{stream}'
+ <<: *manifest-job-settings
+
+ publishers:
+ - 'xtesting-amd64-recipients'
+ - 'xtesting-arm64-recipients'
+
+- job-template:
+ name: 'xtesting-docker-build-{arch_tag}-{stream}'
+ disabled: '{obj:disabled}'
+ parameters:
+ - xtesting-job-parameters:
+ project: '{project}'
+ branch: '{branch}'
+ slave_label: '{slave_label}'
+ arch_tag: '{arch_tag}'
+ scm:
+ - git-scm
+ builders:
+ - shell: |
+ #!/bin/bash -ex
+ sudo arch={arch_tag} bash ./build.sh
+ exit $?
+
+- job-template:
+ name: 'xtesting-docker-manifest-{stream}'
+
+ parameters:
+ - project-parameter:
+ project: '{project}'
+ branch: '{branch}'
+ - label:
+ name: SLAVE_LABEL
+ default: 'opnfv-build-ubuntu'
+ description: 'Slave label on Jenkins'
+ - string:
+ name: PROJECT
+ default: "{project}"
+ description: "Project name used to enable job conditions"
+ - string:
+ name: GIT_BASE
+ default: https://gerrit.opnfv.org/gerrit/$PROJECT
+ description: 'Git URL to use on this Jenkins Slave'
+ - string:
+ name: REPO
+ default: "opnfv"
+ description: "Repository name for functest images"
+
+
+ disabled: '{obj:disabled}'
+
+ builders:
+ - shell: |
+ #!/bin/bash -ex
+ case "{stream}" in
+ "master")
+ tag="latest" ;;
+ *)
+ tag="{stream}" ;;
+ esac
+ sudo manifest-tool push from-args \
+ --platforms linux/amd64,linux/arm64 \
+ --template $REPO/xtesting:ARCH-$tag \
+ --target $REPO/xtesting:$tag
+ exit $?
+
+- parameter:
+ name: xtesting-job-parameters
+ parameters:
+ - project-parameter:
+ project: '{project}'
+ branch: '{branch}'
+ - label:
+ name: SLAVE_LABEL
+ default: '{slave_label}'
+ description: 'Slave label on Jenkins'
+ - string:
+ name: GIT_BASE
+ default: https://gerrit.opnfv.org/gerrit/$PROJECT
+ description: 'Git URL to use on this Jenkins Slave'
+ - string:
+ name: PUSH_IMAGE
+ default: "true"
+ description: "To enable/disable pushing the image to Dockerhub."
+ - string:
+ name: COMMIT_ID
+ default: ""
+ description: "commit id to make a snapshot docker image"
+ - string:
+ name: GERRIT_REFNAME
+ default: ""
+ description: "Docker tag to be built, e.g. refs/tags/5.0.0, refs/tags/opnfv-5.0.0, refs/tags/5.0.RC1"
+ - string:
+ name: DOCKERFILE
+ default: "Dockerfile"
+ description: "Dockerfile to use for creating the image."
+ - string:
+ name: ARCH_TAG
+ default: "{arch_tag}"
+ description: "If set, this value will be added to the docker image tag as a prefix"
+ - string:
+ name: PROJECT
+ default: "{project}"
+ description: "Project name used to enable job conditions"
+ - string:
+ name: REPO
+ default: "opnfv"
+ description: "Repository name for functest images"
+
+# publisher macros
+- publisher:
+ name: 'xtesting-arm64-recipients'
+ publishers:
+ - email:
+ recipients: >
+ cristina.pauna@enea.com
+ alexandru.avadanii@enea.com
+ delia.popescu@enea.com
+
+- publisher:
+ name: 'xtesting-amd64-recipients'
+ publishers:
+ - email:
+ recipients: >
+ jalausuch@suse.com morgan.richomme@orange.com
+ cedric.ollivier@orange.com feng.xiaowei@zte.com.cn
+ juha.kosonen@nokia.com wangwulin@huawei.com
+ valentin.boucher@kontron.com
diff --git a/jjb/releng/opnfv-docker.yml b/jjb/releng/opnfv-docker.yml
index ac0869d9c..55cbc5f1d 100644
--- a/jjb/releng/opnfv-docker.yml
+++ b/jjb/releng/opnfv-docker.yml
@@ -181,10 +181,6 @@
project: 'yardstick'
<<: *euphrates
<<: *other-receivers
- - 'xtesting':
- project: 'functest-xtesting'
- <<: *master
- <<: *other-receivers
# projects with jobs for danube
- 'dovetail':
project: 'dovetail'
diff --git a/jjb/xci/bifrost-verify-jobs.yml b/jjb/xci/bifrost-verify-jobs.yml
index 7e0117565..2fb7c2167 100644
--- a/jjb/xci/bifrost-verify-jobs.yml
+++ b/jjb/xci/bifrost-verify-jobs.yml
@@ -162,6 +162,13 @@
recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com
# yamllint enable rule:line-length
- email-jenkins-admins-on-failure
+ - postbuildscript:
+ script-only-if-succeeded: false
+ script-only-if-failed: false
+ builders:
+ - shell:
+ !include-raw: ./xci-cleanup.sh
+
# -------------------------------
# trigger macros
# -------------------------------
diff --git a/jjb/xci/xci-cleanup.sh b/jjb/xci/xci-cleanup.sh
index ce84830aa..51a863da2 100755
--- a/jjb/xci/xci-cleanup.sh
+++ b/jjb/xci/xci-cleanup.sh
@@ -14,11 +14,15 @@
# what you are doing.
#----------------------------------------------------------------------
+# Need to cover macros with and without parameters
+VM_NAME=$DISTRO
+VM_NAME+=_xci_vm
+
# skip the deployment if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
echo "Skipping the deployment!"
exit 0
fi
-sudo virsh destroy ${DISTRO}_xci_vm || true
-sudo virsh undefine ${DISTRO}_xci_vm || true
+sudo virsh destroy $VM_NAME || true
+sudo virsh undefine $VM_NAME || true
diff --git a/jjb/xci/xci-daily-jobs.yml b/jjb/xci/xci-daily-jobs.yml
index a92e49085..11db4e168 100644
--- a/jjb/xci/xci-daily-jobs.yml
+++ b/jjb/xci/xci-daily-jobs.yml
@@ -154,6 +154,12 @@
recipients: fatih.degirmenci@ericsson.com yroblamo@redhat.com mchandras@suse.de jack.morgan@intel.com julienjut@gmail.com
# yamllint enable rule:line-length
- email-jenkins-admins-on-failure
+ - postbuildscript:
+ script-only-if-succeeded: false
+ script-only-if-failed: false
+ builders:
+ - shell:
+ !include-raw: ./xci-cleanup.sh
- job-template:
name: 'xci-{phase}-{pod}-{distro}-daily-{stream}'
diff --git a/jjb/xci/xci-merge-jobs.yml b/jjb/xci/xci-merge-jobs.yml
index 492348d63..92eea190f 100644
--- a/jjb/xci/xci-merge-jobs.yml
+++ b/jjb/xci/xci-merge-jobs.yml
@@ -167,6 +167,14 @@
kill-phase-on: NEVER
abort-all-job: true
+ publishers:
+ - postbuildscript:
+ script-only-if-succeeded: false
+ script-only-if-failed: false
+ builders:
+ - shell:
+ !include-raw: ./xci-cleanup.sh
+
- job-template:
name: 'xci-{phase}-{type}-{distro}-merge-{stream}'
@@ -253,8 +261,6 @@
builders:
- shell:
!include-raw: ./xci-run-functest.sh
- - shell:
- !include-raw: ./xci-cleanup.sh
- builder:
name: 'xci-merge-promote-macro'
diff --git a/jjb/xci/xci-promote.sh b/jjb/xci/xci-promote.sh
index 98ad7ff4a..62818abee 100755
--- a/jjb/xci/xci-promote.sh
+++ b/jjb/xci/xci-promote.sh
@@ -14,6 +14,9 @@
# what you are doing.
#----------------------------------------------------------------------
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
# skip the healthcheck if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
echo "Skipping the healthcheck!"
diff --git a/jjb/xci/xci-run-functest.sh b/jjb/xci/xci-run-functest.sh
index 9bcc469c7..60b48cf7f 100755
--- a/jjb/xci/xci-run-functest.sh
+++ b/jjb/xci/xci-run-functest.sh
@@ -7,6 +7,9 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+set -o errexit
+set -o nounset
+set -o pipefail
#----------------------------------------------------------------------
# This script is used by CI and executed by Jenkins jobs.
@@ -14,12 +17,21 @@
# what you are doing.
#----------------------------------------------------------------------
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
# skip the healthcheck if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
echo "Skipping the healthcheck!"
exit 0
fi
+# skip the healthcheck if the scenario is Kubernetes scenario
+if [[ "$DEPLOY_SCENARIO" =~ k8 ]]; then
+ echo "Skipping the healthcheck!"
+ exit 0
+fi
+
# if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since
# the project where the scenario is coming from is cloned and the patch checked out to the
# xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM
diff --git a/jjb/xci/xci-set-scenario.sh b/jjb/xci/xci-set-scenario.sh
index 764857ba4..62b26c019 100755
--- a/jjb/xci/xci-set-scenario.sh
+++ b/jjb/xci/xci-set-scenario.sh
@@ -8,7 +8,6 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
set -o errexit
-set -o nounset
set -o pipefail
#----------------------------------------------------------------------
@@ -17,64 +16,176 @@ set -o pipefail
# what you are doing.
#----------------------------------------------------------------------
-WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO
-/bin/rm -rf $WORK_DIRECTORY && mkdir -p $WORK_DIRECTORY
+# This function allows developers to specify the impacted scenario by adding
+# the info about installer and scenario into the commit message or using
+# the topic branch names. This results in either skipping the real verification
+# totally or skipping the determining the installer and scenario programmatically.
+# It is important to note that this feature is only available to generic scenarios
+# and only single installer/scenario pair is allowed.
+# The input in commit message should be placed at the end of the commit message body,
+# before the signed-off and change-id lines.
+#
+# Pattern to be searched in Commit Message
+# deploy-scenario:<scenario-name>
+# installer-type:<installer-type>
+# Examples:
+# deploy-scenario:os-odl-nofeature
+# installer-type:osa
+#
+# deploy-scenario:k8-nosdn-nofeature
+# installer-type:kubespray
+#
+# Patterns to be searched in topic branch name
+# skip-verify
+# skip-deployment
+# force-verify
+function override_generic_scenario() {
+ echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
-# ensure GERRIT_TOPIC is set
-GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+ # process topic branch names
+ if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
+ # skip the real verification
+ echo "Skipping verify!"
+ echo "INSTALLER_TYPE=osa" > $WORK_DIRECTORY/scenario.properties
+ echo "DEPLOY_SCENARIO=os-nosdn-nofeature" >> $WORK_DIRECTORY/scenario.properties
+ exit 0
+ elif [[ "$GERRIT_TOPIC" =~ 'force-verify' ]]; then
+ # Run the deployment with default installer and scenario when multiple things change
+ # and we want to force that.
+ echo "Recording the installer 'osa' and scenario 'os-nosdn-nofeature' for downstream jobs"
+ echo "Forcing CI verification of default scenario and installer!"
+ echo "INSTALLER_TYPE=osa" > $WORK_DIRECTORY/scenario.properties
+ echo "DEPLOY_SCENARIO=os-nosdn-nofeature" >> $WORK_DIRECTORY/scenario.properties
+ exit 0
+ fi
-# skip the healthcheck if the patch doesn't impact the deployment
-if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
- echo "Skipping verify!"
- echo "DEPLOY_SCENARIO=os-nosdn-nofeature" > $WORK_DIRECTORY/scenario.properties
- exit 0
-fi
+ # process commit message
+ if [[ "$GERRIT_CHANGE_COMMIT_MESSAGE" =~ "installer-type:" && "$GERRIT_CHANGE_COMMIT_MESSAGE" =~ "deploy-scenario:" ]]; then
+ INSTALLER_TYPE=$(echo $GERRIT_CHANGE_COMMIT_MESSAGE | awk '/installer-type:/' RS=" " | cut -d":" -f2)
+ DEPLOY_SCENARIO=$(echo $GERRIT_CHANGE_COMMIT_MESSAGE | awk '/deploy-scenario:/' RS=" " | cut -d":" -f2)
+
+ if [[ -z "$INSTALLER_TYPE" || -z "$DEPLOY_SCENARIO" ]]; then
+ echo "Installer type or deploy scenario is not specified. Falling back to programmatically determining them."
+ else
+ echo "Recording the installer '$INSTALLER_TYPE' and scenario '$DEPLOY_SCENARIO' for downstream jobs"
+ echo "INSTALLER_TYPE=$INSTALLER_TYPE" > $WORK_DIRECTORY/scenario.properties
+ echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" >> $WORK_DIRECTORY/scenario.properties
+ exit 0
+ fi
+ else
+ echo "Installer type or deploy scenario is not specified. Falling back to programmatically determining them."
+ fi
+}
-# if the scenario is external, we need to wipe WORKSPACE to place releng-xci there since
-# the project where the scenario is coming from is cloned and the patch checked out to the
-# xci/scenarios/$DEPLOY_SCENARIO to be synched on clean VM
-# apart from that, we need releng-xci stuff in WORKSPACE for things to function correctly on Jenkins.
-# if the change is coming to releng-xci, we don't need to do anything since the patch is checked
-# out to the WORKSPACE anyways
-if [[ $GERRIT_PROJECT != "releng-xci" ]]; then
+# This function determines the impacted generic scenario by processing the
+# change and using diff to see what changed. If changed files belong to a scenario
+# its name gets recorded for deploying and testing the right scenario.
+#
+# Pattern to be searched in Changeset
+# releng-xci/scenarios/<scenario>/<impacted files>: <scenario>
+# releng-xci/xci/installer/osa/<impacted files>: os-nosdn-nofeature
+# releng-xci/xci/installer/kubespray/<impacted files>: k8-nosdn-nofeature
+# the rest: os-nosdn-nofeature
+function determine_generic_scenario() {
+ echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
+
+ # get the changeset
+ cd $WORKSPACE
+ CHANGESET=$(git diff HEAD^..HEAD --name-only)
+ for CHANGED_FILE in $CHANGESET; do
+ case $CHANGED_FILE in
+ *k8-nosdn*|*kubespray*)
+ [[ ${DEPLOY_SCENARIO[@]} =~ "k8-nosdn-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='k8-nosdn-nofeature'
+ ;;
+ *os-odl*)
+ [[ ${DEPLOY_SCENARIO[@]} =~ "os-odl-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-odl-nofeature'
+ ;;
+ *os-nosdn*|*osa*)
+ [[ ${DEPLOY_SCENARIO[@]} =~ "os-nosdn-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-nosdn-nofeature'
+ ;;
+ *)
+ [[ ${DEPLOY_SCENARIO[@]} =~ "os-nosdn-nofeature" ]] || DEPLOY_SCENARIO[${#DEPLOY_SCENARIO[@]}]='os-nosdn-nofeature'
+ ;;
+ esac
+ done
+}
+
+# This function determines the impacted external scenario by processing the Gerrit
+# change and using diff to see what changed. If changed files belong to a scenario
+# its name gets recorded for deploying and testing the right scenario.
+#
+# Pattern
+# <project-repo>/scenarios/<scenario>/<impacted files>: <scenario>
+function determine_external_scenario() {
+ echo "Processing $GERRIT_PROJECT patchset $GERRIT_REFSPEC"
+
+ # remove the clone that is done via jenkins and place releng-xci there so the
+ # things continue functioning properly
cd $HOME && /bin/rm -rf $WORKSPACE
- git clone https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+ git clone -q https://gerrit.opnfv.org/gerrit/releng-xci $WORKSPACE && cd $WORKSPACE
+
+ # fix the permissions so ssh doesn't complain due to having world-readable keyfiles
chmod -R go-rwx $WORKSPACE/xci/scripts/vm
-fi
-# if change is coming to releng-xci, continue as usual until that part is fixed as well
-if [[ $GERRIT_PROJECT == "releng-xci" ]]; then
- # save the scenario name into java properties file to be injected to downstream jobs via envInject
- echo "Recording scenario name for downstream jobs"
- echo "DEPLOY_SCENARIO=os-nosdn-nofeature" > $WORK_DIRECTORY/scenario.properties
- exit 0
-fi
+ # clone the project repo and fetch the patchset to process for further processing
+ git clone -q https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $WORK_DIRECTORY/$GERRIT_PROJECT
+ cd $WORK_DIRECTORY/$GERRIT_PROJECT
+ git fetch -q https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout -q FETCH_HEAD
-# projects develop different scenarios and jobs need to know which scenario got the
-# change under test so the jobs can deploy and test the right scenario.
-# we need to fetch the change and look at the changeset to find out the scenario instead
-# of hardcoding scenario per project.
+ # process the diff to find out what scenario(s) are impacted - there should only be 1
+ DEPLOY_SCENARIO+=$(git diff HEAD^..HEAD --name-only | grep scenarios | awk -F '[/|/]' '{print $2}' | uniq)
+}
-git clone https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $WORK_DIRECTORY/$GERRIT_PROJECT
-cd $WORK_DIRECTORY/$GERRIT_PROJECT
-git fetch https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout FETCH_HEAD
-DEPLOY_SCENARIO=$(git diff HEAD^..HEAD --name-only | grep scenarios | awk -F '[/|/]' '{print $2}' | uniq)
+echo "Determining the impacted scenario"
+
+declare -a DEPLOY_SCENARIO
+
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
+# this directory is where the temporary clones and files are created
+# while extracting the impacted scenario
+WORK_DIRECTORY=/tmp/$GERRIT_CHANGE_NUMBER/$DISTRO
+/bin/rm -rf $WORK_DIRECTORY && mkdir -p $WORK_DIRECTORY
+
+if [[ $GERRIT_PROJECT == "releng-xci" ]]; then
+ override_generic_scenario
+ determine_generic_scenario
+else
+ determine_external_scenario
+fi
# ensure single scenario is impacted
-if [[ $(echo $DEPLOY_SCENARIO | wc -w) != 1 ]]; then
+ if [[ $(IFS=$'\n' echo ${DEPLOY_SCENARIO[@]} | wc -w) != 1 ]]; then
echo "Change impacts multiple scenarios!"
echo "XCI doesn't support testing of changes that impact multiple scenarios currently."
echo "Please split your change into multiple different/dependent changes, each modifying single scenario."
exit 1
fi
-# save the scenario name into java properties file to be injected to downstream jobs via envInject
-echo "Recording scenario name '$DEPLOY_SCENARIO' for downstream jobs"
-echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" > $WORK_DIRECTORY/scenario.properties
+# set the installer
+case ${DEPLOY_SCENARIO[0]} in
+ os-*)
+ INSTALLER_TYPE=osa
+ ;;
+ k8-*)
+ INSTALLER_TYPE=kubespray
+ ;;
+ *)
+ echo "Unable to determine the installer. Exiting!"
+ exit 1
+ ;;
+esac
+
+# save the installer and scenario names into java properties file
+# so they can be injected to downstream jobs via envInject
+echo "Recording the installer '$INSTALLER_TYPE' and scenario '${DEPLOY_SCENARIO[0]}' for downstream jobs"
+echo "INSTALLER_TYPE=$INSTALLER_TYPE" > $WORK_DIRECTORY/scenario.properties
+echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO" >> $WORK_DIRECTORY/scenario.properties
# skip the deployment if the scenario is not supported on this distro
OPNFV_SCENARIO_REQUIREMENTS=$WORKSPACE/xci/opnfv-scenario-requirements.yml
-if ! sed -n "/^- scenario: $DEPLOY_SCENARIO$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then
- echo "# SKIPPED: Scenario $DEPLOY_SCENARIO is NOT supported on $DISTRO"
+if ! sed -n "/^- scenario: ${DEPLOY_SCENARIO[0]}$/,/^$/p" $OPNFV_SCENARIO_REQUIREMENTS | grep -q $DISTRO; then
+ echo "# SKIPPED: Scenario ${DEPLOY_SCENARIO[0]} is NOT supported on $DISTRO"
exit 0
fi
diff --git a/jjb/xci/xci-start-deployment.sh b/jjb/xci/xci-start-deployment.sh
index 0628829ea..102ca41c3 100755
--- a/jjb/xci/xci-start-deployment.sh
+++ b/jjb/xci/xci-start-deployment.sh
@@ -14,6 +14,9 @@
# what you are doing.
#----------------------------------------------------------------------
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
# skip the deployment if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
echo "Skipping the deployment!"
diff --git a/jjb/xci/xci-start-new-vm.sh b/jjb/xci/xci-start-new-vm.sh
index c2f1f991f..7874e6776 100755
--- a/jjb/xci/xci-start-new-vm.sh
+++ b/jjb/xci/xci-start-new-vm.sh
@@ -14,6 +14,9 @@
# what you are doing.
#----------------------------------------------------------------------
+# ensure GERRIT_TOPIC is set
+GERRIT_TOPIC="${GERRIT_TOPIC:-''}"
+
# skip the deployment if the patch doesn't impact the deployment
if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
echo "Skipping the deployment!"
diff --git a/jjb/xci/xci-verify-jobs.yml b/jjb/xci/xci-verify-jobs.yml
index c54a1b941..4c9ff9e69 100644
--- a/jjb/xci/xci-verify-jobs.yml
+++ b/jjb/xci/xci-verify-jobs.yml
@@ -188,6 +188,15 @@
kill-phase-on: NEVER
abort-all-job: true
+ publishers:
+ - postbuildscript:
+ script-only-if-succeeded: false
+ script-only-if-failed: false
+ builders:
+ - shell:
+ !include-raw: ./xci-cleanup.sh
+
+
- job-template:
name: 'xci-verify-{distro}-{phase}-{type}-{stream}'
@@ -229,9 +238,6 @@
name: OPNFV_RELENG_DEV_PATH
default: $WORKSPACE/
- string:
- name: INSTALLER_TYPE
- default: 'osa'
- - string:
name: GIT_BASE
default: https://gerrit.opnfv.org/gerrit/$PROJECT
description: 'Git URL to use on this Jenkins Slave'
@@ -275,5 +281,3 @@
builders:
- shell:
!include-raw: ./xci-run-functest.sh
- - shell:
- !include-raw: ./xci-cleanup.sh