Merge "Ensure that only ASCII characters make it into the jobs JIRA:OCTO-105"
authorAric Gardner <agardner@linuxfoundation.org>
Thu, 9 Jul 2015 16:15:01 +0000 (16:15 +0000)
committerGerrit Code Review <gerrit@172.30.200.206>
Thu, 9 Jul 2015 16:15:01 +0000 (16:15 +0000)
13 files changed:
jjb/doctor/doctor.yml
jjb/doctor/docu-build.sh
jjb/doctor/docu-verify.sh [deleted file]
jjb/functest/functest.yml
jjb/genesis/genesis-compass.yml [changed mode: 0644->0755]
jjb/genesis/genesis-fuel.yml
jjb/octopus/octopus.yml
jjb/promise/docu-build.sh
jjb/promise/docu-verify.sh [deleted file]
jjb/promise/promise.yml
jjb/releng/releng.yml [new file with mode: 0644]
jjb/yardstick/yardstick.yml
utils/fetch_os_creds.sh [new file with mode: 0755]

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 7a51829..0d77606 100644 (file)
@@ -3,10 +3,19 @@
 ###################################
 - project:
     name: functest
-
     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'
+        - 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
@@ -64,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:
         - git-scm:
         artifactNumToKeep: -1
 
     builders:
+        - 'functest-fetch-os-creds'
         - 'functest-all'
         - 'functest-store-results'
         - 'functest-cleanup'
             default: '{gs-pathname}'
             description: "Version directory where the opnfv documents will be stored in gs repository"
 
+- parameter:
+    name: orange-build
+    parameters:
+        - string:
+            name: GIT_BASE
+            default: https://gerrit.opnfv.org/gerrit/$PROJECT
+            description: "Override GIT_BASE"
+
+- parameter:
+    name: opnfv-jump-1
+    parameters:
+        - string:
+            name: GIT_BASE
+            default: ssh://gerrit.opnfv.org:29418/$PROJECT
+            description: "Override GIT_BASE"
+
+- parameter:
+    name: opnfv-jump-2
+    parameters:
+        - string:
+            name: GIT_BASE
+            default: ssh://gerrit.opnfv.org:29418/$PROJECT
+            description: "Override GIT_BASE"
 ########################
 # trigger macros
 ########################
     triggers:
         - pollscm: "H 21 * * *"
 
+########################
+# builder macros
+########################
 # macros
 - builder:
     name: functest-all
 
             # 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
old mode 100644 (file)
new mode 100755 (executable)
index 55f5b75..9065da9
@@ -3,12 +3,13 @@
 
     name: genesis-compass
 
-    installer:
-        - compass
+    installer: 'compass'
+
     jobs:
         - 'genesis-compass-verify'
         - 'genesis-compass-merge'
         - 'genesis-compass-daily-{stream}'
+        - 'genesis-compass-deploy-virtual-{flavor}'
 
     # stream:    branch with - in place of / (eg. stable-helium)
     # branch:    branch (eg. stable/helium)
         - master:
             branch: 'master'
 
+    flavor:
+        - five:
+            conf: 'five'
+            node: 'compass-build-deploy-02'
+        - cluster:
+            conf: 'cluster'
+            node: 'compass-build-deploy-03'
+
+
+
     project: 'genesis'
 
 ########################
         artifactNumToKeep: -1
 
     parameters:
-        - string:
-            name: BUILD_DIRECTORY
-            default: $WORKSPACE/build_output
-        - string:
-            name: GIT_BASE
-            default: https://gerrit.opnfv.org/gerrit/genesis
         - project-parameter:
             project: '{project}'
         - gerrit-parameter:
             branch: 'master'
+        - compass-parameter:
+            installer: '{installer}'
 
     scm:
         - gerrit-trigger-scm:
@@ -85,7 +92,8 @@
 
 
     builders:
-        - 'compass-verify'
+        - 'compass-build'
+        #- 'compass-workspace-cleanup'
 
 - job-template:
     name: 'genesis-compass-merge'
         artifactNumToKeep: 5
 
     parameters:
-        - string:
-            name: BUILD_DIRECTORY
-            default: $WORKSPACE/build_output
-        - string:
-            name: GIT_BASE
-            default: https://gerrit.opnfv.org/gerrit/genesis
         - project-parameter:
             project: '{project}'
         - gerrit-parameter:
             branch: 'master'
-
+        - compass-parameter:
+            installer: '{installer}'
     scm:
         - gerrit-trigger-scm:
             credentials-id: '{ssh-credentials}'
     node: compass-build-deploy-03
 
     parameters:
-        - string:
-            name: BUILD_DIRECTORY
-            default: $WORKSPACE/build_output
-        - string:
-            name: INSTALLER
-            default: 'compass'
-            description: "Installer to use."
-        - string:
-            name: GIT_BASE
-            default: https://gerrit.opnfv.org/gerrit/genesis
-        - string:
-            name: GERRIT_BRANCH
-            default: origin/master
-            description: "Branch to build, deploy and test."
-        - string:
-            name: GERRIT_REFSPEC
-            default: refs/heads/master
-            description: "Refspec to retrieve."
+        - project-parameter:
+            project: '{project}'
+        - compass-parameter:
+            installer: '{installer}'
 
     scm:
-        - git:
-            skip-tag: true
-            url: $GIT_BASE
-            branches:
-                - $GERRIT_BRANCH
-            refspec: $GERRIT_REFSPEC
+        - git-scm:
+            credentials-id: '{ssh-credentials}'
+            refspec: ''
+            branch: '{branch}'
 
     triggers:
         - pollscm: '@midnight'
         artifactNumToKeep: -1
 
     builders:
-        - 'compass-daily-master'
+        #- 'compass-build'
+        #- 'compass-upload-artifact'
+        #- 'compass-workspace-cleanup'
+        - shell: |
+            echo "Hello world!"
+            echo "genesis-compass-deploy-virtual job will be triggered!"
+
+    publishers:
+        - trigger:
+            project: 'genesis-compass-deploy-virtual-five'
+            threshold: SUCCESS
+        - trigger:
+            project: 'genesis-compass-deploy-virtual-cluster'
+            threshold: SUCCESS
+
+
+- job-template:
+    name: 'genesis-compass-deploy-virtual-{flavor}'
+
+    project-type: freestyle
+
+    disabled: false
+
+    node: '{node}'
+
+    parameters:
+        - project-parameter:
+            project: '{project}'
+        - compass-parameter:
+            installer: '{installer}'
+        - string:
+            name: FLAVOR_CONF
+            default: '{conf}'
+            description: ""
+
+    triggers:
+        - pollscm: "H/2 * * * *"
+
+    logrotate:
+        daysToKeep: 30
+        numToKeep: 10
+        artifactDaysToKeep: -1
+        artifactNumToKeep: -1
+
+    builders:
+        - 'compass-ci-preclean-workspace'
+        - 'compass-deploy-virtual-flavor'
+
+########################
+# parameter macros
+########################
+- parameter:
+    name: compass-parameter
+    parameters:
+        - string:
+            name: INSTALLER
+            default: '{installer}'
+            description: "Installer to use."
+        - string:
+            name: BUILD_DIRECTORY
+            default: $WORKSPACE/build_output
+            description: "Directory where the build artifact will be located upon the completion of the build."
+        - string:
+            name: CACHE_DIRECTORY
+            default: $HOME/opnfv/cache/genesis-$INSTALLER
+            description: "Directory where the cache to be used during the build is located."
+        - 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."
+        - string:
+            name: GS_URL
+            default: artifacts.opnfv.org/$PROJECT/$INSTALLER
+            description: "URL to Google Storage."
+        - string:
+            name: INTERNAL_REPO
+            default: "root@192.168.121.12:~/kun/artifacts"
+            description: "Artifact Repository"
+########################
+# builder macros
+########################
+
 
 - builder:
-    name: compass-verify
+    name: compass-merge
     builders:
         - shell: |
             #!/bin/bash
             echo "Hello World!"
 
+
 - builder:
-    name: compass-merge
+    name: 'compass-build'
     builders:
         - shell: |
             #!/bin/bash
-            echo "Hello World!"
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+
+            # log info to console
+            echo "Hello world!"
 
 - builder:
-    name: compass-daily-master
+    name: 'compass-deploy'
     builders:
         - shell: |
             #!/bin/bash
-            echo "Hello World!"
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+
+            # log info to console
+            echo "Hello world!"
+
+- builder:
+    name: 'compass-deploy-virtual-flavor'
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+
+            # log info to console
+            echo "Starting the deployment on virtual environment using $INSTALLER. This could take some time..."
+            echo "--------------------------------------------------------"
+            echo
+
+            cd $WORKSPACE/compass
+            ./ci/deploy.sh $FLAVOR_CONF
+            # ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
+
+            echo
+            echo "--------------------------------------------------------"
+            echo "Done!"
+
+- builder:
+    name: 'compass-upload-artifact'
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+
+            # log info to console
+            echo "Uploading the $INSTALLER artifact. This could take some time..."
+            echo "--------------------------------------------------------"
+            echo
+
+            # source the opnfv.properties to get ARTIFACT_VERSION
+            source $WORKSPACE/opnfv.properties
+
+            # upload artifact and additional files to google storage
+            gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
+            gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
+            gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
+
+            echo
+            echo "--------------------------------------------------------"
+            echo "Done!"
+
+- builder:
+    name: 'compass-download-artifact'
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+
+            # log info to console
+            echo "Downloading the $INSTALLER artifact. This could take some time..."
+            echo "--------------------------------------------------------"
+            echo
+
+            # get the latest.properties file in order to get info regarding latest artifact
+            curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
+
+            # check if we got the file
+            [[ -f latest.properties ]] || exit 1
+
+            # source the file so we get OPNFV vars
+            source latest.properties
+
+            # download the file
+            curl -s -o $WORKSPACE/opnfv.iso http://$OPNFV_ARTIFACT_URL > gsutil.iso.log 2>&1
+
+            # list the file
+            ls -al $WORKSPACE/opnfv.iso
+
+            echo
+            echo "--------------------------------------------------------"
+            echo "Done!"
+
+- builder:
+    name: 'compass-workspace-cleanup'
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+
+            # delete everything that is in $WORKSPACE
+            /bin/rm -rf $WORKSPACE
+
+- builder:
+    name: 'compass-ci-preclean-workspace'
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+
+            cd $WORKSPACE/..
+            sudo rm $WORKSPACE -rf
+            git clone $GIT_BASE  $WORKSPACE
+
index 1b163a0..b4b428b 100644 (file)
 
     builders:
         - 'fuel-download-artifact'
-        - 'fuel-deploy'
+        - 'fuel-deploy-{stream}'
 
 - job-template:
     name: 'genesis-fuel-deploy-virtual-master'
             echo "Done!"
 
 - builder:
-    name: 'fuel-deploy'
+    name: 'fuel-deploy-master'
     builders:
         - shell: |
             #!/bin/bash
             echo "--------------------------------------------------------"
             echo "Done!"
 
+- builder:
+    name: 'fuel-deploy-stable-arno'
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+
+            # source the file so we get OPNFV vars
+            source latest.properties
+
+            # echo the info about artifact that is used during the deployment
+            echo "Using $(echo $OPNFV_ARTIFACT_URL | cut -d'/' -f4) for deployment"
+
+            # create TMPDIR if it doesn't exist
+            export TMPDIR=$HOME/tmp/$JOB_NAME
+            [[ -d $TMPDIR ]] || mkdir -p $TMPDIR
+
+            # change permissions down to TMPDIR
+            chmod a+x $HOME
+            chmod a+x $TMPDIR
+
+            # log info to console
+            echo "Starting the deployment using $INSTALLER. This could take some time..."
+            echo "--------------------------------------------------------"
+            echo
+
+            # start the deployment
+            echo "Issuing command"
+            echo "sudo $WORKSPACE/fuel/ci/deploy.sh $WORKSPACE/opnfv.iso $WORKSPACE/fuel/deploy/baremetal/conf/linux_foundation_lab/ha/dea.yaml $WORKSPACE/fuel/deploy/baremetal/conf/linux_foundation_lab/ha/dha.yaml -s $TMPDIR"
+
+            sudo $WORKSPACE/fuel/ci/deploy.sh $WORKSPACE/opnfv.iso $WORKSPACE/fuel/deploy/baremetal/conf/linux_foundation_lab/ha/dea.yaml $WORKSPACE/fuel/deploy/baremetal/conf/linux_foundation_lab/ha/dha.yaml -s $TMPDIR
+            echo
+            echo "--------------------------------------------------------"
+            echo "Done!"
+
 - builder:
     name: 'fuel-deploy-virtual'
     builders:
 - trigger:
     name: 'fuel-master'
     triggers:
-        - pollscm: '0 21 * * *'
+        - timed: '0 21 * * *'
 
 - trigger:
     name: 'fuel-stable-arno'
     triggers:
-        - pollscm: '0 3 * * *'
+        - timed: '0 3 * * *'
index e44e5ea..e11ccc5 100644 (file)
@@ -6,7 +6,7 @@
     jobs:
         - 'octopus-test'
         - 'octopus-daily-{stream}'
-        - 'octopus-merge'
+        - 'octopus-merge-{stream}'
         - 'octopus-verify-{stream}'
 
     # stream:    branch with - in place of / (eg. stable-arno)
             !include-raw ../opnfvdocs/docu-build.sh
 
 - job-template:
-    name: 'octopus-merge'
+    name: 'octopus-merge-{stream}'
 
     node: master
 
         - project-parameter:
             project: '{project}'
         - gerrit-parameter:
-            branch: 'master'
+            branch: '{branch}'
 
     scm:
         - gerrit-trigger-scm:
                 project-pattern: 'octopus'
                 branches:
                     - branch-compare-type: 'ANT'
-                      branch-pattern: '**/master'
+                      branch-pattern: '**/{branch}'
 
     builders:
         - shell:
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
-
diff --git a/jjb/releng/releng.yml b/jjb/releng/releng.yml
new file mode 100644 (file)
index 0000000..bb64f6a
--- /dev/null
@@ -0,0 +1,76 @@
+########################
+# Job configuration for releng
+########################
+- project:
+
+    name: releng
+
+    project: 'releng'
+
+    jobs:
+        - 'releng-verify'
+
+    # stream:    branch with - in place of / (eg. stable-arno)
+    # branch:    branch (eg. stable/arno)
+    stream:
+        - master:
+            branch: 'master'
+
+########################
+# job templates
+########################
+
+- job-template:
+    name: 'releng-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: '{project}'
+                branches:
+                  - branch-compare-type: 'ANT'
+                    branch-pattern: '**/master'
+                file-paths:
+                  - compare-type: ANT
+                    pattern: 'utils/**'
+
+    builders:
+       - shell: |
+            echo "Hello world from releng"
index 532aca7..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
 
             # set virtualenv
             echo "Yardstick: execute ping scenario"
-            yardstick -v -d samples/ping.yaml
+            yardstick task start samples/ping.yaml -v -d
 
             # cleanup
             echo "Yardstick: cleanup"
 
             # 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
diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh
new file mode 100755 (executable)
index 0000000..cd53dac
--- /dev/null
@@ -0,0 +1,143 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# jose.lausuch@ericsson.com
+# 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
+##############################################################################
+
+
+usage() {
+    echo "usage: $0 -d <destination> -i <installer_type> -a <installer_ip>" >&2
+}
+
+info ()  {
+    logger -s -t "fetch_os_creds.info" "$*"
+}
+
+
+error () {
+    logger -s -t "fetch_os_creds.error" "$*"
+    exit 1
+}
+
+
+verify_connectivity() {
+    local ip=$1
+    info "Verifying connectivity to $ip..."
+    for i in $(seq 0 10); do
+        if ping -c 1 -W 1 $ip > /dev/null; then
+            info "$ip is reachable!"
+            return 0
+        fi
+        sleep 1
+    done
+    error "Can not talk to $ip."
+}
+
+
+
+#Get options
+while getopts ":d:i:a:h:" optchar; do
+    case "${optchar}" in
+        d) dest_path=${OPTARG} ;;
+        i) installer_type=${OPTARG} ;;
+        a) installer_ip=${OPTARG} ;;
+        *) echo "Non-option argument: '-${OPTARG}'" >&2
+           usage
+           exit 2
+           ;;
+    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"
+else
+    # Check if we can create the file (e.g. path is correct)
+    touch $dest_path || error "Cannot create the file specified. Check that the path is correct and run the script again."
+fi
+
+
+ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+
+# Start fetching the files
+if [ "$installer_type" == "fuel" ]; then
+    #ip_fuel="10.20.0.2"
+    verify_connectivity $installer_ip
+
+    # Check if controller is alive (online='True')
+    controller_ip=$(sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+        'fuel node | grep controller | grep True | awk "{print \$10}" | tail -1') &> /dev/null
+
+    if [ -z $controller_ip ]; then
+        error "The controller $controller_ip is not up. Please check that the POD is correctly deployed."
+    fi
+
+    info "Fetching rc file from controller $controller_ip..."
+    sshpass -p r00tme ssh 2>/dev/null $ssh_options root@${installer_ip} \
+        "scp $ssh_options ${controller_ip}:/root/openrc ." &> /dev/null
+    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'/\/$//')
+    public_ip=$(sshpass -p r00tme ssh $ssh_options root@${installer_ip} \
+        "ssh ${controller_ip} 'source openrc; keystone endpoint-list'" \
+        | 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
+
+
+elif [ "$installer_type" == "foreman" ]; then
+    #ip_foreman="172.30.10.73"
+    controller="oscontroller1.opnfv.com"
+    verify_connectivity $installer_ip
+
+    # Check if controller is alive (here is more difficult to get the ip from a command like "fuel node")
+    sshpass -p vagrant ssh $ssh_options root@${installer_ip} \
+        "sshpass -p Op3nStack ssh $ssh_options root@${controller} 'ls'" &> /dev/null
+    if [ $? -ne 0 ]; then
+        error "The controller ${controller} is not up. Please check that the POD is correctly deployed."
+    fi
+
+    info "Fetching openrc from a Foreman Controller '${controller}'..."
+    sshpass -p vagrant ssh $ssh_options root@${installer_ip} \
+        "sshpass -p Op3nStack scp $ssh_options root@${controller}:~/keystonerc_admin ." &> /dev/null
+    sshpass -p vagrant scp $ssh_options root@${installer_ip}:~/keystonerc_admin $dest_path &> /dev/null
+
+    #This file contains the mgmt keystone API, we need the public one for our rc file
+    public_ip=$(sshpass -p vagrant ssh $ssh_options root@${installer_ip} \
+        "sshpass -p Op3nStack ssh $ssh_options root@${controller} \
+        'source keystonerc_admin;keystone endpoint-list'" \
+        | grep http | head -1 | cut -d '|' -f 4 | sed 's/ //g') &> /dev/null
+
+else
+    error "Installer $installer is not supported by this script"
+fi
+
+
+
+if [ "$public_ip" == "" ]; then
+    error "Cannot retrieve the public IP from keystone"
+fi
+
+info "Keystone public IP is $public_ip"
+sed -i  "/OS_AUTH_URL/c\export OS_AUTH_URL=\'$public_ip'" $dest_path
+
+echo "-------- Credentials: --------"
+cat $dest_path
+
+exit 0