Add Maven Settings file support to templates 96/12396/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 31 Oct 2014 05:29:57 +0000 (01:29 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 31 Oct 2014 16:12:54 +0000 (12:12 -0400)
- Use global defaults to id-map all the Config File Provider settings
  files
- Refactor the role of releng-templates.yaml to be a starting template
  that projects must copy and modify

Change-Id: Ic55e7b3ae655af52a60b8598af368d62a800b90e
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
README.md
jjb/job.yaml.example [moved from jjb/releng-templates.yaml with 50% similarity]
jjb/job.yaml.template [new file with mode: 0644]
jjb/releng-defaults.yaml

index 7ba0c1b62401248bfd832999637820fad37772b9..68298d68a6b6ddcfe8edbb576c2b77e2667780b2 100644 (file)
--- a/README.md
+++ b/README.md
 The ODL Releng project provides 3 job templates which can be used to
 define basic jobs.
 
+Note: The templates below depend on a modified JJB version to add
+      support for Config File Provider module in the Maven Project
+      module for JJB. This custom version of JJB can be found at:
+      https://github.com/zxiiro/jenkins-job-builder/tree/support-config-file-provider
+
 == Verify Job Template
 
 The Verify job template creates a Gerrit Trigger job that will trigger
@@ -36,80 +41,22 @@ Daily basis and also Submits Sonar reports.
 
 == Basic Job Configuration
 
-To create a jobs based on the above templates you can use the following
-example which will create 6 jobs (verify, merge, and daily jobs for both
-master and stable/helium branch).
+To create a jobs based on the above templates you can use the example
+template which will create 6 jobs (verify, merge, and daily jobs for both
+master and stable/helium branch). Begin by using job.yaml.template as a
+starting point. You can also look at job.yaml.example to see an example
+of a job configuration that is filled out.
 
 Before starting create a sub-directory under jjb/ for your project
 configuration files.
 
-    1. mkdir jjb/PROJECT                # For example controller
-    2. touch jjb/PROJECT/PROJECT.yaml
-    3. Add your job configuration to jjb/PROJECT/PROJECT.yaml
+    1. mkdir jjb/PROJECT                # For example aaa
+    2. cp jjb/job.yaml.template jjb/PROJECT/PROJECT.yaml
+    3. Modify jjb/PROJECT/PROJECT.yaml and replace the following keywords
+        - PROJECT: With your project name (eg. aaa)
+        - MAVEN_GOALS: With your job's Maven Goals necessary to build
+        - MAVEN_OPTS: With your job's Maven Options necessary to build
 
 If all your project requires is the basic verify, merge, and
-daily jobs then the following template should be all you need to
-configure for your job.
-
-Replace:
-
-PROJECT:           Project Name
-PROJECT_SCM_URL:   URL to Gerrit repo
-PROJECT_MVN_GOALS: Maven Goals
-PROJECT_MVN_OPTS:  Maven Options
-
-########### EXAMPLE ###########
-
-- project:
-    name: PROJECT
-    jobs:
-        - '{name}-verify-{stream}'
-        - '{name}-merge-{stream}'
-        - '{name}-daily-{stream}'
-
-    # SCM
-    scm-url: PROJECT_SCM_URL
-    stream:
-        - master:
-            branch: master
-        - stable-helium:
-            branch: stable/helium
-
-    # Maven
-    mvn-goals: 'PROJECT_MVN_GOALS'
-    mvn-opts: 'PROJECT_MVN_OPTS'
-
-    # Email Publisher
-    email-prefix: '[PROJECT]'
-
-########### END EXAMPLE ###########
-
-
-
-Sample data:
-
-########### SAMPLE ###########
-
-- project:
-    name: aaa
-    jobs:
-        - '{name}-verify-{stream}'
-        - '{name}-merge-{stream}'
-        - '{name}-daily-{stream}'
-
-    # SCM
-    scm-url: ssh://jenkins-releng@git.opendaylight.org:29418/aaa.git
-    stream:
-        - master:
-            branch: master
-        - stable-helium:
-            branch: stable/helium
-
-    # Maven
-    mvn-goals: '-Dmaven.repo.local=$WORKSPACE/.m2repo -Dorg.ops4j.pax.url.mvn.localRepository=$WORKSPACE/.m2repo clean install'
-    mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'
-
-    # Email Publisher
-    email-prefix: '[aaa]'
-
-########### END SAMPLE ###########
+daily jobs then using the job.template should be all you need to
+configure for your jobs.
similarity index 50%
rename from jjb/releng-templates.yaml
rename to jjb/job.yaml.example
index 2524680769b6b9428828ecaa3dd99e1e29ac4fa5..4f45eac96e9e9b4a31c426a5752bdb1a63268d9e 100644 (file)
@@ -1,24 +1,35 @@
 # ODL Releng build templates
+- project:
+    name: aaa
+    jobs:
+        - 'aaa-verify-{stream}'
+        - 'aaa-merge-{stream}'
+        - 'aaa-daily-{stream}'
+
+    # stream:    branch with - in place of / (eg. stable-helium)
+    # branch:    branch (eg. stable/helium)
+    stream:
+        - master:
+            branch: 'master'
+        - stable-helium:
+            branch: 'stable/helium'
+
+
+# For the Job templates below replace instances of:
+# PROJECT with your project name (eg. controller)
+# MAVEN_GOALS with your maven goals to build
+# MAVEN_OPTS with your maven options to build
 
 - job-template:
-    name: '{name}-verify-{stream}'
+    name: 'aaa-verify-{stream}'
 
     # Job template for ODL verify jobs
     #
     # The purpose of this job template is to setup a ODL verify job
     #
     # Required Variables:
-    #     name:      project name (eg. controller)
-    #     stream:    branch with - in place of / (eg. stable/helium)
+    #     stream:    branch with - in place of / (eg. stable-helium)
     #     branch:    branch (eg. stable/helium)
-    #     mvn-goals: Maven Goals parameter to pass to the builder (eg. clean install)
-    #     mvn-opts:  MAVEN_OPTS paramter to pass to the builder (eg. -Xmx1024m)
-    #
-    # Optional Variables:
-    #     build-days-to-keep:           Number of days to keep builds
-    #     build-num-to-keep:            Number of builds to keep
-    #     build-artifact-days-to-keep:  Number of artifacts from builds to keep
-    #     build-artifact-num-to-keep:   Number of builds to keep with artifacts
 
     project-type: maven
 
@@ -35,7 +46,7 @@
     scm:
         - gerrit-trigger-scm:
             credentials-id: '{ssh-credentials}'
-            scm-url: '{scm-url}'
+            scm-url: 'ssh://jenkins-releng@git.opendaylight.org:29418/aaa.git'
             refspec: '$GERRIT_REFSPEC'
 
     wrappers:
 
     triggers:
         - gerrit-trigger-patch-submitted:
-            name: '{name}'
+            name: 'aaa'
             branch: '{branch}'
 
     maven:
-        maven-name: Maven 3.0.4
-        root-pom: pom.xml
-        goals: '{mvn-goals}'
-        maven-opts: '{mvn-opts}'
+        maven-name: '{mvn30}'
+        root-pom: 'pom.xml'
+        goals: 'clean verify'
+        maven-opts: '-Xmx1024m'
+        settings: '{aaa-settings}'
+        global-settings: '{odl-global-settings}'
 
     publishers:
         - email-notification:
-            email-prefix: '{email-prefix}'
+            email-prefix: '[aaa]'
 
 - job-template:
-    name: '{name}-merge-{stream}'
+    name: 'aaa-merge-{stream}'
 
     # Job template for ODL merge jobs
     #
     # The purpose of this job template is to setup a ODL merge job
+    # and deploy artifacts to Nexus.
     #
     # Required Variables:
-    #     name:      project name (eg. controller)
-    #     stream:    branch with - in place of / (eg. stable/helium)
+    #     stream:    branch with - in place of / (eg. stable-helium)
     #     branch:    branch (eg. stable/helium)
-    #     mvn-goals: Maven Goals parameter to pass to the builder (eg. clean install)
-    #     mvn-opts:  MAVEN_OPTS paramter to pass to the builder (eg. -Xmx1024m)
-    #
-    # Optional Variables:
-    #     build-days-to-keep:           Number of days to keep builds
-    #     build-num-to-keep:            Number of builds to keep
-    #     build-artifact-days-to-keep:  Number of artifacts from builds to keep
-    #     build-artifact-num-to-keep:   Number of builds to keep with artifacts
 
     project-type: maven
 
@@ -88,7 +93,7 @@
     scm:
         - gerrit-trigger-scm:
             credentials-id: '{ssh-credentials}'
-            scm-url: '{scm-url}'
+            scm-url: 'ssh://jenkins-releng@git.opendaylight.org:29418/aaa.git'
             refspec: ''
 
     wrappers:
 
     triggers:
         - gerrit-trigger-patch-merged:
-            name: '{name}'
+            name: 'aaa'
             branch: '{branch}'
 
     maven:
-        maven-name: Maven 3.0.4
-        root-pom: pom.xml
-        goals: '{mvn-goals}'
-        maven-opts: '{mvn-opts}'
+        maven-name: '{mvn30}'
+        root-pom: 'pom.xml'
+        goals: 'clean verify'
+        maven-opts: '-Xmx1024m'
+        settings: '{aaa-settings}'
+        global-settings: '{odl-global-settings}'
 
     publishers:
         - email-notification:
-            email-prefix: '{email-prefix}'
+            email-prefix: '[aaa]'
         - maven-deploy:
             id:
             url:
             deploy-unstable: false
 
 - job-template:
-    name: '{name}-daily-{stream}'
+    name: 'aaa-daily-{stream}'
 
     # Job template for daily builders
     #
-    # The purpose of this job template is to setup a daily/nightly builder and pushes to Sonar analysis.
+    # The purpose of this job template is to setup a daily/nightly
+    # builder and pushes to Sonar analysis.
     #
     # Required Variables:
-    #     name:      project name (eg. controller)
-    #     stream:    branch with - in place of / (eg. stable/helium)
+    #     stream:    branch with - in place of / (eg. stable-helium)
     #     branch:    branch (eg. stable/helium)
-    #     mvn-goals: Maven Goals parameter to pass to the builder (eg. clean install)
-    #     mvn-opts:  MAVEN_OPTS paramter to pass to the builder (eg. -Xmx1024m)
-    #
-    # Optional Variables:
-    #     build-days-to-keep:           Number of days to keep builds
-    #     build-num-to-keep:            Number of builds to keep
-    #     build-artifact-days-to-keep:  Number of artifacts from builds to keep
-    #     build-artifact-num-to-keep:   Number of builds to keep with artifacts
 
     project-type: maven
 
     scm:
         - git-scm:
             credentials-id: '{ssh-credentials}'
-            scm-url: '{scm-url}'
+            scm-url: 'ssh://jenkins-releng@git.opendaylight.org:29418/aaa.git'
             refspec: ''
             branch: '{branch}'
 
         - timed: 'H H * * *'
 
     maven:
-        maven-name: Maven 3.0.4
-        root-pom: pom.xml
-        goals: '{mvn-goals}'
-        maven-opts: '{mvn-opts}'
+        maven-name: '{mvn30}'
+        root-pom: 'pom.xml'
+        goals: 'clean verify'
+        maven-opts: '-Xmx1024m'
+        settings: '{aaa-settings}'
+        global-settings: '{odl-global-settings}'
 
     publishers:
         - email-notification:
-            email-prefix: '{email-prefix}'
+            email-prefix: '[aaa]'
         - sonar:
             branch: 'origin/{branch}'
             language: 'java'
-            maven-opts: '{mvn-opts}'
+            maven-opts: '-Xmx1024m'
diff --git a/jjb/job.yaml.template b/jjb/job.yaml.template
new file mode 100644 (file)
index 0000000..5b792fd
--- /dev/null
@@ -0,0 +1,173 @@
+# ODL Releng build templates
+- project:
+    name: PROJECT
+    jobs:
+        - 'PROJECT-verify-{stream}'
+        - 'PROJECT-merge-{stream}'
+        - 'PROJECT-daily-{stream}'
+
+    # stream:    branch with - in place of / (eg. stable-helium)
+    # branch:    branch (eg. stable/helium)
+    stream:
+        - master:
+            branch: 'master'
+        - stable-helium:
+            branch: 'stable/helium'
+
+
+# For the Job templates below replace instances of:
+# PROJECT with your project name (eg. controller)
+# MAVEN_GOALS with your maven goals to build
+# MAVEN_OPTS with your maven options to build
+
+- job-template:
+    name: 'PROJECT-verify-{stream}'
+
+    # Job template for ODL verify jobs
+    #
+    # The purpose of this job template is to setup a ODL verify job
+    #
+    # Required Variables:
+    #     stream:    branch with - in place of / (eg. stable-helium)
+    #     branch:    branch (eg. stable/helium)
+
+    project-type: maven
+
+    logrotate:
+        daysToKeep: '{build-days-to-keep}'
+        numToKeep: '{build-num-to-keep}'
+        artifactDaysToKeep: '{build-artifact-days-to-keep}'
+        artifactNumToKeep: '{build-artifact-num-to-keep}'
+
+    parameters:
+        - gerrit-parameter:
+            branch: '{branch}'
+
+    scm:
+        - gerrit-trigger-scm:
+            credentials-id: '{ssh-credentials}'
+            scm-url: 'ssh://jenkins-releng@git.opendaylight.org:29418/PROJECT.git'
+            refspec: '$GERRIT_REFSPEC'
+
+    wrappers:
+        - ssh-agent-credentials:
+            user: '{ssh-credentials}'
+
+    triggers:
+        - gerrit-trigger-patch-submitted:
+            name: 'PROJECT'
+            branch: '{branch}'
+
+    maven:
+        maven-name: '{mvn30}'
+        root-pom: 'pom.xml'
+        goals: 'MAVEN_GOALS'
+        maven-opts: 'MAVEN_OPTS'
+        settings: '{PROJECT-settings}'
+        global-settings: '{odl-global-settings}'
+
+    publishers:
+        - email-notification:
+            email-prefix: '[PROJECT]'
+
+- job-template:
+    name: 'PROJECT-merge-{stream}'
+
+    # Job template for ODL merge jobs
+    #
+    # The purpose of this job template is to setup a ODL merge job
+    # and deploy artifacts to Nexus.
+    #
+    # Required Variables:
+    #     stream:    branch with - in place of / (eg. stable-helium)
+    #     branch:    branch (eg. stable/helium)
+
+    project-type: maven
+
+    logrotate:
+        daysToKeep: '{build-days-to-keep}'
+        numToKeep: '{build-num-to-keep}'
+        artifactDaysToKeep: '{build-artifact-days-to-keep}'
+        artifactNumToKeep: '{build-artifact-num-to-keep}'
+
+    scm:
+        - gerrit-trigger-scm:
+            credentials-id: '{ssh-credentials}'
+            scm-url: 'ssh://jenkins-releng@git.opendaylight.org:29418/PROJECT.git'
+            refspec: ''
+
+    wrappers:
+        - ssh-agent-credentials:
+            user: '{ssh-credentials}'
+
+    triggers:
+        - gerrit-trigger-patch-merged:
+            name: 'PROJECT'
+            branch: '{branch}'
+
+    maven:
+        maven-name: '{mvn30}'
+        root-pom: 'pom.xml'
+        goals: 'MAVEN_GOALS'
+        maven-opts: 'MAVEN_OPTS'
+        settings: '{PROJECT-settings}'
+        global-settings: '{odl-global-settings}'
+
+    publishers:
+        - email-notification:
+            email-prefix: '[PROJECT]'
+        - maven-deploy:
+            id:
+            url:
+            unique-version: true
+            deploy-unstable: false
+
+- job-template:
+    name: 'PROJECT-daily-{stream}'
+
+    # Job template for daily builders
+    #
+    # The purpose of this job template is to setup a daily/nightly
+    # builder and pushes to Sonar analysis.
+    #
+    # Required Variables:
+    #     stream:    branch with - in place of / (eg. stable-helium)
+    #     branch:    branch (eg. stable/helium)
+
+    project-type: maven
+
+    logrotate:
+        daysToKeep: '{build-days-to-keep}'
+        numToKeep: '{build-num-to-keep}'
+        artifactDaysToKeep: '{build-artifact-days-to-keep}'
+        artifactNumToKeep: '{build-artifact-num-to-keep}'
+
+    scm:
+        - git-scm:
+            credentials-id: '{ssh-credentials}'
+            scm-url: 'ssh://jenkins-releng@git.opendaylight.org:29418/PROJECT.git'
+            refspec: ''
+            branch: '{branch}'
+
+    wrappers:
+        - ssh-agent-credentials:
+            user: '{ssh-credentials}'
+
+    triggers:
+        - timed: 'H H * * *'
+
+    maven:
+        maven-name: '{mvn30}'
+        root-pom: 'pom.xml'
+        goals: 'MAVEN_GOALS'
+        maven-opts: 'MAVEN_OPTS'
+        settings: '{PROJECT-settings}'
+        global-settings: '{odl-global-settings}'
+
+    publishers:
+        - email-notification:
+            email-prefix: '[PROJECT]'
+        - sonar:
+            branch: 'origin/{branch}'
+            language: 'java'
+            maven-opts: 'MAVEN_OPTS'
index 8b45d5aeb09a7868c11d2ff530b9036432b75d4f..35f4e35cbfd6f350cb7e19158c5b715e7ef6827a 100644 (file)
@@ -9,3 +9,43 @@
     build-artifact-num-to-keep: 5
 
     ssh-credentials: 'b241a488-1acc-4264-a010-2db3acb07fb0'
+
+    # Maven versions
+    mvn30: 'Maven 3.0.5'
+    mvn31: 'Maven 3.1.1'
+    mvn32: 'Maven 3.2.2'
+
+    # Config File Provider ID mapping
+    odl-global-settings: 'org.jenkinsci.plugins.configfiles.maven.GlobalMavenSettingsConfig1414604295262'
+    aaa-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414692211905'
+    affinity-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414693281960'
+    bgpcep-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414695308787'
+    controller-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414691924293'
+    defense4all-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414701604809'
+    discovery-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414700965421'
+    dlux-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414695221621'
+    docs-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414694664634'
+    groupbasedpolicy-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414694120607'
+    integration-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414693976622'
+    l2switch-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414694505032'
+    lispflowmapping-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414695029968'
+    net-virt-platform-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414695080636'
+    odlautorelease-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414693159071'
+    odlparent-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414701763235'
+    opendove-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414701236099'
+    openflowjava-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414702124278'
+    openflowplugin-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414695396343'
+    opflex-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414694881502'
+    ovsdb-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414701115170'
+    packetcable-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414694813889'
+    plugin2oc-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414694181775'
+    reservation-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414702190363'
+    sdninterfaceapp-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414701835766'
+    sfc-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414694586132'
+    snbi-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414695464045'
+    snmp4sdn-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414701322518'
+    tcpmd5-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414694960925'
+    toolkit-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414701678773'
+    ttp-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414692758626'
+    vtn-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414701949484'
+    yangtools-settings: 'org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig1414695171776'