From: Thanh Ha Date: Fri, 22 Jul 2016 17:50:36 +0000 (+0000) Subject: Merge "Migrate yangide matrix-verify jobs to freestyle-verify jobs" X-Git-Tag: release/beryllium-sr3~100 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=df0f32f924e9a71436df812ae5f446e32c6e717f;hp=cae76102a44a238644fafa39d6f1c5d4199845bc;p=releng%2Fbuilder.git Merge "Migrate yangide matrix-verify jobs to freestyle-verify jobs" --- diff --git a/jjb-templates/project.yaml b/jjb-templates/project.yaml deleted file mode 100644 index a77fd1e5d..000000000 --- a/jjb-templates/project.yaml +++ /dev/null @@ -1,24 +0,0 @@ -# ODL Releng build templates -- project: - name: PROJECT_SHORTNAME - jobs: - - '{name}-clm-{stream}' - - '{name}-distribution-{stream}' - - '{name}-distribution-check-{stream}' - - '{name}-integration-{stream}' - - '{name}-merge-{stream}' - - '{name}-periodic-{stream}' - - '{name}-sonar' - - '{name}-validate-autorelease-{stream}' - - '{name}-verify-{stream}' - - # stream: release stream (eg. stable-lithium or beryllium) - # branch: git branch (eg. stable/lithium or master) - STREAMS - project: 'PROJECT_PATH' - mvn-settings: 'JENKINS_SETTINGS' - mvn-goals: 'MAVEN_GOALS' - mvn-opts: 'MAVEN_OPTS' - dependencies: 'DEPENDENCIES' - email-upstream: 'EMAIL_PREFIX' - archive-artifacts: 'ARCHIVE_ARTIFACTS' diff --git a/jjb/bgpcep/bgpcep-csit-bgp-ingest.yaml b/jjb/bgpcep/bgpcep-csit-bgp-ingest.yaml index 580d490d5..531e0415c 100644 --- a/jjb/bgpcep/bgpcep-csit-bgp-ingest.yaml +++ b/jjb/bgpcep/bgpcep-csit-bgp-ingest.yaml @@ -37,7 +37,7 @@ schedule: 'H H * * *' # Controller configuration - controller-image: 'centos7-java-8g' + controller-image: 'centos7-java-builder-2c-8g' - project: name: bgpcep-csit-bgp-ingest-mixed @@ -79,7 +79,7 @@ schedule: 'H H * * *' # Controller configuration - controller-image: 'centos7-java-8g' + controller-image: 'centos7-java-builder-2c-8g' # Plot Info 01-plot-title: 'Number of generated updates' diff --git a/jjb/capwap/capwap.yaml b/jjb/capwap/capwap.yaml index c2cdc59d2..91a291057 100644 --- a/jjb/capwap/capwap.yaml +++ b/jjb/capwap/capwap.yaml @@ -49,11 +49,6 @@ # branch: git branch (eg. stable/lithium or master) stream: - beryllium: - branch: 'stable/beryllium' - jdk: openjdk7 - jdks: - - openjdk7 - - openjdk8 disable_autorelease: False disable_distribution_check: False diff --git a/jjb/integration/integration-macros.yaml b/jjb/integration/integration-macros.yaml index 37b962ca2..198f7b30f 100644 --- a/jjb/integration/integration-macros.yaml +++ b/jjb/integration/integration-macros.yaml @@ -194,6 +194,22 @@ triggers: - timed: 'H H * * *' +# Macro: integration-jclouds-controller-mininet +# Operation: this macro will spin the controller and mininet vms +# Used by: {project}-csit-* job templates + +- wrapper: + name: integration-jclouds-controller-mininet + wrappers: + - jclouds: + instances: + - '{controller-image}': + cloud-name: 'ODLPUB' + count: '{controller-vms}' + - '{mininet-image}': + cloud-name: 'ODLPUB' + count: '{mininet-vms}' + # Macro: integration-openstack-controller-mininet # Operation: this macro will spin the controller and mininet vms # Used by: {project}-csit-* job templates @@ -210,6 +226,21 @@ template-name: '{mininet-image}' count: '{mininet-vms}' +# Macro: integration-jclouds-controller-devstack +# Operation: this macro will spin the controller and devstack vms +# Used by: {project}-csit-openstack job templates +- wrapper: + name: integration-jclouds-controller-devstack + wrappers: + - jclouds: + instances: + - '{controller-image}': + cloud-name: 'ODLPUB' + count: '{controller-vms}' + - '{openstack-image}': + cloud-name: 'ODLPUB' + count: '{openstack-vms}' + # Macro: integration-openstack-controller-devstack # Operation: this macro will spin the controller and devstack vms # Used by: {project}-csit-openstack job templates diff --git a/jjb/integration/integration-templates.yaml b/jjb/integration/integration-templates.yaml index 195e69d25..d94f03051 100644 --- a/jjb/integration/integration-templates.yaml +++ b/jjb/integration/integration-templates.yaml @@ -72,7 +72,7 @@ wrappers: - opendaylight-infra-wrappers: build-timeout: '{build-timeout}' - - integration-openstack-controller-mininet: + - integration-jclouds-controller-mininet: controller-image: '{controller-image}' controller-vms: 1 mininet-image: '{mininet-image}' @@ -158,7 +158,7 @@ wrappers: - opendaylight-infra-wrappers: build-timeout: '{build-timeout}' - - integration-openstack-controller-mininet: + - integration-jclouds-controller-mininet: controller-image: '{controller-image}' controller-vms: 1 mininet-image: '{mininet-image}' @@ -194,6 +194,7 @@ yaxis: '{01-plot-yaxis}' group: '{01-plot-group}' num-builds: '5400' + keep-records: true style: line use-description: false csv-file-name: '{project}-csit-1node-{functionality}-{install}-{stream}-{01-plot-data-file}-history.csv' @@ -206,6 +207,7 @@ yaxis: '{02-plot-yaxis}' group: '{02-plot-group}' num-builds: '5400' + keep-records: true style: line use-description: false csv-file-name: '{project}-csit-1node-{functionality}-{install}-{stream}-{02-plot-data-file}-history.csv' @@ -267,7 +269,7 @@ wrappers: - opendaylight-infra-wrappers: build-timeout: '{build-timeout}' - - integration-openstack-controller-mininet: + - integration-jclouds-controller-mininet: controller-image: '{controller-image}' controller-vms: 1 mininet-image: '{mininet-image}' @@ -302,6 +304,7 @@ yaxis: '{01-plot-yaxis}' group: '{01-plot-group}' num-builds: '180' + keep-records: true style: line use-description: false csv-file-name: '{project}-csit-periodic-1node-{functionality}-{install}-{stream}-{01-plot-data-file}-history.csv' @@ -314,6 +317,7 @@ yaxis: '{02-plot-yaxis}' group: '{02-plot-group}' num-builds: '180' + keep-records: true style: line use-description: false csv-file-name: '{project}-csit-periodic-1node-{functionality}-{install}-{stream}-{02-plot-data-file}-history.csv' @@ -374,7 +378,7 @@ wrappers: - opendaylight-infra-wrappers: build-timeout: '{build-timeout}' - - integration-openstack-controller-mininet: + - integration-jclouds-controller-mininet: controller-image: '{controller-image}' controller-vms: 3 mininet-image: '{mininet-image}' @@ -461,7 +465,7 @@ wrappers: - opendaylight-infra-wrappers: build-timeout: '{build-timeout}' - - integration-openstack-controller-mininet: + - integration-jclouds-controller-mininet: controller-image: '{controller-image}' controller-vms: 3 mininet-image: '{mininet-image}' @@ -498,6 +502,7 @@ yaxis: '{01-plot-yaxis}' group: '{01-plot-group}' num-builds: '5400' + keep-records: true style: line use-description: false csv-file-name: '{project}-csit-3node-{functionality}-{install}-{stream}-{01-plot-data-file}-history.csv' @@ -510,6 +515,7 @@ yaxis: '{02-plot-yaxis}' group: '{02-plot-group}' num-builds: '5400' + keep-records: true style: line use-description: false csv-file-name: '{project}-csit-3node-{functionality}-{install}-{stream}-{02-plot-data-file}-history.csv' @@ -571,7 +577,7 @@ wrappers: - opendaylight-infra-wrappers: build-timeout: '{build-timeout}' - - integration-openstack-controller-mininet: + - integration-jclouds-controller-mininet: controller-image: '{controller-image}' controller-vms: 3 mininet-image: '{mininet-image}' @@ -607,6 +613,7 @@ yaxis: '{01-plot-yaxis}' group: '{01-plot-group}' num-builds: '5400' + keep-records: true style: line use-description: false csv-file-name: '{project}-csit-3node-periodic-{functionality}-{install}-{stream}-{01-plot-data-file}-history.csv' @@ -619,6 +626,7 @@ yaxis: '{02-plot-yaxis}' group: '{02-plot-group}' num-builds: '5400' + keep-records: true style: line use-description: false csv-file-name: '{project}-csit-3node-periodic-{functionality}-{install}-{stream}-{02-plot-data-file}-history.csv' @@ -701,7 +709,7 @@ wrappers: - opendaylight-infra-wrappers: build-timeout: '{build-timeout}' - - integration-openstack-controller-devstack: + - integration-jclouds-controller-devstack: controller-image: '{controller-image}' controller-vms: 1 openstack-image: '{openstack-image}' @@ -810,7 +818,7 @@ wrappers: - opendaylight-infra-wrappers: build-timeout: '{build-timeout}' - - integration-openstack-controller-devstack: + - integration-jclouds-controller-devstack: controller-image: '{controller-image}' controller-vms: 3 openstack-image: '{openstack-image}' diff --git a/jjb/integration/integration-test-jobs.yaml b/jjb/integration/integration-test-jobs.yaml index 327257c3f..9887ad023 100644 --- a/jjb/integration/integration-test-jobs.yaml +++ b/jjb/integration/integration-test-jobs.yaml @@ -226,7 +226,7 @@ wrappers: - opendaylight-infra-wrappers: build-timeout: '{build-timeout}' - - integration-openstack-controller-mininet: + - integration-jclouds-controller-mininet: controller-image: '{controller-image}' controller-vms: 1 mininet-image: '{mininet-image}' diff --git a/jjb/ovsdb/include-raw-setup-docker.sh b/jjb/ovsdb/include-raw-setup-docker.sh index 2191c52ab..c3ffa0fe6 100644 --- a/jjb/ovsdb/include-raw-setup-docker.sh +++ b/jjb/ovsdb/include-raw-setup-docker.sh @@ -22,10 +22,6 @@ echo "---> Starting OVS $OVS_VERSION" /usr/bin/docker pull vpickard/openvswitch:$OVS_VERSION CID=$(/usr/bin/docker run -p 6641:6640 --privileged=true -d -i -t vpickard/openvswitch:$OVS_VERSION /usr/bin/supervisord) REALCID=`echo $CID | rev | cut -d ' ' -f 1 | rev` -echo "---> Waiting to start OVS HW VTEP Emulator" -sleep 5 -echo "---> Starting OVS HW VTEP Emulator" -/usr/bin/docker exec $REALCID supervisorctl start ovs-vtep echo "CID=$REALCID" > env.properties echo "OVS_VERSION=${OVS_VERSION}" >> env.properties CONTROLLER_IP=`facter ipaddress` diff --git a/jjb/ovsdb/include-setup-hwvtep-docker.sh b/jjb/ovsdb/include-setup-hwvtep-docker.sh new file mode 100644 index 000000000..7042ef5f1 --- /dev/null +++ b/jjb/ovsdb/include-setup-hwvtep-docker.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +echo "---> Configuring OVS for HW VTEP Emulator" +/usr/bin/docker exec $CID supervisorctl stop ovsdb-server +sleep 5 +/usr/bin/docker exec $CID supervisorctl start ovsdb-server-vtep +/usr/bin/docker exec $CID ovs-vsctl add-br br-vtep +/usr/bin/docker exec $CID ovs-vsctl add-port br-vtep eth0 +/usr/bin/docker exec $CID vtep-ctl add-ps br-vtep +/usr/bin/docker exec $CID vtep-ctl add-port br-vtep eth0 +/usr/bin/docker exec $CID vtep-ctl set Physical_Switch br-vtep tunnel_ips=192.168.254.20 +/usr/bin/docker exec $CID vtep-ctl set-manager ptcp:6640 + +echo "---> Starting OVS HW VTEP Emulator" +/usr/bin/docker exec $CID supervisorctl start ovs-vtep +sleep 10 diff --git a/jjb/ovsdb/ovsdb-full-integration.yaml b/jjb/ovsdb/ovsdb-full-integration.yaml index 2fe73a1ed..bf85ee7e1 100644 --- a/jjb/ovsdb/ovsdb-full-integration.yaml +++ b/jjb/ovsdb/ovsdb-full-integration.yaml @@ -23,7 +23,7 @@ - openjdk7 project: 'ovsdb' - archive-artifacts: 'docker-ovs-*.log' + archive-artifacts: '*.log' - job-template: name: 'ovsdb-daily-full-integration-{stream}' @@ -108,7 +108,21 @@ - maven-target: maven-version: '{mvn33}' pom: 'pom.xml' - goals: 'clean install dependency:tree -V -B verify -Pintegrationtest -Dskip.karaf.featureTest=true -Dmaven.compile.fork=true -Dovsdb.controller.address=${{CONTROLLER_IP}}' + goals: '-V -B -l build.log clean install dependency:tree -Pq -Dmaven.compile.fork=true' + properties: + - 'maven.repo.local=/tmp/r' + - 'org.ops4j.pax.url.mvn.localRepository=/tmp/r' + - 'stream={stream}' + java-opts: + - '-Xmx1024m -XX:MaxPermSize=256m' + settings: 'ovsdb-settings' + settings-type: cfp + global-settings: 'odl-global-settings' + global-settings-type: cfp + - maven-target: + maven-version: '{mvn33}' + pom: 'southbound/southbound-it/pom.xml' + goals: '-V -B verify -l southboundIT.log -Pintegrationtest -Dskip.karaf.featureTest=true -Dmaven.compile.fork=true -Dovsdb.controller.address=${{CONTROLLER_IP}}' properties: - 'ovsdbserver.ipaddress=127.0.0.1' - 'ovsdbserver.port=6641' @@ -122,6 +136,44 @@ settings-type: cfp global-settings: 'odl-global-settings' global-settings-type: cfp + - shell: + !include-raw-escape: + - include-setup-hwvtep-docker.sh + - maven-target: + maven-version: '{mvn33}' + pom: 'library/it/pom.xml' + goals: '-V -B verify -l libraryIT.log -Pintegrationtest -Dskip.karaf.featureTest=true -Dmaven.compile.fork=true -Dovsdb.controller.address=${{CONTROLLER_IP}}' + properties: + - 'ovsdbserver.ipaddress=127.0.0.1' + - 'ovsdbserver.port=6641' + - 'ovsdb.userspace.enabled=yes' + - 'maven.repo.local=/tmp/r' + - 'org.ops4j.pax.url.mvn.localRepository=/tmp/r' + - 'stream={stream}' + java-opts: + - '-Xmx1024m -XX:MaxPermSize=256m' + settings: 'ovsdb-settings' + settings-type: cfp + global-settings: 'odl-global-settings' + global-settings-type: cfp + - maven-target: + maven-version: '{mvn33}' + pom: 'hwvtepsouthbound/hwvtepsouthbound-it/pom.xml' + goals: '-V -B verify -l hwvtepsouthboundIT.log -Pintegrationtest -Dskip.karaf.featureTest=true -Dmaven.compile.fork=true -Dovsdb.controller.address=${{CONTROLLER_IP}}' + properties: + - 'ovsdbserver.ipaddress=127.0.0.1' + - 'ovsdbserver.port=6641' + - 'ovsdb.userspace.enabled=yes' + - 'maven.repo.local=/tmp/r' + - 'org.ops4j.pax.url.mvn.localRepository=/tmp/r' + - 'stream={stream}' + java-opts: + - '-Xmx1024m -XX:MaxPermSize=256m' + settings: 'ovsdb-settings' + settings-type: cfp + global-settings: 'odl-global-settings' + global-settings-type: cfp + - shell: !include-raw-escape: - include-raw-cleanup-docker.sh diff --git a/jjb/toolkit/toolkit.yaml b/jjb/toolkit/toolkit.yaml index cd8792745..0da0f2592 100644 --- a/jjb/toolkit/toolkit.yaml +++ b/jjb/toolkit/toolkit.yaml @@ -1,6 +1,6 @@ # ODL Releng build templates - project: - name: toolkit + name: toolkit-boron jobs: - '{project-name}-clm-{stream}' - '{project-name}-distribution-{stream}' @@ -8,33 +8,71 @@ - '{project-name}-integration-{stream}' - '{project-name}-merge-{stream}' - '{project-name}-periodic-{stream}' - - '{project-name}-sonar' - '{project-name}-validate-autorelease-{stream}' - - '{project-name}-verify-{stream}' + - '{project-name}-verify-{stream}-{maven}-{jdks}' # stream: release stream (eg. stable-lithium or beryllium) # branch: git branch (eg. stable/lithium or master) stream: - boron: - branch: 'master' - jdk: openjdk7 - jdks: - - openjdk7 disable_autorelease: True disable_distribution_check: False + + project: 'toolkit' + project-name: 'toolkit' + branch: 'master' + jdk: openjdk7 + jdks: + - openjdk7 + maven: + - mvn33: + mvn-version: '{mvn33}' + mvn-settings: 'toolkit-settings' + mvn-goals: 'clean install -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r ' + mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m' + dependencies: '' + email-upstream: '[toolkit]' + archive-artifacts: '' + + +- project: + name: toolkit-beryllium + jobs: + - '{project-name}-clm-{stream}' + - '{project-name}-distribution-{stream}' + - '{project-name}-distribution-check-{stream}' + - '{project-name}-integration-{stream}' + - '{project-name}-merge-{stream}' + - '{project-name}-periodic-{stream}' + - '{project-name}-validate-autorelease-{stream}' + - '{project-name}-verify-{stream}-{maven}-{jdks}' + stream: - beryllium: - branch: 'stable/beryllium' - jdk: openjdk7 - jdks: - - openjdk7 disable_autorelease: True disable_distribution_check: False - project: 'toolkit' project-name: 'toolkit' + branch: 'stable/beryllium' + jdk: openjdk7 + jdks: + - openjdk7 + maven: + - mvn33: + mvn-version: '{mvn33}' mvn-settings: 'toolkit-settings' mvn-goals: 'clean install -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r ' mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m' dependencies: '' email-upstream: '[toolkit]' archive-artifacts: '' + +- project: + name: toolkit-sonar + jobs: + - '{project-name}-sonar' + project: 'toolkit' + project-name: 'toolkit' + branch: 'master' + mvn-settings: 'toolkit-settings' + mvn-goals: 'clean install -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r ' + mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m' diff --git a/scripts/jjb-autoupdate-project.py b/scripts/jjb-autoupdate-project.py deleted file mode 100644 index 56769bdb7..000000000 --- a/scripts/jjb-autoupdate-project.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/python - -# @License EPL-1.0 -############################################################################## -# Copyright (c) 2014, 2015 The Linux Foundation and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Thanh Ha (The Linux Foundation) - Initial implementation -############################################################################## - -import os - -from jjblib import Project - - -def _is_project(jjb_dir, project): - """Returns true if project is a project that should be auto-generated""" - p = Project(project) - if p.meta_project: - template = os.path.join(jjb_dir, project, "%s.yaml" % p.project) - else: - template = os.path.join(jjb_dir, p.project, "%s.yaml" % p.project) - - if os.path.isfile(template): # Project found - with open(template, 'r') as f: - first_line = f.readline() - if first_line.startswith("# REMOVE THIS LINE IF"): - return True - return False - - -def get_autoupdate_projects(jjb_dir): - """Get list of projects that should be auto-updated.""" - project_list = [] - - for root, dirs, files in os.walk(jjb_dir): - project = root.replace("%s/" % jjb_dir, '') - - if _is_project(jjb_dir, project): - project_list.append(project) - - return project_list - - -def update_templates(projects): - for project in projects: - print("Updating... %s" % project) - p = Project(project) - if p.meta_project: # Meta project - cfg_file = "jjb/%s/%s.cfg" % (project, p.project) - else: - cfg_file = "jjb/%s/%s.cfg" % (p.project, p.project) - os.system("python scripts/jjb-init-project.py %s -c %s" % - (project, cfg_file)) - -############## -# 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) -update_templates(auto_update_projects) diff --git a/scripts/jjb-init-project.py b/scripts/jjb-init-project.py deleted file mode 100644 index b878f8e4b..000000000 --- a/scripts/jjb-init-project.py +++ /dev/null @@ -1,217 +0,0 @@ -#!/usr/bin/python - -# @License EPL-1.0 -############################################################################## -# Copyright (c) 2014, 2015 The Linux Foundation and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Thanh Ha (The Linux Foundation) - Initial implementation -############################################################################## - -from collections import OrderedDict -import os -import re - -import yaml - -import jjblib - - -args = jjblib.parse_jjb_args() - - -project = jjblib.Project(args.project) -if project.meta_project is not None: - project_dir = os.path.join("jjb", project.meta_project, project.project) - jenkins_settings = "%s-%s-settings" % (project.meta_project, - project.project) -else: - project_dir = os.path.join("jjb", project.project) - jenkins_settings = "%s-settings" % project.project - -project_file = os.path.join(project_dir, "%s.yaml" % project) -dependent_jobs = "" -disabled = "true" # Always disabled unless project has dependencies -email_prefix = "[%s]" % project - - -if not args.conf: - jjblib.create_template_config(project_dir, args) - project_conf = os.path.join(project_dir, "%s.cfg" % args.project) -else: - project_conf = args.conf - -cfg = dict() # Needed to skip missing project.cfg files -if os.path.isfile(project_conf): - stream = open(project_conf, "r") - cfg = yaml.load(stream) - -#################### -# Handle Templates # -#################### -if cfg.get("JOB_TEMPLATES"): - templates = cfg.get("JOB_TEMPLATES") -else: - templates = ("") - -################## -# Handle Streams # -################## -streams = OrderedDict() -if cfg.get("STREAMS"): # this is a list of single-key dicts - for stream_dict in cfg.get("STREAMS"): - streams.update(stream_dict) -else: - streams = {"boron": jjblib.STREAM_DEFAULTS["boron"]} - -first_stream = next(iter(streams)) # Keep master branch at top. -sonar_branch = streams[first_stream]["branch"] -# Create YAML to list branches to create jobs for -str_streams = "stream:\n" -for stream, options in streams.items(): - str_streams += (" - %s:\n" - " branch: '%s'\n" % - (stream, options["branch"])) - str_streams += " jdk: %s\n" % options["jdks"].split(',')[0].strip() # noqa - str_streams += " jdks:\n" - for jdk in options["jdks"].split(","): - str_streams += " - %s\n" % jdk.strip() - - # Disable autorelease validate job unless project is participating - # in autorelease, JJB does not allow flipping a boolean so we have to - # flip it here via not operator since the JJB configuration for disabling - # a Jenkins Job is "disabled: bool". - str_streams += " disable_autorelease: %s\n" % (not options.get( - "autorelease", False)) - - # Disable the distribution-check job unless project enables it - str_streams += " disable_distribution_check: %s\n" % ( - not options.get("distribution-check", True)) - -############### -# Handle JDKS # -############### -if cfg.get('JDKS'): - jdks = cfg.get('JDKS') -else: - jdks = "openjdk7" -use_jdks = "" -for jdk in jdks.split(","): - use_jdks += " - %s\n" % jdk - -############## -# Handle POM # -############## -if cfg.get('POM'): - pom = cfg.get('POM') -else: - pom = "pom.xml" - -#################### -# Handle MVN_GOALS # -#################### -if cfg.get('MVN_GOALS'): - mvn_goals = cfg.get('MVN_GOALS') -else: - mvn_goals = ("clean install " - "-Dmaven.repo.local=/tmp/r " - "-Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r ") - -################### -# Handle MVN_OPTS # -################### -if cfg.get('MVN_OPTS'): - mvn_opts = cfg.get('MVN_OPTS') -else: - mvn_opts = "-Xmx1024m -XX:MaxPermSize=256m" - -####################### -# Handle DEPENDENCIES # -####################### -if cfg.get('DEPENDENCIES'): - dependencies = cfg.get('DEPENDENCIES') - if dependencies.find("odlparent") < 0: # Add odlparent if not listed - dependencies = "odlparent," + dependencies - disabled = "false" -else: - dependencies = None - if project.project != "odlparent": # Odlparent does not depend on itself - dependencies = "odlparent" # All other projects depend on odlparent - disabled = "false" - -if dependencies: - email_prefix = (email_prefix + " " + - " ".join(['[%s]' % d for d in dependencies.split(",")])) # noqa - dependent_jobs = ",".join( - ['%s-merge-{stream}' % d for d in dependencies.split(",")]) - -############################ -# Handle ARCHIVE_ARTIFACTS # -############################ - -archive_artifacts = cfg.get('ARCHIVE_ARTIFACTS', '') - -############################## -# Create configuration start # -############################## - -# Create project directory if it doesn't exist -if not os.path.exists(project_dir): - os.makedirs(project_dir) - -print("project: %s\n" - "streams: %s\n" - "goals: %s\n" - "options: %s\n" - "dependencies: %s\n" - "artifacts: %s" % - (project, - str_streams, - mvn_goals, - mvn_opts, - dependencies, - archive_artifacts,)) - -# Create initial project YAML file -use_templates = templates.split(",") -use_templates.insert(0, "project") -job_templates_yaml = "" -for t in use_templates: - if t == "project": # This is not a job type but is used for templating - pass - elif t == "sonar": - job_templates_yaml = job_templates_yaml + \ - " - '%s-%s'\n" % (project, t) - else: - job_templates_yaml = job_templates_yaml + \ - " - '%s-%s-{stream}'\n" % (project, t) - -with open(project_file, "w") as outfile: - for t in use_templates: - template_file = "jjb-templates/%s.yaml" % t - with open(template_file, "r") as infile: - for line in infile: - if not re.match("\s*#", line): - line = re.sub("JOB_TEMPLATES", job_templates_yaml, line) - line = re.sub("PROJECT_SHORTNAME", project.project, line) - line = re.sub("PROJECT_PATH", project.path, line) - line = re.sub("JENKINS_SETTINGS", jenkins_settings, line) - line = re.sub("DISABLED", disabled, line) - line = re.sub("STREAMS", str_streams, line) - line = re.sub("POM", pom, line) - line = re.sub("MAVEN_GOALS", mvn_goals, line) - line = re.sub("MAVEN_OPTS", mvn_opts, line) - line = re.sub("DEPENDENCIES", dependent_jobs, line) - line = re.sub("EMAIL_PREFIX", email_prefix, line) - line = re.sub("SONAR_BRANCH", sonar_branch, line) - line = re.sub("ARCHIVE_ARTIFACTS", archive_artifacts, line) - # The previous command may have created superfluous lines. - # If a line has no non-whitespace, it has to be '\n' only. - line = re.sub(r'^\s+\n', "", line) - outfile.write(line) - outfile.write("\n") diff --git a/scripts/jjblib.py b/scripts/jjblib.py deleted file mode 100644 index f48ab9166..000000000 --- a/scripts/jjblib.py +++ /dev/null @@ -1,100 +0,0 @@ -import argparse -import collections -import os - -import yaml - - -def parse_jjb_args(): - parser = argparse.ArgumentParser() - parser.add_argument("project", help="project") - parser.add_argument("-c", "--conf", help="Config file") - 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("-t", "--templates", help="Job templates to use") - parser.add_argument("-s", "--streams", - help="Release streams to fill with default options") - parser.add_argument("-p", "--pom", help="Path to pom.xml to use in Maven " - "build (Default: pom.xml") - parser.add_argument("-g", "--mvn-goals", help="Maven Goals") - parser.add_argument("-o", "--mvn-opts", help="Maven Options") - parser.add_argument("-a", "--archive-artifacts", - help="Comma-seperated list of patterns of artifacts " - "to archive on build completion. " - "See: http://ant.apache.org/manual/Types/fileset.html") # noqa - return parser.parse_args() - - -STREAM_DEFAULTS = collections.OrderedDict([ - ("boron", {"branch": "master", "jdks": "openjdk8"}), - ("beryllium", {"branch": "stable/beryllium", "jdks": "openjdk8"}), - ("stable-lithium", {"branch": "stable/lithium", "jdks": "openjdk7"}), -]) - - -def create_template_config(project_dir, args): - cfg_data = dict() - - if args.templates: - cfg_data["JOB_TEMPLATES"] = args.templates - - if args.streams: - stream_list = list() - for stream in args.streams.split(","): - stream_list.append({stream: STREAM_DEFAULTS[stream]}) - cfg_data["STREAMS"] = stream_list - - if args.pom: - cfg_data["POM"] = args.pom - - if args.mvn_goals: - cfg_data["MAVEN_GOALS"] = args.mvn_goals - - if args.mvn_opts: - cfg_data["MAVEN_OPTS"] = args.mvn_opts - - if args.dependencies: - cfg_data["DEPENDENCIES"] = args.dependencies - - if args.archive_artifacts: - cfg_data["ARCHIVE"] = args.archive_artifacts - - if cfg_data: - # Create project directory if it doesn't exist - if not os.path.exists(project_dir): - os.makedirs(project_dir) - - print("Creating %s.cfg file" % args.project) - cfg_file = os.path.join(project_dir, "%s.cfg" % args.project) - - with open(cfg_file, "w") as outstream: - outstream.write(yaml.dump(cfg_data, default_flow_style=False)) - - -class Project: - """Represents a Gerrit Project - - Attributes: - path(str): The full Gerrit path to a project - meta_project(str): The top-level project name in Gerrit - project(str): The subproject name or project shortname - """ - - def __init__(self, project): - self.path = project - self.meta_project = None - self.project = project - - if project.find('/') >= 0: - s = project.rsplit('/', 1) - self.meta_project = s[0] - self.project = s[1] - - def __str__(self): - return self.project