master and stable/helium branch).
Run the following steps from the repo root to create initial job config.
+This script will produce a file in jjb/<project>/<project>.yaml
+containing your project's base template.
python scripts/jjb-init-project.py <project-name>
# Example
python scripts/jjb-init-project.py aaa
+ # Note: The optional options below require you to remove the 1st line
+ # comment in the produced template file otherwise the auto
+ # update script will overwrite the customization next time it
+ # is run. See Auto Update Job Templates section below for more
+ # details.
+ #
# Optionally pass the following options:
#
# -g / --mvn-goals : With your job's Maven Goals necessary to build
If all your project requires is the basic verify, merge, and
daily jobs then using the job.template should be all you need to
configure for your jobs.
+
+=== Auto Update Job Templates
+
+The first line of the job YAML file produced by the script will contain
+the words # REMOVE THIS LINE IF... leaving this line will allow the
+releng/builder autoupdate script to maintain this file for your project
+should the base template ever change. It is a good idea to leave this
+line if you do not plan to create any complex jobs outside of the
+provided template.
+
+However if your project needs more control over your jobs or if you have
+any additional configuration outside of the standard configuration
+provided by the template then this line should be removed.
+
+It is also possible to take advantage of both the auto updater and creating
+your own jobs. To do this, create a YAML file in your project's sub-directory
+with any name other than <project>.yaml. The auto-update script will only
+search for files with the name <project>.yaml. The normal <project>.yaml
+file can then be left in tact with the "# REMOVE THIS LINE IF..." comment so
+it will be automatically updated.
--- /dev/null
+# ODL Releng build templates
+- project:
+ name: controller
+ jobs:
+ - 'controller-verify-{stream}'
+ - 'controller-merge-{stream}'
+ - 'controller-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: 'controller-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
+ node: dynamic_verify
+
+ 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/controller.git'
+ refspec: '$GERRIT_REFSPEC'
+
+ wrappers:
+ - ssh-agent-credentials:
+ user: '{ssh-credentials}'
+
+ triggers:
+ - gerrit-trigger-patch-submitted:
+ name: 'controller'
+ branch: '{branch}'
+
+ maven:
+ maven-name: '{mvn32}'
+ root-pom: 'pom.xml'
+ goals: '-Dmaven.repo.local=$WORKSPACE/.m2repo -Dorg.ops4j.pax.url.mvn.localRepository=$WORKSPACE/.m2repo clean install'
+ maven-opts: '-Xmx2048m -XX:MaxPermSize=512m'
+ settings: '{controller-settings}'
+ global-settings: '{odl-global-settings}'
+
+ publishers:
+ - email-notification:
+ email-prefix: '[controller]'
+
+- job-template:
+ name: 'controller-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
+ node: dynamic_merge
+
+ 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/controller.git'
+ refspec: ''
+
+ wrappers:
+ - ssh-agent-credentials:
+ user: '{ssh-credentials}'
+
+ triggers:
+ - gerrit-trigger-patch-merged:
+ name: 'controller'
+ branch: '{branch}'
+
+ maven:
+ maven-name: '{mvn32}'
+ root-pom: 'pom.xml'
+ goals: '-Dmaven.repo.local=$WORKSPACE/.m2repo -Dorg.ops4j.pax.url.mvn.localRepository=$WORKSPACE/.m2repo clean install'
+ maven-opts: '-Xmx2048m -XX:MaxPermSize=512m'
+ settings: '{controller-settings}'
+ global-settings: '{odl-global-settings}'
+
+ publishers:
+ - email-notification:
+ email-prefix: '[controller]'
+ - maven-deploy:
+ id: ''
+ url: ''
+ unique-version: true
+ deploy-unstable: false
+
+- job-template:
+ name: 'controller-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
+ node: dynamic_verify
+
+ 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/controller.git'
+ refspec: ''
+ branch: '{branch}'
+
+ wrappers:
+ - ssh-agent-credentials:
+ user: '{ssh-credentials}'
+
+ triggers:
+ - timed: 'H H * * *'
+
+ maven:
+ maven-name: '{mvn32}'
+ root-pom: 'pom.xml'
+ goals: '-Dmaven.repo.local=$WORKSPACE/.m2repo -Dorg.ops4j.pax.url.mvn.localRepository=$WORKSPACE/.m2repo clean install'
+ maven-opts: '-Xmx2048m -XX:MaxPermSize=512m'
+ settings: '{controller-settings}'
+ global-settings: '{odl-global-settings}'
+
+ publishers:
+ - email-notification:
+ email-prefix: '[controller]'
+ - sonar:
+ branch: '{stream}'
+ language: 'java'
+ maven-opts: '-Xmx1024m'
+# REMOVE THIS LINE IF YOU WANT TO CUSTOMIZE ANYTHING BELOW
+# Otherwise this file will be automatically overwritten by the template
+# autobuilder.
+
# ODL Releng build templates
- project:
name: aaa
maven:
maven-name: '{mvn30}'
root-pom: 'pom.xml'
- goals: 'clean verify'
- maven-opts: '-Xmx1024m'
+ goals: '-Dmaven.repo.local=$WORKSPACE/.m2repo -Dorg.ops4j.pax.url.mvn.localRepository=$WORKSPACE/.m2repo clean install'
+ maven-opts: '-Xmx1024m -XX:MaxPermSize=256m'
settings: '{aaa-settings}'
global-settings: '{odl-global-settings}'
maven:
maven-name: '{mvn30}'
root-pom: 'pom.xml'
- goals: 'clean verify'
- maven-opts: '-Xmx1024m'
+ goals: '-Dmaven.repo.local=$WORKSPACE/.m2repo -Dorg.ops4j.pax.url.mvn.localRepository=$WORKSPACE/.m2repo clean install'
+ maven-opts: '-Xmx1024m -XX:MaxPermSize=256m'
settings: '{aaa-settings}'
global-settings: '{odl-global-settings}'
maven:
maven-name: '{mvn30}'
root-pom: 'pom.xml'
- goals: 'clean verify'
- maven-opts: '-Xmx1024m'
+ goals: '-Dmaven.repo.local=$WORKSPACE/.m2repo -Dorg.ops4j.pax.url.mvn.localRepository=$WORKSPACE/.m2repo clean install'
+ maven-opts: '-Xmx1024m -XX:MaxPermSize=256m'
settings: '{aaa-settings}'
global-settings: '{odl-global-settings}'
+# REMOVE THIS LINE IF YOU WANT TO CUSTOMIZE ANYTHING BELOW
+# Otherwise this file will be automatically overwritten by the template
+# autobuilder.
+
# ODL Releng build templates
- project:
name: PROJECT
source /opt/virtualenv/jenkins-job-builder/bin/activate
jenkins-jobs update jjb/
+ # Submit patches for any jobs that can be auto updated
+ python scripts/jjb-autoupdate-project.py
+ git commit -asm "Update automated project templates"
+ git push origin HEAD:refs/for/master
+
publishers:
- email-notification:
email-prefix: '[releng]'
+# REMOVE THIS LINE IF YOU WANT TO CUSTOMIZE ANYTHING BELOW
+# Otherwise this file will be automatically overwritten by the template
+# autobuilder.
+
# ODL Releng build templates
- project:
name: ttp
--- /dev/null
+#!/usr/bin/python
+
+import os
+
+def get_autoupdate_projects(jjb_dir, projects):
+ """Get list of projects that should be autoupdated"""
+ project_list = []
+ for project in projects:
+ template = os.path.join(jjb_dir, project, "{}.yaml".format(project))
+ if os.path.isfile(template):
+ with open(template, 'r') as f:
+ first_line = f.readline()
+ if first_line.startswith("# REMOVE THIS LINE IF"):
+ project_list.append(project)
+
+ return project_list
+
+def update_templates(projects):
+ for project in projects:
+ os.system("python scripts/jjb-init-project.py {}".format(project))
+
+##############
+# Code Start #
+##############
+
+jjb_dir = "jjb"
+all_projects = [ d for d in os.listdir(jjb_dir)
+ if os.path.isdir(os.path.join(jjb_dir, d)) ]
+auto_update_projects = get_autoupdate_projects(jjb_dir, all_projects)
+update_templates(auto_update_projects)