Merge "create merge jobs for octopus for master and stable arno"
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>
Thu, 9 Jul 2015 15:08:30 +0000 (15:08 +0000)
committerGerrit Code Review <gerrit@172.30.200.206>
Thu, 9 Jul 2015 15:08:30 +0000 (15:08 +0000)
jjb/doctor/doctor.yml
jjb/doctor/docu-build.sh
jjb/doctor/docu-verify.sh [deleted file]
jjb/functest/functest.yml
jjb/genesis/genesis-fuel.yml
jjb/promise/docu-build.sh
jjb/promise/docu-verify.sh [deleted file]
jjb/promise/promise.yml
jjb/yardstick/yardstick.yml
utils/fetch_os_creds.sh

index 39c20dc..aa58664 100644 (file)
 - project:
     name: doctor
+    project: '{name}'
     jobs:
-        - 'doctor-test'
-        - 'doctor-daily-{stream}'
-        - 'doctor-merge'
-        - 'doctor-verify'
+        - '{project}-verify'
+        - '{project}-merge-{stream}'
 
-    # stream:    branch with - in place of / (eg. stable-helium)
-    # branch:    branch (eg. stable/helium)
+    # stream:    branch with - in place of / (eg. stable-arno)
+    # branch:    branch (eg. stable/arno)
     stream:
         - master:
             branch: 'master'
 
-    project: 'doctor'
-    somevar: 'foo'
-
-- job-template:
-    name: doctor-test
-
-    node: master
-
-    project-type: freestyle
-
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 10
-        artifactDaysToKeep: -1
-        artifactNumToKeep: -1
-
-    builders:
-        - shell: |
-            echo "Hello world from doctor"
-
-- job-template:
-    name: 'doctor-daily-{stream}'
-
+- job_defaults: &job_defaults
+    name: job_defaults
     node: master
-
-    # Job template for daily builders
-    #
-    # Required Variables:
-    #     stream:    branch with - in place of / (eg. stable)
-    #     branch:    branch (eg. stable)
-
     project-type: freestyle
-    varsetabove: '{somevar}'
-
     logrotate:
         daysToKeep: '{build-days-to-keep}'
         numToKeep: '{build-num-to-keep}'
         artifactDaysToKeep: '{build-artifact-days-to-keep}'
         artifactNumToKeep: '{build-artifact-num-to-keep}'
-
     parameters:
         - project-parameter:
             project: '{project}'
-        - string:
-            name: GIT_BASE
-            default: 'https://gerrit.opnfv.org/gerrit/{project}'
-            description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
-
-    scm:
-        - git-scm:
-            credentials-id: '{ssh-credentials}'
-            refspec: ''
-            branch: '{branch}'
-
     wrappers:
         - ssh-agent-credentials:
-            user: '{ssh-credentials}'
-
-    triggers:
-        - timed: 'H H * * *'
-
-    prebuilders:
-        - test-macro
-
-    builders:
-        - shell:
-            !include-raw docu-build.sh
-
-    postbuilders:
-        - test-macro
+            users:
+                - '{ssh-credentials}'
 
 - job-template:
-    name: 'doctor-verify'
-
-    node: master
-
-    project-type: freestyle
-
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 10
-        artifactDaysToKeep: -1
-        artifactNumToKeep: -1
-
-    parameters:
-        - project-parameter:
-            project: '{project}'
-        - gerrit-parameter:
-            branch: 'master'
-        - string:
-            name: GIT_BASE
-            default: 'https://gerrit.opnfv.org/gerrit/{project}'
-            description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
+    name: '{project}-verify'
+    <<: *job_defaults
     scm:
         - gerrit-trigger-scm:
             credentials-id: '{ssh-credentials}'
             refspec: '$GERRIT_REFSPEC'
             choosing-strategy: 'gerrit'
-
-    wrappers:
-        - ssh-agent-credentials:
-            user: '{ssh-credentials}'
-
     triggers:
         - gerrit:
             trigger-on:
-                - patchset-created-event:
-                    exclude-drafts: 'false'
-                    exclude-trivial-rebase: 'false'
-                    exclude-no-code-change: 'false'
+                - patchset-created-event
                 - draft-published-event
                 - comment-added-contains-event:
                     comment-contains-value: 'recheck'
                     comment-contains-value: 'reverify'
             projects:
               - project-compare-type: 'ANT'
-                project-pattern: 'doctor'
+                project-pattern: '{project}'
                 branches:
-                  - branch-compare-type: 'ANT'
-                    branch-pattern: '**/master'
-
+                    - branch-compare-type: 'ANT'
+                      branch-pattern: '**'
     builders:
         - shell:
-            !include-raw docu-verify.sh
+            !include-raw docu-build.sh
 
 - job-template:
-    name: 'doctor-merge'
-
-    node: master
-
-    # builder-merge job to run JJB update
-    #
-    # This job's purpose is to update all the JJB
-
-    project-type: freestyle
-
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 40
-        artifactDaysToKeep: -1
-        artifactNumToKeep: 5
-
-    parameters:
-        - project-parameter:
-            project: '{project}'
-        - gerrit-parameter:
-            branch: 'master'
-        - string:
-            name: GIT_BASE
-            default: 'https://gerrit.opnfv.org/gerrit/{project}'
-            description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
-
+    name: '{project}-merge-{stream}'
+    <<: *job_defaults
     scm:
         - gerrit-trigger-scm:
             credentials-id: '{ssh-credentials}'
             refspec: ''
             choosing-strategy: 'default'
-
-    wrappers:
-        - ssh-agent-credentials:
-            user: '{ssh-credentials}'
-
     triggers:
         - gerrit:
             trigger-on:
                     comment-contains-value: 'remerge'
             projects:
               - project-compare-type: 'ANT'
-                project-pattern: 'doctor'
+                project-pattern: '{project}'
                 branches:
                     - branch-compare-type: 'ANT'
-                      branch-pattern: '**/master'
-
+                      branch-pattern: '**/{branch}'
     builders:
         - shell:
             !include-raw docu-build.sh
-
-
-
-
-
-
index 39ecf3b..ffb1311 100644 (file)
@@ -2,23 +2,46 @@
 set -e
 set -o pipefail
 
-build_dir="build"
-project="$(git remote -v | head -n1 | awk '{{print $2}}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//')"
 export PATH=$PATH:/usr/local/bin/
 
+echo
+echo "Build"
+echo "-----"
+echo
+
 make
 
-# upload all built files
-files=(
-    design_docs
-    requirements/html
-    requirements/latex/*.pdf
-)
-
-for file in "${{files[@]}}"; do
-    gsutil cp -r -L gsoutput.txt $build_dir/$file gs://artifacts.opnfv.org/$project/
-    #gsutil setmeta -h "Cache-Control:private, max-age=0, no-transform" \
-    #-R gs://artifacts.opnfv.org/$project/$file
-    cat gsoutput.txt
-    rm -f gsoutput.txt
-done
+echo
+echo "Upload"
+echo "------"
+echo
+
+# NOTE: make sure source parameters for GS paths are not empty.
+[[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
+[[ $GERRIT_PROJECT =~ .+ ]]
+[[ $GERRIT_BRANCH =~ .+ ]]
+
+gs_path_review="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
+if [[ $GERRIT_BRANCH = "master" ]] ; then
+    gs_path_branch="artifacts.opnfv.org/$GERRIT_PROJECT"
+else
+    gs_path_branch="artifacts.opnfv.org/$GERRIT_PROJECT/${{GERRIT_BRANCH##*/}}"
+fi
+
+if [[ $JOB_NAME =~ "verify" ]] ; then
+    gsutil cp -r build/* "gs://$gs_path_review/"
+    echo
+    echo "Document is available at http://$gs_path_review"
+else
+    gsutil cp -r build/design_docs "gs://$gs_path_branch/"
+    gsutil cp -r build/requirements/html "gs://$gs_path_branch/"
+    gsutil cp -r build/requirements/latex/*.pdf "gs://$gs_path_branch/"
+    echo
+    echo "Latest document is available at http://$gs_path_branch"
+
+    if gsutil ls "gs://$gs_path_review" > /dev/null 2>&1 ; then
+        echo
+        echo "Deleting Out-of-dated Documents..."
+        gsutil rm -r "gs://$gs_path_review"
+    fi
+fi
diff --git a/jjb/doctor/docu-verify.sh b/jjb/doctor/docu-verify.sh
deleted file mode 100755 (executable)
index 72d02cf..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-set -e
-set -o pipefail
-
-export PATH=$PATH:/usr/local/bin/
-
-make
index 1f284f0..0d77606 100644 (file)
@@ -3,11 +3,19 @@
 ###################################
 - project:
     name: functest
-
     pod:
-        - 'opnfv-jump-1'
-        - 'opnfv-jump-2'
-        - 'orange-build'
+        - opnfv-jump-1:
+            node: 'opnfv-jump-1'
+            installer_type: 'fuel'
+            installer_ip: '10.20.0.2'
+        - opnfv-jump-2:
+            node: 'opnfv-jump-2'
+            installer_type: 'foreman'
+            installer_ip: '172.30.10.73'
+        - orange-build:
+            node: 'orange-build'
+            installer_type: 'foreman'
+            installer_ip: '172.30.10.73'
     jobs:
         - 'functest-{pod}'
         - 'set-functest-env-{pod}'
 
             echo "Functest: prepare Functest environment"
             mkdir -p $HOME/functest/
-            source $HOME/functest/opnfv-openrc.sh
+            # source openstack vars
+            if [[ ! -f $HOME/opnfv-openrc.sh ]]; then
+                echo "Unable to access file $HOME/opnfv-openrc.sh"
+                exit 1
+            fi
+            source $HOME/opnfv-openrc.sh
 
             # WORKSPACE is the root of the functest repo
             # go into WORKSPACE where the functest repo is cloned
@@ -65,7 +78,7 @@
             # prepare
             echo "Functest: prepare Functest environment"
             python $WORKSPACE/testcases/config_functest.py --debug $WORKSPACE/ start
-            
+
 - job-template:
     name: clean-functest-env-{pod}
 
     parameters:
         - project-parameter:
             project: '{project}'
+        - string:
+            name: INSTALLER_TYPE
+            default: '{installer_type}'
+            description: "Installer name that is used for deployment."
+        - string:
+            name: INSTALLER_IP
+            default: '{installer_ip}'
+            description: "Installer IP."
         - '{pod}'
 
     scm:
         artifactNumToKeep: -1
 
     builders:
+        - 'functest-fetch-os-creds'
         - 'functest-all'
         - 'functest-store-results'
         - 'functest-cleanup'
 
             # cleanup
             python $WORKSPACE/testcases/config_functest.py --debug --force $WORKSPACE/ clean
+
+- builder:
+    name: functest-fetch-os-creds
+    builders:
+        - shell:
+            !include-raw ../../utils/fetch_os_creds.sh
index 1eb21f3..b4b428b 100644 (file)
 - trigger:
     name: 'fuel-master'
     triggers:
-        - pollscm: '0 21 * * *'
+        - timed: '0 21 * * *'
 
 - trigger:
     name: 'fuel-stable-arno'
     triggers:
-        - pollscm: '0 3 * * *'
+        - timed: '0 3 * * *'
index c635a11..aafcb2f 100644 (file)
@@ -2,21 +2,46 @@
 set -e
 set -o pipefail
 
-build_dir="build"
-project="$(git remote -v | head -n1 | awk '{{print $2}}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//')"
 export PATH=$PATH:/usr/local/bin/
 
+echo
+echo "Build"
+echo "-----"
+echo
+
 make
 
-# upload all built files
-files=(
-    requirements/latex/*.pdf
-)
-
-for file in "${{files[@]}}"; do
-    gsutil cp -r -L gsoutput.txt $build_dir/$file gs://artifacts.opnfv.org/$project/
-    #gsutil setmeta -h "Cache-Control:private, max-age=0, no-transform" \
-    #-R gs://artifacts.opnfv.org/$project/$file
-    cat gsoutput.txt
-    rm -f gsoutput.txt
-done
+echo
+echo "Upload"
+echo "------"
+echo
+
+# NOTE: make sure source parameters for GS paths are not empty.
+[[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
+[[ $GERRIT_PROJECT =~ .+ ]]
+[[ $GERRIT_BRANCH =~ .+ ]]
+
+gs_path_review="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
+if [[ $GERRIT_BRANCH = "master" ]] ; then
+    gs_path_branch="artifacts.opnfv.org/$GERRIT_PROJECT"
+else
+    gs_path_branch="artifacts.opnfv.org/$GERRIT_PROJECT/${{GERRIT_BRANCH##*/}}"
+fi
+
+if [[ $JOB_NAME =~ "verify" ]] ; then
+    gsutil cp -r build/* "gs://$gs_path_review/"
+    echo
+    echo "Document is available at http://$gs_path_review"
+else
+    gsutil cp -r build/requirements/latex/*.pdf "gs://$gs_path_branch/"
+    echo
+    echo "Document is available at http://$gs_path_branch"
+fi
+
+if [[ $GERRIT_EVENT_TYPE = "change-merged" ]] ; then
+    echo
+    echo "Clean Out-of-dated Documents"
+    echo "----------------------------"
+    echo
+    gsutil rm -r "gs://$gs_path_review" || true
+fi
diff --git a/jjb/promise/docu-verify.sh b/jjb/promise/docu-verify.sh
deleted file mode 100644 (file)
index 72d02cf..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-set -e
-set -o pipefail
-
-export PATH=$PATH:/usr/local/bin/
-
-make
index 3196ef4..357ddd2 100644 (file)
 - project:
     name: promise
+    project: '{name}'
     jobs:
-        - 'promise-test'
-        - 'promise-daily-{stream}'
-        - 'promise-merge'
-        - 'promise-verify'
+        - '{project}-verify'
+        - '{project}-merge-{stream}'
 
-    # stream:    branch with - in place of / (eg. stable-helium)
-    # branch:    branch (eg. stable/helium)
+    # stream:    branch with - in place of / (eg. stable-arno)
+    # branch:    branch (eg. stable/arno)
     stream:
         - master:
             branch: 'master'
-
-    project: 'promise'
-    somevar: 'foo'
-
-- job-template:
-    name: promise-test
-
-    node: master
-
-    project-type: freestyle
-
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 10
-        artifactDaysToKeep: -1
-        artifactNumToKeep: -1
-
-    builders:
-        - shell: |
-            echo "Hello world from promise"
-
-- job-template:
-    name: 'promise-daily-{stream}'
-
-    node: master
-
-    # Job template for daily builders
-    #
-    # Required Variables:
-    #     stream:    branch with - in place of / (eg. stable)
-    #     branch:    branch (eg. stable)
-
-    project-type: freestyle
-    varsetabove: '{somevar}'
-
-    logrotate:
-        daysToKeep: '{build-days-to-keep}'
-        numToKeep: '{build-num-to-keep}'
-        artifactDaysToKeep: '{build-artifact-days-to-keep}'
-        artifactNumToKeep: '{build-artifact-num-to-keep}'
-
-    parameters:
-        - project-parameter:
-            project: '{project}'
-
-    scm:
-        - git-scm:
-            credentials-id: '{ssh-credentials}'
-            refspec: ''
-            branch: '{branch}'
-
-    wrappers:
-        - ssh-agent-credentials:
-            user: '{ssh-credentials}'
-
-    triggers:
-        - timed: 'H H * * *'
-
-    prebuilders:
-        - test-macro
-
-    builders:
-        - shell:
-            !include-raw docu-build.sh
-
-    postbuilders:
-        - test-macro
-
-- job-template:
-    name: 'promise-verify'
-
-    node: master
-
-    project-type: freestyle
-
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 10
-        artifactDaysToKeep: -1
-        artifactNumToKeep: -1
-
-    parameters:
-        - project-parameter:
-            project: '{project}'
-        - gerrit-parameter:
-            branch: 'master'
-    scm:
-        - gerrit-trigger-scm:
-            credentials-id: '{ssh-credentials}'
-            refspec: '$GERRIT_REFSPEC'
-            choosing-strategy: 'gerrit'
-
-    wrappers:
-        - ssh-agent-credentials:
-            user: '{ssh-credentials}'
-
-    triggers:
-        - gerrit:
-            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: 'promise'
-                branches:
-                  - branch-compare-type: 'ANT'
-                    branch-pattern: '**/master'
-
-    builders:
-        - shell:
-            !include-raw docu-verify.sh
-
-- job-template:
-    name: 'promise-merge'
-
-    # builder-merge job to run JJB update
-    #
-    # This job's purpose is to update all the JJB
-
-    project-type: freestyle
-
-    node: master
-
-    logrotate:
-        daysToKeep: 30
-        numToKeep: 40
-        artifactDaysToKeep: -1
-        artifactNumToKeep: 5
-
-    parameters:
-        - project-parameter:
-            project: '{project}'
-        - gerrit-parameter:
-            branch: 'master'
-
-    scm:
-        - gerrit-trigger-scm:
-            credentials-id: '{ssh-credentials}'
-            refspec: ''
-            choosing-strategy: 'default'
-
-    wrappers:
-        - ssh-agent-credentials:
-            user: '{ssh-credentials}'
-
-    triggers:
-        - gerrit:
-            trigger-on:
-                - change-merged-event
-                - comment-added-contains-event:
-                    comment-contains-value: 'remerge'
-            projects:
-              - project-compare-type: 'ANT'
-                project-pattern: 'promise'
-                branches:
-                    - branch-compare-type: 'ANT'
-                      branch-pattern: '**/master'
-
-    builders:
-        - shell:
-            !include-raw docu-build.sh
-
index 9334cd9..8f40d87 100644 (file)
@@ -7,8 +7,14 @@
         - 'yardstick-verify'
 
     pod:
-        - 'opnfv-jump-1'
-        - 'opnfv-jump-2'
+        - opnfv-jump-1:
+            node: 'opnfv-jump-1'
+            installer_type: 'fuel'
+            installer_ip: '10.20.0.2'
+        - opnfv-jump-2:
+            node: 'opnfv-jump-2'
+            installer_type: 'foreman'
+            installer_ip: '172.30.10.73'
 
     # stream:    branch with - in place of / (eg. stable-helium)
     # branch:    branch (eg. stable/helium)
 
     disabled: false
 
-    node: '{pod}'
+    node: '{node}'
 
     parameters:
         - project-parameter:
             project: '{project}'
+        - string:
+            name: INSTALLER_TYPE
+            default: '{installer_type}'
+            description: "Installer name that is used for deployment."
+        - string:
+            name: INSTALLER_IP
+            default: '{installer_ip}'
+            description: "Installer IP."
 
     scm:
         - git-scm:
         artifactNumToKeep: -1
 
     builders:
+        - 'yardstick-fetch-os-creds'
         - 'yardstick-ping'
 
 ########################
             echo "Yardstick: prepare Yardstick environment"
 
             # source openstack vars
-            source $HOME/yardstick/opnfv-openrc.sh
+            if [[ ! -f $HOME/opnfv-openrc.sh ]]; then
+                echo "Unable to access file $HOME/opnfv-openrc.sh"
+                exit 1
+            fi
+            source $HOME/opnfv-openrc.sh
 
             # check if cirros-0.3.3 image is already available
             # if not, create the image
 
             # done
             echo "Yardstick: done!"
+
+- builder:
+    name: yardstick-fetch-os-creds
+    builders:
+        - shell:
+            !include-raw ../../utils/fetch_os_creds.sh
\ No newline at end of file
index 2ce81d8..cd53dac 100755 (executable)
@@ -52,12 +52,16 @@ while getopts ":d:i:a:h:" optchar; do
     esac
 done
 
+# set vars from env if not provided by user as options
+dest_path=${dest_path:-$HOME/opnfv-openrc.sh}
+installer_type=${installer_type:-$INSTALLER_TYPE}
+installer_ip=${installer_ip:-$INSTALLER_IP}
+
 if [ -z $dest_path ] || [ -z $installer_type ] || [ -z $installer_ip ]; then
     usage
     exit 2
 fi
 
-
 # Checking if destination path is valid
 if [ -d $dest_path ]; then
     error "Please provide the full destination path for the credentials file including the filename"
@@ -88,10 +92,10 @@ if [ "$installer_type" == "fuel" ]; then
     sshpass -p r00tme scp 2>/dev/null $ssh_options root@${installer_ip}:~/openrc $dest_path &> /dev/null
 
     #This file contains the mgmt keystone API, we need the public one for our rc file
-    admin_ip=$(cat $dest_path | grep "OS_AUTH_URL" | sed 's/^.*\=//' | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" | sed s'/.$//')
+    admin_ip=$(cat $dest_path | grep "OS_AUTH_URL" | sed 's/^.*\=//' | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" | sed s'/\/$//')
     public_ip=$(sshpass -p r00tme ssh $ssh_options root@${installer_ip} \
         "ssh ${controller_ip} 'source openrc; keystone endpoint-list'" \
-        | grep $admin_ip | cut -d ' ' -f 12)
+        | grep $admin_ip | sed 's/ /\n/g' | grep ^http | head -1)
         #| grep http | head -1 | cut -d '|' -f 4 | sed 's/v1\/.*/v1\//' | sed 's/ //g') &> /dev/null
     #NOTE: this is super ugly sed 's/v1\/.*/v1\//'OS_AUTH_URL
     # but sometimes the output of endpoint-list is like this: http://172.30.9.70:8004/v1/%(tenant_id)s