xci: Create periodic osa jobs to find working version 25/32825/7
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>
Fri, 31 Mar 2017 20:20:17 +0000 (22:20 +0200)
committerFatih Degirmenci <fatih.degirmenci@ericsson.com>
Sun, 2 Apr 2017 17:36:26 +0000 (10:36 -0700)
These jobs run periodically against the HEAD of master and stable/ocata
branches in order to attempt deployment and help us to find more
recent working versions to pin.

In perfect world, these jobs should be run post-merge, helping us
to move faster but lack of resources prevent us doing that.

One thing to note here is that we use the pinned version of bifrost
in order to make sure we change one thing at a time to reduce the
delta.

Change-Id: Ieaff7e80581c7577b253b3646ca386313295a45a
Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
jjb/xci/osa-periodic-jobs.yml [new file with mode: 0644]
jjb/xci/xci-deploy.sh

diff --git a/jjb/xci/osa-periodic-jobs.yml b/jjb/xci/osa-periodic-jobs.yml
new file mode 100644 (file)
index 0000000..42b4941
--- /dev/null
@@ -0,0 +1,146 @@
+- project:
+    project: 'releng'
+
+    name: 'os-periodic'
+#--------------------------------
+# Branch Anchors
+#--------------------------------
+# the versions stated here default to branches which then later
+# on used for checking out the branches, pulling in head of the branch.
+    master: &master
+        stream: master
+        openstack-osa-version: '{stream}'
+        opnfv-releng-version: 'master'
+        gs-pathname: ''
+    ocata: &ocata
+        stream: ocata
+        openstack-osa-version: 'stable/{stream}'
+        opnfv-releng-version: 'master'
+        gs-pathname: '/{stream}'
+#--------------------------------
+#        XCI PODs
+#--------------------------------
+    pod:
+        - virtual:
+            <<: *master
+        - virtual:
+            <<: *ocata
+#--------------------------------
+# Supported Distros
+#--------------------------------
+    distro:
+        - 'xenial':
+            disabled: false
+            slave-label: xci-xenial-virtual
+            dib-os-release: 'xenial'
+            dib-os-element: 'ubuntu-minimal'
+            dib-os-packages: 'vlan,vim,less,bridge-utils,sudo,language-pack-en,iputils-ping,rsyslog,curl,python,debootstrap,ifenslave,ifenslave-2.6,lsof,lvm2,tcpdump,nfs-kernel-server,chrony,iptables'
+            extra-dib-elements: 'openssh-server'
+        - 'centos7':
+            disabled: true
+            slave-label: xci-centos7-virtual
+            dib-os-release: '7'
+            dib-os-element: 'centos7'
+            dib-os-packages: 'vim,less,bridge-utils,iputils,rsyslog,curl'
+            extra-dib-elements: 'openssh-server'
+        - 'suse':
+            disabled: true
+            slave-label: xci-suse-virtual
+            dib-os-release: '42.2'
+            dib-os-element: 'opensuse-minimal'
+            dib-os-packages: 'vim,less,bridge-utils,iputils,rsyslog,curl'
+            extra-dib-elements: 'openssh-server'
+
+#--------------------------------
+# jobs
+#--------------------------------
+    jobs:
+        - 'osa-deploy-{pod}-{distro}-periodic-{stream}'
+
+#--------------------------------
+# job templates
+#--------------------------------
+- job-template:
+    name: 'osa-deploy-{pod}-{distro}-periodic-{stream}'
+
+    disabled: '{obj:disabled}'
+
+    concurrent: false
+
+    properties:
+        - build-blocker:
+            use-build-blocker: true
+            blocking-jobs:
+                - '^xci-os.*'
+                - '^xci-deploy.*'
+                - '^xci-functest.*'
+                - '^bifrost-.*periodic.*'
+                - '^osa-.*periodic.*'
+            block-level: 'NODE'
+        - logrotate-default
+
+    parameters:
+        - project-parameter:
+            project: '{project}'
+            branch: '{opnfv-releng-version}'
+        - string:
+            name: GIT_BASE
+            default: https://gerrit.opnfv.org/gerrit/$PROJECT
+        - string:
+            name: XCI_FLAVOR
+            default: 'ha'
+        - string:
+            name: OPENSTACK_OSA_VERSION
+            default: '{openstack-osa-version}'
+        - string:
+            name: OPNFV_RELENG_VERSION
+            default: '{opnfv-releng-version}'
+        - string:
+            name: DISTRO
+            default: '{distro}'
+        - string:
+            name: DIB_OS_RELEASE
+            default: '{dib-os-release}'
+        - string:
+            name: DIB_OS_ELEMENT
+            default: '{dib-os-element}'
+        - string:
+            name: DIB_OS_PACKAGES
+            default: '{dib-os-packages}'
+        - string:
+            name: EXTRA_DIB_ELEMENTS
+            default: '{extra-dib-elements}'
+        - string:
+            name: CLEAN_DIB_IMAGES
+            default: 'true'
+        - label:
+            name: SLAVE_LABEL
+            default: '{slave-label}'
+        - string:
+            name: ANSIBLE_VERBOSITY
+            default: ''
+
+    wrappers:
+        - fix-workspace-permissions
+
+    scm:
+        - git-scm
+
+    # trigger is disabled until we know which jobs we will have
+    # and adjust stuff accordingly
+    triggers:
+        - timed: '#@midnight'
+
+    builders:
+        - description-setter:
+            description: "Built on $NODE_NAME - Scenario: $DEPLOY_SCENARIO"
+        - 'osa-deploy-builder'
+
+#---------------------------
+# builder macros
+#---------------------------
+- builder:
+    name: osa-deploy-builder
+    builders:
+        - shell:
+            !include-raw: ./xci-deploy.sh
index cf5fe32..33457b9 100755 (executable)
@@ -26,6 +26,48 @@ elif [[ "$JOB_NAME" =~ "periodic" ]]; then
     echo "Info: Using $OPNFV_RELENG_VERSION"
 fi
 
+# this is just an example to give the idea about what we need to do
+# so ignore this part for the timebeing as we need to adjust xci-deploy.sh
+# to take this into account while deploying anyways
+# clone openstack-ansible
+# stable/ocata already use pinned versions so this is only valid for master
+if [[ "$JOB_NAME" =~ "periodic" && "$OPENSTACK_OSA_VERSION" == "master" ]]; then
+    cd $WORKSPACE
+    # get the url to openstack-ansible git
+    source ./config/env-vars
+    echo "Info: Capture the ansible role requirement versions before doing anything"
+    git clone -q $OPENSTACK_OSA_GIT_URL
+    cd openstack-ansible
+    cat ansible-role-requirements.yml | while IFS= read -r line
+    do
+        if [[ $line =~ "src:" ]]; then
+            repo_url=$(echo $line | awk {'print $2'})
+            repo_sha1=$(git ls-remote $repo_url $OPENSTACK_OSA_VERSION | awk {'print $1'})
+        fi
+        echo "$line" | sed -e "s|master|$repo_sha1|" >> opnfv-ansible-role-requirements.yml
+    done
+    echo "Info: SHA1s of ansible role requirements"
+    echo "-------------------------------------------------------------------------"
+    cat opnfv-ansible-role-requirements.yml
+    echo "-------------------------------------------------------------------------"
+fi
+
 # proceed with the deployment
 cd $WORKSPACE/prototypes/xci
 sudo -E ./xci-deploy.sh
+
+# if we arrived here without failing, it means we have something we can pin
+# this is again here to show the intention
+cd $WORKSPACE/openstack-ansible
+OSA_GIT_SHA1=$(git rev-parse HEAD)
+
+# log some info
+echo -e "\n"
+echo "***********************************************************************"
+echo "*                          OSA SHA1 TO PIN                            *"
+echo "*                                                                     *"
+echo "    $OSA_GIT_SHA1"
+echo "*                                                                     *"
+echo "***********************************************************************"
+
+echo -e "\n"