Try using project-wide parameters in jjb 22/522/3
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>
Tue, 12 May 2015 15:08:48 +0000 (17:08 +0200)
committerFatih Degirmenci <fatih.degirmenci@ericsson.com>
Tue, 12 May 2015 15:27:46 +0000 (17:27 +0200)
JIRA: OCTO-47

Change-Id: I101af22cc1af44f32840fd00a06fa186ab757d0b
Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
jjb/genesis/genesis-foreman.yml

index 59b2d39..e8a668a 100644 (file)
@@ -3,6 +3,8 @@
 
     name: genesis-foreman
 
+    project: 'genesis'
+
     installer:
         - foreman
 
@@ -10,6 +12,7 @@
         - 'genesis-{installer}-verify'
         - 'genesis-{installer}-merge'
         - 'genesis-{installer}-daily-{stream}'
+        - 'genesis-{installer}-build'
         - 'genesis-{installer}-deploy'
 
     # stream:    branch with - in place of / (eg. stable-helium)
@@ -18,7 +21,6 @@
         - master:
             branch: 'master'
 
-    project: 'genesis'
 
 ########################
 # job templates
@@ -45,6 +47,9 @@
         - string:
             name: BUILD_DIRECTORY
             default: $WORKSPACE/build_output
+        - string:
+            name: CACHE_DIRECTORY
+            default: '$HOME/opnfv/cache/genesis-{installer}'
         - string:
             name: GIT_BASE
             default: https://gerrit.opnfv.org/gerrit/genesis
         - string:
             name: BUILD_DIRECTORY
             default: $WORKSPACE/build_output
+        - string:
+            name: CACHE_DIRECTORY
+            default: '$HOME/opnfv/cache/genesis-{installer}'
         - string:
             name: GIT_BASE
             default: https://gerrit.opnfv.org/gerrit/genesis
             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}'
         - string:
             name: GS_URL
             default: 'artifacts.opnfv.org/genesis/{installer}'
         - 'daily-master'
 
 
+- job-template:
+    name: 'genesis-{installer}-build'
+
+    project-type: freestyle
+
+    node: ericsson-build
+
+    logrotate:
+        daysToKeep: 30
+        numToKeep: 10
+        artifactDaysToKeep: -1
+        artifactNumToKeep: -1
+
+    parameters:
+        - genesis-parameters
+        - string:
+            name: EXTRA_PARAM
+            default: 'extra_value'
+            description: "Installer to use."
+        - string:
+            name: INSTALLER
+            default: 'overriden_value'
+            description: "Installer to use."
+
+    scm:
+        - git:
+            skip-tag: true
+            url: $GIT_BASE
+            branches:
+                - $GERRIT_BRANCH
+            refspec: $GERRIT_REFSPEC
+
+    builders:
+        - 'build'
+
 - job-template:
     name: 'genesis-{installer}-deploy'
 
             description: "Refspec to retrieve."
         - string:
             name: GS_URL
-            default: 'artifacts.opnfv.org/genesis/fuel'
+            default: 'artifacts.opnfv.org/genesis/{installer}'
             description: "URL to Google Storage."
         - string:
             name: BUILD_DIRECTORY
     builders:
         - 'deploy'
 
+########################
+# parameter macros
+########################
+- parameter:
+    name: genesis-parameters
+    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}'
+        - string:
+            name: GIT_BASE
+            default: https://gerrit.opnfv.org/gerrit/genesis
+            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: GERRIT_BRANCH
+            default: origin/master
+            description: "Branch to build, deploy and test."
+        - string:
+            name: GERRIT_REFSPEC
+            default: refs/heads/master
+            description: "Refspec to retrieve."
+        - string:
+            name: GS_URL
+            default: 'artifacts.opnfv.org/genesis/{installer}'
+            description: "URL to Google Storage."
+
 ########################
 # builder macros
 ########################
             /bin/rm -rf $WORKSPACE/opnfv.iso
 
 - builder:
-    name: 'deploy'
+    name: 'build'
     builders:
         - shell: |
             #!/bin/bash
             set -o pipefail
             set -x
 
-            cd $WORKSPACE
+            echo "Hello World"
+            env
+
+- builder:
+    name: 'deploy'
+    builders:
+        - shell: |
+            #!/bin/bash
+            set -o errexit
+            set -o nounset
+            set -o pipefail
+            set -x
 
             # cleanup first
             sudo $WORKSPACE/$INSTALLER/ci/clean.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml