Merge "Disable Interactivity for and enable Pharos Backup"
authorTrevor Bramwell <tbramwell@linuxfoundation.org>
Tue, 23 Jan 2018 18:23:13 +0000 (18:23 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Tue, 23 Jan 2018 18:23:13 +0000 (18:23 +0000)
23 files changed:
jjb/armband/armband-ci-jobs.yml
jjb/ci_gate_security/opnfv-ci-gate-security.yml
jjb/daisy4nfv/daisy-daily-jobs.yml
jjb/daisy4nfv/daisy-deploy.sh
jjb/daisy4nfv/daisy4nfv-download-artifact.sh
jjb/doctor/doctor.yml
jjb/global/installer-report.sh [new file with mode: 0755]
jjb/global/releng-macros.yml
jjb/pharos/pharos.yml
jjb/releng/compass4nfv-docker.yml
jjb/releng/functest-docker.yml
jjb/releng/opnfv-docker-arm.yml
jjb/releng/opnfv-docker.sh
jjb/releng/opnfv-docker.yml
jjb/releng/releng-ci-jobs.yml
jjb/snaps/snaps-verify-jobs.yml
jjb/xci/xci-cleanup.sh [new file with mode: 0755]
jjb/xci/xci-merge-jobs.yml [new file with mode: 0644]
jjb/xci/xci-promote.sh [new file with mode: 0755]
jjb/xci/xci-run-functest.sh [new file with mode: 0755]
jjb/xci/xci-start-deployment.sh [new file with mode: 0755]
jjb/xci/xci-start-new-vm.sh [new file with mode: 0755]
jjb/xci/xci-verify-jobs.yml

index b2fa62f..da3992e 100644 (file)
 - trigger:
     name: 'fuel-os-nosdn-nofeature-ha-armband-baremetal-master-trigger'
     triggers:
-      - timed: '0 16 * * 2,4,6'
+      - timed: '0 1 * * 2,4,6'
 - trigger:
     name: 'fuel-os-nosdn-nofeature-noha-armband-baremetal-master-trigger'
     triggers:
 - trigger:
     name: 'fuel-os-odl-nofeature-ha-armband-baremetal-master-trigger'
     triggers:
-      - timed: '0 16 * * 1,3,5,7'
+      - timed: '0 1 * * 1,3,5,7'
 # ---------------------------------------------------------------------
 # Enea Armband CI Baremetal Triggers running against euphrates branch
 # ---------------------------------------------------------------------
 - trigger:
     name: 'fuel-os-nosdn-nofeature-ha-armband-baremetal-euphrates-trigger'
     triggers:
-      - timed: '0 1 * * 2,4,6'
+      - timed: ''
 - trigger:
     name: 'fuel-os-nosdn-nofeature-noha-armband-baremetal-euphrates-trigger'
     triggers:
 - trigger:
     name: 'fuel-os-odl-nofeature-ha-armband-baremetal-euphrates-trigger'
     triggers:
-      - timed: '0 1 * * 1,3,5,7'
+      - timed: ''
 # --------------------------------------------------------------
 # Enea Armband CI Virtual Triggers running against master branch
 # --------------------------------------------------------------
index ef0da7f..d54aebe 100644 (file)
                 comment-contains-value: 'reverify'
           projects:
             - project-compare-type: 'REG_EXP'
-              project-pattern: 'apex|armband|bamboo|barometer|bottlenecks|calipso|compass4nfv|conductor|cooper|cperf|daisy|doctor|dovetail|dpacc|enfv|escalator|fds|fuel|functest|octopus|pharos|releng|sandbox|yardstick|infra|ipv6|kvmfornfv|lsoapi|models|moon|multisite|netready'
+              project-pattern: 'apex|armband|bamboo|barometer|bottlenecks|calipso|compass4nfv|conductor|copper|cperf|daisy|doctor|dovetail|dpacc|enfv|escalator|fds|fuel|functest|octopus|pharos|releng|sandbox|yardstick|infra|ipv6|kvmfornfv|lsoapi|models|moon|multisite|netready'
               branches:
                 - branch-compare-type: 'ANT'
                   branch-pattern: '**/{branch}'
index 3aa9505..6f4643a 100644 (file)
       - trigger-builds:
           - project: 'daisy-deploy-{pod}-daily-{stream}'
             current-parameters: false
-            predefined-parameters:
+            predefined-parameters: |
               DEPLOY_SCENARIO={scenario}
+              INSTALLER_VERSION={stream}
+              UPSTREAM_JOB_NAME=$JOB_NAME
+              UPSTREAM_BUILD_ID=$BUILD_ID
             same-node: true
             block: true
       - trigger-builds:
           - project: 'functest-daisy-{pod}-daily-{stream}'
             current-parameters: false
-            predefined-parameters:
+            predefined-parameters: |
               DEPLOY_SCENARIO={scenario}
+              INSTALLER_VERSION={stream}
+              UPSTREAM_JOB_NAME=$JOB_NAME
+              UPSTREAM_BUILD_ID=$BUILD_ID
             same-node: true
             block: true
             block-thresholds:
             - trigger-builds:
                 - project: 'yardstick-daisy-{pod}-daily-{stream}'
                   current-parameters: false
-                  predefined-parameters:
+                  predefined-parameters: |
                     DEPLOY_SCENARIO={scenario}
+                    INSTALLER_VERSION={stream}
+                    UPSTREAM_JOB_NAME=$JOB_NAME
+                    UPSTREAM_BUILD_ID=$BUILD_ID
                   block: true
                   same-node: true
                   block-thresholds:
     builders:
       - description-setter:
           description: "POD: $NODE_NAME"
+      - 'track-begin-timestamp'
       - shell:
           !include-raw-escape: ./daisy4nfv-download-artifact.sh
       - shell:
           !include-raw-escape: ./daisy-deploy.sh
+    publishers:
+      - 'report-provision-result'
 
 ########################
 # trigger macros
index 1723fd1..f729c38 100755 (executable)
@@ -30,7 +30,7 @@ fi
 LABS_DIR=/var/tmp/opnfv-${CONFIG_REPO_NAME}
 
 echo "Cloning ${CONFIG_REPO_NAME} repo $BRANCH to $LABS_DIR"
-rm -rf $LABS_DIR
+sudo rm -rf $LABS_DIR
 git clone ssh://jenkins-zte@gerrit.opnfv.org:29418/${CONFIG_REPO_NAME} \
     --quiet --branch $BRANCH $LABS_DIR
 
index a64c80e..ae5ca38 100755 (executable)
@@ -68,7 +68,15 @@ else
     DOWNLOAD_CMD="curl -L -s -o $WORKSPACE/opnfv.bin"
 fi
 
-$DOWNLOAD_CMD http://$OPNFV_ARTIFACT_URL > gsutil.bin.log 2>&1
+maxretries=3
+cnt=0
+rc=1
+while [ $cnt -lt $maxretries ] && [ $rc -ne 0 ]
+do
+    cnt=$[cnt + 1]
+    $DOWNLOAD_CMD http://$OPNFV_ARTIFACT_URL > gsutil.bin.log 2>&1
+    rc=$?
+done
 
 # list the file
 ls -al $WORKSPACE/opnfv.bin
index 5612401..64194d1 100644 (file)
       - git-scm-gerrit
 
     triggers:
-      - 'doctor-verify':
-          project: '{project}'
-          branch: '{branch}'
-          files: 'doctor_tests/**'
-          is-skip-vote: false
+      - gerrit:
+          server-name: 'gerrit.opnfv.org'
+          trigger-on:
+            - patchset-created-event:
+                exclude-drafts: 'false'
+                exclude-trivial-rebase: 'false'
+                exclude-no-code-change: 'false'
+            - draft-published-event
+            - comment-added-contains-event:
+                comment-contains-value: 'recheck'
+            - comment-added-contains-event:
+                comment-contains-value: 'reverify'
+          projects:
+            - project-compare-type: 'ANT'
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**/{branch}'
+              file-paths:
+                - compare-type: ANT
+                  pattern: 'doctor_tests/**'
 
     builders:
       - shell: |
 
     project-type: 'multijob'
 
-    parameters:
-      - project-parameter:
-          project: '{project}'
-          branch: '{branch}'
-      - 'opnfv-build-ubuntu-defaults'
-      - string:
-          name: OS_CREDS
-          default: /home/jenkins/openstack.creds
-          description: 'OpenStack credentials'
-      - string:
-          name: DOCKER_TAG
-          default: '{docker-tag}'
-          description: 'Tag to pull docker image'
-      - string:
-          name: CLEAN_DOCKER_IMAGES
-          default: 'false'
-          description: 'Remove downloaded docker images (opnfv/functest:*)'
-      - string:
-          name: DEPLOY_SCENARIO
-          default: 'os-nosdn-nofeature-ha'
-          description: 'Scenario to deploy and test'
-      # functest-suite-parameter
-      - string:
-          name: FUNCTEST_MODE
-          default: 'testcase'
-      - string:
-          name: FUNCTEST_SUITE_NAME
-          default: 'doctor-notification'
-      - string:
-          name: TESTCASE_OPTIONS
-          # yamllint disable rule:line-length
-          default: '-e INSPECTOR_TYPE={inspector} -v $WORKSPACE:/home/opnfv/repos/doctor'
-          # yamllint enable rule:line-length
-          description: 'Addtional parameters specific to test case(s)'
-      # functest-parameter
-      - string:
-          name: GS_PATHNAME
-          default: '{gs-pathname}'
-          # yamllint disable rule:line-length
-          description: "Version directory where the opnfv documents will be stored in gs repository"
-          # yamllint enable rule:line-length
-      - string:
-          name: FUNCTEST_REPO_DIR
-          default: "/home/opnfv/repos/functest"
-          description: "Directory where the Functest repository is cloned"
-      - string:
-          name: PUSH_RESULTS_TO_DB
-          default: "true"
-          description: "Push the results of all the tests to the resultDB"
-      - string:
-          name: CI_DEBUG
-          default: 'true'
-          description: "Show debug output information"
-
     scm:
       - git-scm-gerrit
 
           project: '{project}'
           branch: '{branch}'
           files: 'doctor_tests/**'
-          is-skip-vote: true
 
     builders:
       - shell: |
           branch: '{branch}'
       - '{installer}-defaults'
       - '{slave-label}-defaults'
+      - 'doctor-parameter'
+      - 'doctor-functest-parameter'
     scm:
       - git-scm-gerrit
     builders:
       - 'doctor-verify-installer-inspector-builders-macro'
     publishers:
       - 'doctor-verify-publishers-macro'
+
+
+# -------------------------------
+# parameter macros
+# -------------------------------
+- parameter:
+    name: 'doctor-parameter'
+    parameters:
+      - string:
+          name: OS_CREDS
+          default: /home/jenkins/openstack.creds
+          description: 'OpenStack credentials'
+      - string:
+          name: DOCKER_TAG
+          default: '{docker-tag}'
+          description: 'Tag to pull docker image'
+      - string:
+          name: CLEAN_DOCKER_IMAGES
+          default: 'false'
+          description: 'Remove downloaded docker images (opnfv/functest:*)'
+      - string:
+          name: DEPLOY_SCENARIO
+          default: 'os-nosdn-nofeature-ha'
+          description: 'Scenario to deploy and test'
+
+- parameter:
+    name: 'doctor-functest-parameter'
+    parameters:
+      # functest-suite-parameter
+      - string:
+          name: FUNCTEST_MODE
+          default: 'testcase'
+      - string:
+          name: FUNCTEST_SUITE_NAME
+          default: 'doctor-notification'
+      - string:
+          name: TESTCASE_OPTIONS
+          # yamllint disable rule:line-length
+          default: '-e INSPECTOR_TYPE={inspector} -v $WORKSPACE:/home/opnfv/repos/doctor'
+          # yamllint enable rule:line-length
+          description: 'Addtional parameters specific to test case(s)'
+      # functest-parameter
+      - string:
+          name: GS_PATHNAME
+          default: '{gs-pathname}'
+          # yamllint disable rule:line-length
+          description: "Version directory where the opnfv documents will be stored in gs repository"
+          # yamllint enable rule:line-length
+      - string:
+          name: FUNCTEST_REPO_DIR
+          default: "/home/opnfv/repos/functest"
+          description: "Directory where the Functest repository is cloned"
+      - string:
+          name: PUSH_RESULTS_TO_DB
+          default: "true"
+          description: "Push the results of all the tests to the resultDB"
+      - string:
+          name: CI_DEBUG
+          default: 'true'
+          description: "Show debug output information"
 # -------------------------------
 # builder macros
 # -------------------------------
                 - compare-type: ANT
                   pattern: '{files}'
           skip-vote:
-            successful: '{is-skip-vote}'
-            failed: '{is-skip-vote}'
-            unstable: '{is-skip-vote}'
-            notbuilt: '{is-skip-vote}'
+            successful: true
+            failed: true
+            unstable: true
+            notbuilt: true
diff --git a/jjb/global/installer-report.sh b/jjb/global/installer-report.sh
new file mode 100755 (executable)
index 0000000..e2fcfd6
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+source $WORKSPACE/installer_track.sh
+echo """
+    INSTALLER: $INSTALLER
+    INSTALLER_VERSION: $INSTALLER_VERSION
+    JOB_NAME: $JOB_NAME
+    BUILD_ID: $BUILD_ID
+    SENARIO: $DEPLOY_SCENARIO
+    UPSTREAM_JOB_NAME: $UPSTREAM_JOB_NAME:
+    UPSTREAM_BUILD_ID: $UPSTREAM_BUILD_ID
+    PROVISION_RESULT: $PROVISION_RESULT
+    TIMESTAMP_START: $TIMESTAMP_START
+    TIMESTAMP_END: `date '+%Y-%m-%d %H:%M:%S.%3N'`
+    POD_NAME: $NODE_NAME
+"""
+
+# TODO call TestAPI to report installer provisoin result when API is ready
index aeeb246..330584e 100644 (file)
       - gerrit:
           server-name: 'gerrit.opnfv.org'
           trigger-on:
-            - ref-updated
+            - ref-updated-event
           projects:
             - project-compare-type: 'ANT'
               project-pattern: '{project}'
       - shell: |
           find $WORKSPACE -type f -name '*.log' | xargs rm -f
 
+- builder:
+    name: track-begin-timestamp
+    builders:
+      - shell: |
+          echo "export TIMESTAMP_START="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' > $WORKSPACE/installer_track.sh
+
 - publisher:
     name: archive-artifacts
     publishers:
           <<: *email_ptl_defaults
           recipients: >
             ross.b.brattain@intel.com
+
+- publisher:
+    name: 'report-provision-result'
+    publishers:
+      - postbuildscript:
+          script-only-if-succeeded: true
+          builders:
+            - shell: |
+                echo "export PROVISION_RESULT=SUCCEED" >> $WORKSPACE/installer_track.sh
+                echo "export INSTALLER={installer}" >> $WORKSPACE/installer_track.sh
+            - shell:
+                !include-raw-escape: installer-report.sh
+      - postbuildscript:
+          script-only-if-failed: true
+          builders:
+            - shell: |
+                echo "export PROVISION_RESULT=FAIL" >> $WORKSPACE/installer_track.sh
+                echo "export INSTALLER={installer}" >> $WORKSPACE/installer_track.sh
+            - shell:
+                !include-raw-escape: installer-report.sh
index d0db6a4..e162825 100644 (file)
@@ -11,6 +11,7 @@
     jobs:
       - '{project}-verify-basic'
       - 'backup-pharos-dashboard'
+      - 'deploy-pharos-dashboard'
 
 - job-template:
     name: 'backup-pharos-dashboard'
           sudo mv $TMP_DIR/pharos-dashboard-db-$(date +%Y%m%d).tar.gz $BACKUP_DIR
           sudo chown $USER:$USER $BACKUP_DIR/pharos-dashboard-db-$(date +%Y%m%d).tar.gz
           echo "...complete"
+
+- job-template:
+    name: 'deploy-pharos-dashboard'
+
+    disabled: '{obj:disabled}'
+
+    parameters:
+      - project-parameter:
+          project: 'pharos-tools'
+          branch: 'master'
+      - 'pharos-dashboard-defaults'
+
+    scm:
+      - git-scm-gerrit
+
+    triggers:
+      - gerrit:
+          server-name: 'gerrit.opnfv.org'
+          trigger-on:
+            - ref-updated-event
+            - comment-added-contains-event:
+                comment-contains-value: '^redeploy$'
+          projects:
+            - project-compare-type: 'ANT'
+              project-pattern: 'pharos-tools'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**/master'
+
+    builders:
+      - shell: |
+          cd $WORKSPACE/dashboard
+          sudo docker-compose build
+          sudo docker-compose up -d
index db2e427..7f14224 100644 (file)
@@ -36,7 +36,7 @@
       predefined-parameters: |
         PUSH_IMAGE=$PUSH_IMAGE
         COMMIT_ID=$COMMIT_ID
-        RELEASE_VERSION=$RELEASE_VERSION
+        GERRIT_REFNAME=$GERRIT_REFNAME
         DOCKERFILE=$DOCKERFILE
       kill-phase-on: FAILURE
       abort-all-jobs: false
           default: ""
           description: "commit id to make a snapshot docker image"
       - string:
-          name: RELEASE_VERSION
+          name: GERRIT_REFNAME
           default: ""
-          description: "Docker tag to be built, e.g. 5.0.0, opnfv-5.0.0, 5.0.RC1"
+          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"
index 147bcda..584dc30 100644 (file)
@@ -41,7 +41,7 @@
       predefined-parameters: |
         PUSH_IMAGE=$PUSH_IMAGE
         COMMIT_ID=$COMMIT_ID
-        RELEASE_VERSION=$RELEASE_VERSION
+        GERRIT_REFNAME=$GERRIT_REFNAME
         DOCKERFILE=$DOCKERFILE
       kill-phase-on: FAILURE
       abort-all-jobs: false
@@ -51,7 +51,7 @@
       git-revision: true
       node-parameters: false
       predefined-parameters:
-        RELEASE_VERSION=$RELEASE_VERSION
+        GERRIT_REFNAME=$GERRIT_REFNAME
       kill-phase-on: FAILURE
       abort-all-jobs: false
 
@@ -89,6 +89,8 @@
     triggers:
       - pollscm:
           cron: "*/30 * * * *"
+      - gerrit-trigger-tag-created:
+          project: '{project}'
 
     builders:
       - multijob:
           name: PROJECT
           default: "{project}"
           description: "Project name used to enable job conditions"
-      - string:
-          name: RELEASE_VERSION
-          default: ""
-          description: "Docker tag to be built, e.g. 5.0.0, opnfv-5.0.0, 5.0.RC1"
       - string:
           name: GIT_BASE
           default: https://gerrit.opnfv.org/gerrit/$PROJECT
           default: ""
           description: "commit id to make a snapshot docker image"
       - string:
-          name: RELEASE_VERSION
+          name: GERRIT_REFNAME
           default: ""
-          description: "Docker tag to be built, e.g. 5.0.0, opnfv-5.0.0, 5.0.RC1"
+          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"
index 75e41c1..fbf5658 100644 (file)
           default: "{docker_repo_name}"
           description: "Dockerhub repo to be pushed to."
       - string:
-          name: RELEASE_VERSION
+          name: GERRIT_REFNAME
           default: ""
-          description: "Release version, e.g. 1.0, 2.0, 3.0"
+          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: DOCKER_DIR
           default: "{dockerdir}"
     triggers:
       - pollscm:
           cron: "*/30 * * * *"
+      - gerrit-trigger-tag-created:
+          project: '{project}'
 
     publishers:
       - email:
index 7f646f1..69a9f89 100644 (file)
@@ -77,6 +77,9 @@ echo "Current branch: $BRANCH"
 
 BUILD_BRANCH=$BRANCH
 
+GERRIT_REFNAME=${GERRIT_REFNAME:-''}
+RELEASE_VERSION=${GERRIT_REFNAME/refs\/tags//}
+
 if [[ "$BRANCH" == "master" ]]; then
     DOCKER_TAG="latest"
 elif [[ -n "${RELEASE_VERSION-}" ]]; then
index 7ee158c..317efc8 100644 (file)
           project: 'releng-anteater'
           <<: *master
           <<: *other-receivers
-      - 'barometer':
+      - 'barometer-collectd':
           project: 'barometer'
-          dockerdir: '.'
-          dockerfile: 'docker/Dockerfile'
+          dockerdir: 'docker/barometer-collectd'
           <<: *master
           <<: *other-receivers
       - 'barometer-grafana':
           project: 'barometer'
-          dockerdir: '.'
-          dockerfile: 'docker/barometer-grafana/Dockerfile'
+          dockerdir: 'docker/barometer-grafana'
           <<: *master
           <<: *other-receivers
       - 'barometer-influxdb':
           project: 'barometer'
-          dockerdir: '.'
-          dockerfile: 'docker/barometer-influxdb/Dockerfile'
+          dockerdir: 'docker/barometer-influxdb'
           <<: *master
           <<: *other-receivers
       - 'barometer-kafka':
           project: 'barometer'
-          dockerdir: '.'
-          dockerfile: 'docker/barometer-kafka/Dockerfile'
+          dockerdir: 'docker/barometer-kafka'
           <<: *master
           <<: *other-receivers
       - 'barometer-ves':
           project: 'barometer'
-          dockerdir: '.'
-          dockerfile: 'docker/barometer-ves/Dockerfile'
+          dockerdir: 'docker/barometer-ves'
           <<: *master
           <<: *other-receivers
       - 'bottlenecks':
           default: ""
           description: "commit id to make a snapshot docker image"
       - string:
-          name: RELEASE_VERSION
+          name: GERRIT_REFNAME
           default: ""
-          description: "Docker tag to be built, e.g. 5.0.0, opnfv-5.0.0, 5.0.RC1"
+          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}"
     triggers:
       - pollscm:
           cron: "*/30 * * * *"
+      - gerrit-trigger-tag-created:
+          project: '{project}'
 
     publishers:
       - email:
index c4b7c8d..ef99f5a 100644 (file)
           project: '{project}'
           branch: 'master'
 
+    properties:
+      - throttle:
+          max-per-node: 1
+          max-total: 1
+          option: 'project'
+
     scm:
       - git-scm
 
index bc3f393..a6c86c9 100644 (file)
@@ -15,7 +15,7 @@
       - master:
           branch: '{stream}'
           gs-pathname: ''
-          disabled: false
+          disabled: true
 
 - job-template:
     name: 'snaps-verify-{stream}'
diff --git a/jjb/xci/xci-cleanup.sh b/jjb/xci/xci-cleanup.sh
new file mode 100755 (executable)
index 0000000..45b4ec2
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+#----------------------------------------------------------------------
+# This script is used by CI and executed by Jenkins jobs.
+# You are not supposed to use this script manually if you don't know
+# what you are doing.
+#----------------------------------------------------------------------
+
+# 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
+sudo virsh undefine ${DISTRO}_xci_vm
diff --git a/jjb/xci/xci-merge-jobs.yml b/jjb/xci/xci-merge-jobs.yml
new file mode 100644 (file)
index 0000000..351fe22
--- /dev/null
@@ -0,0 +1,257 @@
+---
+- project:
+    name: 'opnfv-xci-merge'
+
+    # -------------------------------
+    # branches
+    # -------------------------------
+    stream:
+      - master:
+          branch: '{stream}'
+    # -------------------------------
+    # distros
+    # -------------------------------
+    distro:
+      - ubuntu:
+          disabled: false
+      - centos:
+          disabled: false
+      - opensuse:
+          disabled: false
+    # -------------------------------
+    # type
+    # -------------------------------
+    type:
+      - virtual
+    # -------------------------------
+    # patch verification phases
+    # -------------------------------
+    phase:
+      - 'deploy'
+      - 'healthcheck'
+      - 'promote'
+    # -------------------------------
+    # scenarios
+    # -------------------------------
+    scenario:
+      - 'os-odl-sfc':
+          project: sfc
+    # -------------------------------
+    # jobs
+    # -------------------------------
+    jobs:
+      - 'xci-{scenario}-{type}-{distro}-merge-{stream}'
+      - 'xci-{phase}-{type}-{distro}-merge-{stream}'
+# -------------------------------
+# job templates
+# -------------------------------
+- job-template:
+    name: 'xci-{scenario}-{type}-{distro}-merge-{stream}'
+
+    project-type: multijob
+
+    disabled: '{obj:disabled}'
+
+    concurrent: false
+
+    properties:
+      - logrotate-default
+      - build-blocker:
+          use-build-blocker: true
+          blocking-jobs:
+            - 'xci-verify-{distro}-.*'
+            - 'bifrost-verify-{distro}-.*'
+            - 'bifrost-periodic-{distro}-.*'
+            - 'xci-osa-verify-{distro}-.*'
+            - 'xci-osa-periodic-{distro}-.*'
+            - 'xci-(os|k8s).*?-virtual-{distro}-.*'
+          block-level: 'NODE'
+
+    wrappers:
+      - ssh-agent-wrapper
+      - build-timeout:
+          timeout: 240
+      - fix-workspace-permissions
+
+    scm:
+      - git:
+          credentials-id: '$SSH_CREDENTIAL_ID'
+          url: 'https://gerrit.opnfv.org/gerrit/releng-xci'
+          branches:
+            - 'origin/master'
+          timeout: 15
+
+    triggers:
+      - gerrit:
+          server-name: 'gerrit.opnfv.org'
+          trigger-on:
+            - change-merged-event
+            - comment-added-contains-event:
+                comment-contains-value: 'remerge'
+          projects:
+            - project-compare-type: 'ANT'
+              project-pattern: '{obj:project}'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**/{branch}'
+              disable-strict-forbidden-file-verification: 'true'
+              file-paths:
+                - compare-type: ANT
+                  pattern: 'scenarios/**'
+          readable-message: true
+          custom-url: '* $JOB_NAME $BUILD_URL'
+
+    parameters:
+      - project-parameter:
+          project: '{obj:project}'
+          branch: '{branch}'
+      - label:
+          name: SLAVE_LABEL
+          default: 'xci-virtual'
+      - string:
+          name: DEPLOY_SCENARIO
+          default: '{scenario}'
+      - string:
+          name: CLEAN_DIB_IMAGES
+          default: 'true'
+      - string:
+          name: GIT_BASE
+          default: https://gerrit.opnfv.org/gerrit/$PROJECT
+          description: 'Git URL to use on this Jenkins Slave'
+
+    builders:
+      - description-setter:
+          description: "Built on $NODE_NAME"
+      - multijob:
+          name: deploy
+          condition: SUCCESSFUL
+          projects:
+            - name: 'xci-deploy-{type}-{distro}-merge-{stream}'
+              current-parameters: true
+              predefined-parameters: |
+                PROJECT=$PROJECT
+                DISTRO={distro}
+                DEPLOY_SCENARIO={scenario}
+                CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
+                GERRIT_BRANCH=$GERRIT_BRANCH
+                GERRIT_REFSPEC=$GERRIT_REFSPEC
+                GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
+                GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+              node-parameters: true
+              kill-phase-on: FAILURE
+              abort-all-job: true
+      - multijob:
+          name: healthcheck
+          condition: SUCCESSFUL
+          projects:
+            - name: 'xci-healthcheck-{type}-{distro}-merge-{stream}'
+              current-parameters: true
+              predefined-parameters: |
+                PROJECT=$PROJECT
+                DISTRO={distro}
+                DEPLOY_SCENARIO={scenario}
+                CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
+                FUNCTEST_MODE=tier
+                FUNCTEST_TIER=healthcheck
+                GERRIT_BRANCH=$GERRIT_BRANCH
+                GERRIT_REFSPEC=$GERRIT_REFSPEC
+                GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
+                GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+              node-parameters: true
+              kill-phase-on: NEVER
+              abort-all-job: true
+
+- job-template:
+    name: 'xci-{phase}-{type}-{distro}-merge-{stream}'
+
+    disabled: false
+
+    concurrent: true
+
+    properties:
+      - logrotate-default
+      - build-blocker:
+          use-build-blocker: true
+          blocking-jobs:
+            - '.*-bifrost-verify-.*'
+            - '.*-bifrost-periodic-.*'
+            - 'osa-verify-.*'
+            - 'osa-periodic-.*'
+          block-level: 'NODE'
+
+    parameters:
+      - string:
+          name: PROJECT
+          default: 'releng-xci'
+      - string:
+          name: DISTRO
+          default: 'ubuntu'
+      - string:
+          name: DEPLOY_SCENARIO
+          default: 'os-nosdn-nofeature-noha'
+      - string:
+          name: FUNCTEST_MODE
+          default: 'tier'
+      - string:
+          name: FUNCTEST_SUITE_NAME
+          default: 'healthcheck'
+      - string:
+          name: XCI_FLAVOR
+          default: 'mini'
+      - string:
+          name: CLEAN_DIB_IMAGES
+          default: 'true'
+      - string:
+          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'
+
+    wrappers:
+      - ssh-agent-wrapper
+      - build-timeout:
+          timeout: 240
+      - fix-workspace-permissions
+
+    scm:
+      - git:
+          credentials-id: '$SSH_CREDENTIAL_ID'
+          url: 'https://gerrit.opnfv.org/gerrit/releng-xci'
+          branches:
+            - 'origin/master'
+          timeout: 15
+
+    builders:
+      - description-setter:
+          description: "Built on $NODE_NAME"
+      - 'xci-merge-{phase}-macro'
+
+# -------------------------------
+# builder macros
+# -------------------------------
+- builder:
+    name: 'xci-merge-deploy-macro'
+    builders:
+      - shell:
+          !include-raw: ./xci-start-new-vm.sh
+      - shell:
+          !include-raw: ./xci-start-deployment.sh
+
+- builder:
+    name: 'xci-merge-healthcheck-macro'
+    builders:
+      - shell:
+          !include-raw: ./xci-run-functest.sh
+      - shell:
+          !include-raw: ./xci-cleanup.sh
+
+- builder:
+    name: 'xci-merge-promote-macro'
+    builders:
+      - shell:
+          !include-raw: ./xci-promote.sh
diff --git a/jjb/xci/xci-promote.sh b/jjb/xci/xci-promote.sh
new file mode 100755 (executable)
index 0000000..98ad7ff
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 Ericsson and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+#----------------------------------------------------------------------
+# This script is used by CI and executed by Jenkins jobs.
+# You are not supposed to use this script manually if you don't know
+# what you are doing.
+#----------------------------------------------------------------------
+
+# 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 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"
+    exit 0
+fi
+
+echo "Hello World!"
diff --git a/jjb/xci/xci-run-functest.sh b/jjb/xci/xci-run-functest.sh
new file mode 100755 (executable)
index 0000000..4fbc6c4
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+#----------------------------------------------------------------------
+# This script is used by CI and executed by Jenkins jobs.
+# You are not supposed to use this script manually if you don't know
+# what you are doing.
+#----------------------------------------------------------------------
+
+# 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 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"
+    exit 0
+fi
+
+echo "Hello World!"
diff --git a/jjb/xci/xci-start-deployment.sh b/jjb/xci/xci-start-deployment.sh
new file mode 100755 (executable)
index 0000000..e86f5b3
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+#----------------------------------------------------------------------
+# This script is used by CI and executed by Jenkins jobs.
+# You are not supposed to use this script manually if you don't know
+# what you are doing.
+#----------------------------------------------------------------------
+
+# skip the deployment if the patch doesn't impact the deployment
+if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
+    echo "Skipping the deployment!"
+    exit 0
+fi
+
+# 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"
+    exit 0
+fi
+
+ssh -F $HOME/.ssh/xci-vm-config ${DISTRO}_xci_vm "cd releng-xci && ./xci_test.sh"
diff --git a/jjb/xci/xci-start-new-vm.sh b/jjb/xci/xci-start-new-vm.sh
new file mode 100755 (executable)
index 0000000..b72c339
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+#----------------------------------------------------------------------
+# This script is used by CI and executed by Jenkins jobs.
+# You are not supposed to use this script manually if you don't know
+# what you are doing.
+#----------------------------------------------------------------------
+
+# skip the deployment if the patch doesn't impact the deployment
+if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
+    echo "Skipping the deployment!"
+    exit 0
+fi
+
+# 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"
+    exit 0
+fi
+
+cd $WORKSPACE
+
+# The start-new-vm.sh script will copy the entire releng-xci directory
+# so lets prepare the test script now so it can be copied by the script.
+# Please do not move it elsewhere or you would have to move it to the VM
+# yourself.
+cat > xci_test.sh<<EOF
+#!/bin/bash
+export DISTRO=$DISTRO
+export DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+export FUNCTEST_MODE=$FUNCTEST_MODE
+export FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
+export XCI_FLAVOR=$XCI_FLAVOR
+export CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
+export OPNFV_RELENG_DEV_PATH=/home/devuser/releng-xci/
+export INSTALLER_TYPE=$INSTALLER_TYPE
+export GIT_BASE=$GIT_BASE
+export JENKINS_HOME=$JENKINS_HOME
+
+if [[ ! -z ${WORKSPACE+x} && $GERRIT_PROJECT != "releng-xci" ]]; then
+    git clone https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT xci/scenarios/$DEPLOY_SCENARIO && cd xci/scenarios/$DEPLOY_SCENARIO
+    git fetch https://gerrit.opnfv.org/gerrit/$GERRIT_PROJECT $GERRIT_REFSPEC && git checkout FETCH_HEAD
+    cd -
+fi
+
+cd xci
+./xci-deploy.sh
+EOF
+chmod a+x xci_test.sh
+
+export XCI_BUILD_CLEAN_VM_OS=false
+export XCI_UPDATE_CLEAN_VM_OS=true
+
+./xci/scripts/vm/start-new-vm.sh $DISTRO
index fffd5c2..af2432d 100644 (file)
 - builder:
     name: 'xci-verify-deploy-macro'
     builders:
-      - shell: |
-          #!/bin/bash
-
-          # skip the deployment if the patch doesn't impact the deployment
-          if [[ "$GERRIT_TOPIC" =~ 'skip-verify' ]]; then
-              echo "Skipping the deployment!"
-              exit 0
-          fi
-
-          cd $WORKSPACE
-
-          # The start-new-vm.sh script will copy the entire releng-xci directory
-          # so lets prepare the test script now so it can be copied by the script.
-          # Please do not move it elsewhere or you would have to move it to the VM
-          # yourself.
-          cat > xci_test.sh<<EOF
-          #!/bin/bash
-          export DISTRO=$DISTRO
-          export DEPLOY_SCENARIO=$DEPLOY_SCENARIO
-          export FUNCTEST_MODE=$FUNCTEST_MODE
-          export FUNCTEST_SUITE_NAME=$FUNCTEST_SUITE_NAME
-          export XCI_FLAVOR=$XCI_FLAVOR
-          export CLEAN_DIB_IMAGES=$CLEAN_DIB_IMAGES
-          export OPNFV_RELENG_DEV_PATH=/home/devuser/releng-xci/
-          export INSTALLER_TYPE=$INSTALLER_TYPE
-          export GIT_BASE=$GIT_BASE
-          export JENKINS_HOME=$JENKINS_HOME
-
-          cd xci
-          ./xci-deploy.sh
-          EOF
-          chmod a+x xci_test.sh
-
-          export XCI_BUILD_CLEAN_VM_OS=false
-          export XCI_UPDATE_CLEAN_VM_OS=true
-
-          ./xci/scripts/vm/start-new-vm.sh $DISTRO
-      - shell: |
-          #!/bin/bash
-
-          # skip the deployment if the patch doesn't impact the deployment
-          if [[ "$GERRIT_TOPIC" =~ skip-verify|skip-deployment ]]; then
-              echo "Skipping the deployment!"
-              exit 0
-          fi
-
-          ssh -F $HOME/.ssh/xci-vm-config ${DISTRO}_xci_vm "cd releng-xci && ./xci_test.sh"
+      - shell:
+          !include-raw: ./xci-start-new-vm.sh
 
+      - shell:
+          !include-raw: ./xci-start-deployment.sh
 
 - builder:
     name: 'xci-verify-healthcheck-macro'
     builders:
-      - shell: |
-          #!/bin/bash
-
-          # 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
-
-          echo "Hello World!"
-      - shell: |
-          #!/bin/bash
-
-          # 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
-          sudo virsh undefine ${DISTRO}_xci_vm
-
-# this will be enabled once the xci is prepared
-# - builder:
-#    name: 'xci-verify-healthcheck-macro'
-#    builders:
-#        - shell:
-#            !include-raw: ../../utils/fetch_os_creds.sh
-#        - shell:
-#            !include-raw: ../functest/functest-alpine.sh
+      - shell:
+          !include-raw: ./xci-run-functest.sh
+      - shell:
+          !include-raw: ./xci-cleanup.sh