- 'PROJECT-verify-{stream}'
- 'PROJECT-merge-{stream}'
- 'PROJECT-daily-{stream}'
+ - 'PROJECT-integration-{stream}'
# stream: branch with - in place of / (eg. stable-helium)
# branch: branch (eg. stable/helium)
branch: '{stream}'
language: 'java'
maven-opts: 'MAVEN_OPTS'
+
+- job-template:
+ name: 'PROJECT-integration-{stream}'
+ disabled: DISABLED
+
+ # 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
+ jdk: '{jdk}'
+
+ 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:
+ - gerrit-trigger-scm:
+ credentials-id: '{ssh-credentials}'
+ refspec: ''
+ choosing-strategy: 'default'
+
+ wrappers:
+ - ssh-agent-credentials:
+ user: '{ssh-credentials}'
+
+ triggers:
+ - reverse:
+ jobs: 'DEPENDENCIES'
+ result: 'success'
+
+ maven:
+ maven-name: '{mvn32}'
+ root-pom: 'pom.xml'
+ goals: 'MAVEN_GOALS'
+ maven-opts: 'MAVEN_OPTS'
+ settings: '{PROJECT-settings}'
+ global-settings: '{odl-global-settings}'
+
+ publishers:
+ - email-notification:
+ email-prefix: 'EMAIL_PREFIX'
parser = argparse.ArgumentParser()
parser.add_argument("project", help="project")
+parser.add_argument("-d", "--dependencies",
+ help=("Project dependencies\n\n"
+ "A comma-seperated (no spaces) list of projects "
+ "your project depends on. "
+ "This is used to create an integration job that "
+ "will trigger when a dependent project-merge job "
+ "is built successfully.\n\n"
+ "Example: aaa,controller,yangtools"))
parser.add_argument("-g", "--mvn-goals", help="Maven Goals")
parser.add_argument("-o", "--mvn-opts", help="Maven Options")
args = parser.parse_args()
project_file = os.path.join(project_dir, "%s.yaml" % project)
mvn_goals = args.mvn_goals # Defaults to "clean install" if not passsed
mvn_opts = args.mvn_opts # Defaults to blank if not passed
+dependencies = args.dependencies
+dependent_jobs = ""
+disabled = "true" # Always disabled unless project has dependencies
+email_prefix = "[%s]" % project
template_file = os.path.join("jjb", "job.yaml.template")
if not mvn_opts:
mvn_opts = "-Xmx1024m -XX:MaxPermSize=256m"
+if dependencies:
+ disabled = "false"
+ email_prefix = (email_prefix + " " +
+ " ".join(['[%s]' % d for d in dependencies.split(",")]))
+ dependent_jobs = ",".join(
+ ['%s-merge' % d for d in dependencies.split(",")])
+
# Create project directory if it doesn't exist
if not os.path.exists(project_dir):
os.makedirs(project_dir)
-print("project: %s\ngoals: %s\noptions: %s" % (project,
- mvn_goals,
- mvn_opts))
+print("project: %s\n"
+ "goals: %s\n"
+ "options: %s\n"
+ "dependencies: %s" %
+ (project,
+ mvn_goals,
+ mvn_opts,
+ dependencies))
# Create initial project YAML file
with open(template_file, "r") as infile:
for line in infile:
if not re.match("\s*#", line):
line = re.sub("PROJECT", project, line)
- if not re.match("\s*#", line):
+ line = re.sub("DISABLED", disabled, line)
line = re.sub("MAVEN_GOALS", mvn_goals, line)
- if not re.match("\s*#", line):
line = re.sub("MAVEN_OPTS", mvn_opts, line)
+ line = re.sub("DEPENDENCIES", dependent_jobs, line)
+ line = re.sub("EMAIL_PREFIX", email_prefix, line)
outfile.write(line)