Merge "Compress large error attachments"
authorDaniel Farrell <dfarrell@redhat.com>
Thu, 13 Apr 2017 22:14:44 +0000 (22:14 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 13 Apr 2017 22:14:44 +0000 (22:14 +0000)
25 files changed:
.coafile
jjb/autorelease/include-raw-autorelease-notify-build-failure.sh
jjb/bgpcep/bgpcep-csit-bgp-ingest.yaml
jjb/bier/bier-csit-basic.yaml
jjb/bier/bier.yaml
jjb/deploy-distribution-get-vars.sh [new file with mode: 0644]
jjb/deploy-distribution.sh [new file with mode: 0644]
jjb/integration/distribution-jobs.yaml
jjb/integration/distribution/distribution-check.yaml
jjb/integration/include-raw-integration-compare-distributions.sh
jjb/integration/include-raw-integration-deploy-openstack-run-test.sh
jjb/integration/include-raw-integration-get-bundle-url-root.sh [deleted file]
jjb/integration/include-raw-integration-get-bundle-url.sh [deleted file]
jjb/integration/include-raw-integration-get-bundle-vars.sh
jjb/integration/include-raw-integration-multipatch-distribution-test.sh
jjb/integration/integration-macros.yaml
jjb/integration/integration-templates.yaml
jjb/integration/integration-test-jobs.yaml
jjb/netvirt/netvirt-csit-multi-openstack.yaml
jjb/netvirt/netvirt-full-integration.yaml
jjb/releng-defaults.yaml
jjb/releng-macros.yaml
jjb/releng-templates-java.yaml
scripts/branch_cut/branch_cut.awk [new file with mode: 0755]
scripts/branch_cut/branch_cutter.sh [new file with mode: 0755]

index 40e4c3ac1a4b5f5ef2bcc956b52efaa96fcfedf3..a53cf258bafa5f3c3ef0f3606c0c21f571a80b60 100644 (file)
--- a/.coafile
+++ b/.coafile
@@ -31,8 +31,6 @@ ignore = jenkins-scripts/*-local-env.sh,
     jjb/integration/include-raw-integration-deploy-controller-verify.sh,
     jjb/integration/include-raw-integration-deploy-openstack-run-test.sh,
     jjb/integration/include-raw-integration-distribution-check.sh,
-    jjb/integration/include-raw-integration-get-bundle-url-root.sh,
-    jjb/integration/include-raw-integration-get-bundle-url.sh,
     jjb/integration/include-raw-integration-get-bundle-vars.sh,
     jjb/integration/include-raw-integration-get-slave-addresses.sh,
     jjb/integration/include-raw-integration-list-jobs.sh,
index 951d0075ca718ed1b2830416e872ae7f3c96e20b..539f029be044567beca7585c27d2e62ebc181d76 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash
 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
 ##############################################################################
 # Copyright (c) 2017 The Linux Foundation and others.
index b6b3af9a2fdff1ce98e6b6a025b9676c725c16a5..5ae653324a33f64fd0ee73d309814b5a664ec0b3 100644 (file)
 
     # Project branches
     stream:
-      - carbon:
+      - nitrogen:
           branch: 'master'
           jre: 'openjdk8'
+      - carbon:
+          branch: 'satble/carbon'
+          jre: 'openjdk8'
       - boron:
           branch: 'stable/boron'
           jre: 'openjdk8'
index 6fb0a417b7ed3276925a4fc6f35d6035d2a8bb32..b171973b896d8cd6d3f862c4fb04d5dd2591691f 100644 (file)
       - carbon:
           branch: 'stable/carbon'
           jre: 'openjdk8'
-\r
-    # TODO: Delete the following if suites are compatible with Boron again.\r
-    verify-stream: 'carbon'\r
-    # TODO: Remove the lines above and below when carbon becomes the default scit-verify stream.\r
-    verify-branch: 'master'\r
+
+    # TODO: Delete the following if suites are compatible with Boron again.
+    verify-stream: 'carbon'
+    # TODO: Remove the lines above and below when carbon becomes the default scit-verify stream.
+    verify-branch: 'carbon'
     # TODO: Update the line above when stable/carbon is created.
 
     install:
index 0efb7875a234cbe34a40e078aecfbc94ee7afbe2..7406abbfe26ed082422dbc0d7fe6f8cb423427ed 100644 (file)
@@ -1,39 +1,66 @@
 ---
 - project:
-    name: bier-carbon\r
-    jobs:\r
+    name: bier-nirtogen
+    jobs:
       - '{project-name}-clm-{stream}'
       - '{project-name}-distribution-check-{stream}'
       - '{project-name}-integration-{stream}'
       - '{project-name}-merge-{stream}'
       - '{project-name}-validate-autorelease-{stream}'
       - '{project-name}-verify-{stream}-{maven}-{jdks}'
-\r
-    stream: carbon\r
-    project: 'bier'\r
-    project-name: 'bier'\r
-    branch: 'master'\r
-    jdk: openjdk8\r
-    jdks:\r
+
+    stream: nitrogen
+    project: 'bier'
+    project-name: 'bier'
+    branch: 'master'
+    jdk: openjdk8
+    jdks:
       - openjdk8
-    maven:\r
+    maven:
       - mvn33:
           mvn-version: 'mvn33'
-    mvn-settings: 'bier-settings'\r
-    mvn-goals: 'clean install'\r
-    mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'\r
-    dependencies: ''\r
-    email-upstream: '[bier]'\r
-    archive-artifacts: ''\r
-\r
-- project:\r
-    name: bier-sonar\r
-    jobs:\r
+    mvn-settings: 'bier-settings'
+    mvn-goals: 'clean install'
+    mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'
+    dependencies: ''
+    email-upstream: '[bier]'
+    archive-artifacts: ''
+
+- project:
+    name: bier-carbon
+    jobs:
+      - '{project-name}-clm-{stream}'
+      - '{project-name}-distribution-check-{stream}'
+      - '{project-name}-integration-{stream}'
+      - '{project-name}-merge-{stream}'
+      - '{project-name}-validate-autorelease-{stream}'
+      - '{project-name}-verify-{stream}-{maven}-{jdks}'
+
+    stream: carbon
+    project: 'bier'
+    project-name: 'bier'
+    branch: 'stable/carbon'
+    jdk: openjdk8
+    jdks:
+      - openjdk8
+    maven:
+      - mvn33:
+          mvn-version: 'mvn33'
+    mvn-settings: 'bier-settings'
+    mvn-goals: 'clean install'
+    mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'
+    dependencies: ''
+    email-upstream: '[bier]'
+    archive-artifacts: ''
+
+- project:
+    name: bier-sonar
+    jobs:
       - '{project-name}-sonar'
-\r
-    project: 'bier'\r
-    project-name: 'bier'\r
-    branch: 'master'\r
-    mvn-settings: 'bier-settings'\r
-    mvn-goals: 'clean install'\r
-    mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'\r
+
+    project: 'bier'
+    project-name: 'bier'
+    branch: 'master'
+    mvn-settings: 'bier-settings'
+    mvn-goals: 'clean install'
+    mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'
diff --git a/jjb/deploy-distribution-get-vars.sh b/jjb/deploy-distribution-get-vars.sh
new file mode 100644 (file)
index 0000000..8512d62
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+set -xeu -o pipefail
+
+export BUNDLE
+export BUNDLE_URL
+export BUNDLE_VERSION
+
+BUNDLE_VERSION=$(xpath "${BUNDLE_POM}" '/project/version/text()' 2> /dev/null)
+BUNDLE="distribution-karaf-${BUNDLE_VERSION}.zip"
+BUNDLE_URL="/tmp/r/org/opendaylight/integration/distribution-karaf/${BUNDLE_VERSION}/${BUNDLE}"
+
+# Used to inject BUNDLE_ variables back into Jenkins
+env | grep BUNDLE_ | sort | tee deploy-distribution.env
diff --git a/jjb/deploy-distribution.sh b/jjb/deploy-distribution.sh
new file mode 100644 (file)
index 0000000..934c3a2
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+set -xeu -o pipefail
+
+echo "Uploading distribution to Nexus..."
+"$MVN" deploy:deploy-file \
+    --log-file deploy-karaf-distribution.log \
+    --global-settings "$GLOBAL_SETTINGS_FILE" \
+    --settings "$SETTINGS_FILE" \
+    -Dfile="$BUNDLE_URL" \
+    -DrepositoryId=opendaylight-snapshot \
+    -Durl="$ODLNEXUSPROXY/content/repositories/opendaylight.snapshot/" \
+    -DgroupId="org.opendaylight.integration.${GERRIT_PROJECT//\//.}" \
+    -DartifactId=distribution-karaf \
+    -Dversion="$BUNDLE_VERSION" \
+    -Dpackaging=zip
+
+BUNDLE_URL=$(grep "Uploaded.*distribution-karaf/$BUNDLE_VERSION.*.zip" deploy-karaf-distribution.log | awk '{print $3}')
+echo "Bundle uploaded to $BUNDLE_URL"
+
+# Re-inject the new BUNDLE_URL for downstream jobs to pull from Nexus
+env | grep BUNDLE_ | sort | tee deploy-distribution.env
index 4a62e56b995d94310c82ce6d7d115faf47c6ca92..c54c64c7c81d512a045ead0cacf8255de7dcec51 100644 (file)
@@ -29,7 +29,7 @@
 - job-template:
     name: 'distribution-verify-{stream}'
 
-    project-type: maven
+    project-type: freestyle
     node: centos7-java-builder-2c-8g
     concurrent: true
     jdk: '{jre}'
@@ -47,6 +47,8 @@
           artifacts: '{archive-artifacts} **/dependency_tree.txt **/*.hprof'
       - integration-patch-refspec:
           branch: '$GERRIT_REFSPEC'
+      - maven-exec:
+          maven-version: mvn33
 
     scm:
       - gerrit-trigger-scm:
           branch: '{branch}'
           files: '**'
 
-    prebuilders:
-      - integration-get-bundle-url-root
-      - inject:
-          properties-file: 'bundle.txt'
+    builders:
       - wipe-org-opendaylight-repo
       - provide-maven-settings:
           global-settings-file: 'odl-global-settings'
           settings-file: 'integration-settings'
-
-    maven:
-      maven-name: 'mvn33'
-      root-pom: 'pom.xml'
-      goals: >
-          clean install dependency:tree -DoutputFile=dependency_tree.txt -V -B
-          -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
-          -Djenkins -Dstream={stream}
-      maven-opts: '-Xmx1024m -XX:MaxPermSize=256m'
-      settings: 'integration-settings'
-      settings-type: cfp
-      global-settings: 'odl-global-settings'
-      global-settings-type: cfp
-      ignore-upstream-changes: true
-      post-step-run-condition: 'SUCCESS'
-
-    postbuilders:
+      - maven-target:
+          maven-version: mvn33
+          pom: pom.xml
+          goals: |
+              clean install dependency:tree -DoutputFile=dependency_tree.txt
+              -Dstream={stream}
+              {opendaylight-infra-mvn-opts}
+          java-opts:
+            - '-Xmx1024m -XX:MaxPermSize=256m'
+          settings: integration-settings
+          settings-type: cfp
+          global-settings: odl-global-settings
+          global-settings-type: cfp
+      - distribution-check-deploy-distribution:
+          dist-pom: pom.xml
       - trigger-builds:
           - project: 'distribution-deploy-{stream}'
             block: true
             predefined-parameters:
-              BUNDLEURL=$BUNDLEURL
-
-    reporters:
-      - findbugs
+              BUNDLEURL=$BUNDLE_URL
 
     publishers:
+      - findbugs
       - jacoco-report
       - opendaylight-infra-shiplogs:
           maven-version: 'mvn33'
           branch: '{branch}'
           refspec: 'refs/heads/{branch}'
           artifacts: '{archive-artifacts} **/dependency_tree.txt **/*.hprof **/target/surefire-reports/*-output.txt'
-      - integration-bundleurl:
-          bundleurl: 'last'
     scm:
       - gerrit-trigger-scm:
           refspec: ''
     prebuilders:
       - wipe-org-opendaylight-repo
       - jacoco-nojava-workaround
-      - integration-get-bundle-vars
-      - inject:
-          properties-file: 'bundle_vars.txt'
       - provide-maven-settings:
           global-settings-file: 'odl-global-settings'
           settings-file: 'integration-settings'
index 4ce501286820d92431346f913e09729ded94d22d..4a69d36b14f04ad040fbec36b57fc381ff376bc1 100644 (file)
@@ -26,6 +26,8 @@
           branch: '{branch}'
           refspec: 'refs/heads/{branch}'
           artifacts: '{archive-artifacts} **/dependency_tree.txt **/target/surefire-reports/*-output.txt'
+      - maven-exec:
+          maven-version: mvn33
 
     scm:
       - integration-gerrit-scm:
       - distribution-check-wipe
       - distribution-check-build-project:
           pom: 'distribution/pom.xml'
+          mvn-opts: '{opendaylight-infra-mvn-opts}'
       - distribution-check-verify-groupid:
           gerrit-project: 'integration'
       - distribution-check-delete-snapshots
       - distribution-check-configure-remotes
       - distribution-check-repeat-build:
           dist-pom: 'distribution/pom.xml'
+          mvn-opts: '{opendaylight-infra-mvn-opts}'
+      - distribution-check-deploy-distribution:
+          dist-pom: distribution/pom.xml
       - integration-distribution-check
 
     publishers:
@@ -73,7 +79,5 @@
           script-only-if-succeeded: false
           script-only-if-failed: false
           mark-unstable-if-failed: true
-      - archive:
-          artifacts: '*.zip'
       - opendaylight-infra-shiplogs:
           maven-version: 'mvn33'
index ae172ad368ae3a452f72661455fe39092506a36b..ecd77675f6d7159bc0b57d801921191173d2d29c 100644 (file)
@@ -5,6 +5,32 @@
 # Do not fail the build if there is trouble trying to collect distribution patch diffs
 set +e
 
+NEXUSURL_PREFIX=${ODLNEXUSPROXY:-https://nexus.opendaylight.org}
+ODL_NEXUS_REPO=${ODL_NEXUS_REPO:-content/repositories/opendaylight.snapshot}
+GERRIT_PATH=${GERRIT_PATH:-git.opendaylight.org/gerrit}
+DISTROBRANCH=${DISTROBRANCH:-$GERRIT_BRANCH}
+
+# Obtain current pom.xml of integration/distribution, correct branch.
+wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
+# Extract the BUNDLEVERSION from the pom.xml
+BUNDLEVERSION=$(xpath pom.xml '/project/version/text()' 2> /dev/null)
+echo "Bundle version is ${BUNDLEVERSION}"
+# Acquire the timestamp information from maven-metadata.xml
+NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/integration/distribution-karaf"
+wget ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml
+
+if [ $? -ne 0 ]; then
+  echo "unable to find maven-metadata.xml. no need to continue..."
+  exit 0
+fi
+
+less maven-metadata.xml
+TIMESTAMP=$(xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null)
+echo "Nexus timestamp is ${TIMESTAMP}"
+BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
+BUNDLE="distribution-karaf-${TIMESTAMP}.zip"
+ACTUALBUNDLEURL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}"
+
 wget --progress=dot:mega $ACTUALBUNDLEURL
 echo "Extracting the last distribution found on nexus..."
 unzip -q $BUNDLE
index f3b63c24decd92a3e336d094e22ef5e61c20af05..00545f39260cac4696b7a49df22d1e2b678a86b6 100644 (file)
@@ -647,7 +647,7 @@ do
     # will be the same as the number of openstack systems. However, if we are doing multinode openstack then the
     # assumption is we have a single control node and the rest are compute nodes, so the number of expected hypervisors
     # is one less than the total number of openstack systems
-    if [ $((NUM_OPENSTACK_SYSTEM / NUM_OPENSTACK_SITES - 1)) -eq 1 ]; then
+    if [ $((NUM_OPENSTACK_SYSTEM / NUM_OPENSTACK_SITES)) -eq 1 ]; then
         expected_num_hypervisors=1
     else
         expected_num_hypervisors=${NUM_COMPUTES_PER_SITE}
diff --git a/jjb/integration/include-raw-integration-get-bundle-url-root.sh b/jjb/integration/include-raw-integration-get-bundle-url-root.sh
deleted file mode 100644 (file)
index 17a2ced..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Extract the BUNDLEVERSION from the pom.xml
-BUNDLEVERSION=`xpath pom.xml '/project/version/text()' 2> /dev/null`
-echo "Bundle version is ${BUNDLEVERSION}"
-
-BUNDLEURL=${BUILD_URL}org.opendaylight.integration\$distribution-karaf/artifact/org.opendaylight.integration/distribution-karaf/${BUNDLEVERSION}/distribution-karaf-${BUNDLEVERSION}.zip
-echo "Bundle url is ${BUNDLEURL}"
-
-# Set BUNDLEVERSION & BUNDLEURL
-echo BUNDLEVERSION=${BUNDLEVERSION} > bundle.txt
-echo BUNDLEURL=${BUNDLEURL} >> bundle.txt
-
-# NOTE: BUNDLEVERSION & BUNDLEURL will be re-imported back into the environment with the
-# Inject environment variables plugin (next step)
diff --git a/jjb/integration/include-raw-integration-get-bundle-url.sh b/jjb/integration/include-raw-integration-get-bundle-url.sh
deleted file mode 100644 (file)
index 521fcb6..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# Extract the BUNDLEVERSION from the pom.xml
-BUNDLEVERSION=`xpath distribution/pom.xml '/project/version/text()' 2> /dev/null`
-echo "Bundle version is ${BUNDLEVERSION}"
-
-BUNDLEURL=${BUILD_URL}org.opendaylight.integration\$distribution-karaf/artifact/org.opendaylight.integration/distribution-karaf/${BUNDLEVERSION}/distribution-karaf-${BUNDLEVERSION}.zip
-echo "Bundle url is ${BUNDLEURL}"
-
-# Set BUNDLEVERSION & BUNDLEURL
-echo BUNDLEVERSION=${BUNDLEVERSION} > bundle.txt
-echo BUNDLEURL=${BUNDLEURL} >> bundle.txt
-
-# NOTE: BUNDLEVERSION & BUNDLEURL will be re-imported back into the environment with the
-# Inject environment variables plugin (next step)
index 6b57c40272c8262ae5a7e4d9524b41f91de19928..a387e06821766c05567aafd0860766a9ca3ca247 100644 (file)
@@ -11,22 +11,17 @@ if [ ${BUNDLEURL} == 'last' ]; then
     # Obtain current pom.xml of integration/distribution, correct branch.
     wget "http://${GERRIT_PATH}/gitweb?p=integration/distribution.git;a=blob_plain;f=pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
     # Extract the BUNDLEVERSION from the pom.xml
-    BUNDLEVERSION=`xpath pom.xml '/project/version/text()' 2> /dev/null`
+    BUNDLEVERSION=$(xpath pom.xml '/project/version/text()' 2> /dev/null)
     echo "Bundle version is ${BUNDLEVERSION}"
     # Acquire the timestamp information from maven-metadata.xml
     NEXUSPATH="${NEXUSURL_PREFIX}/${ODL_NEXUS_REPO}/org/opendaylight/integration/distribution-karaf"
     wget ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml
     less maven-metadata.xml
-    TIMESTAMP=`xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null`
+    TIMESTAMP=$(xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null)
     echo "Nexus timestamp is ${TIMESTAMP}"
     BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
     BUNDLE="distribution-karaf-${TIMESTAMP}.zip"
     ACTUALBUNDLEURL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}"
-elif [[ ${BUNDLEURL} == *"distribution-check"* ]]; then
-    ACTUALBUNDLEURL="${BUNDLEURL}"
-    BUNDLE="${BUNDLEURL##*/}"
-    BUNDLEFOLDER="${BUNDLE//.zip}"
-    BUNDLEVERSION="${BUNDLEFOLDER//distribution-karaf-}"
 else
     ACTUALBUNDLEURL="${BUNDLEURL}"
     BUNDLE="${BUNDLEURL##*/}"
@@ -59,4 +54,3 @@ JAVA_HOME=${JAVA_HOME}
 EOF
 
 # vim: ts=4 sw=4 sts=4 et ft=sh :
-
index 70aa31ace6cf62763cf4b35a031529fccba68c4c..8137a6603c93d6a7ee34270b63347dd41da48677 100644 (file)
@@ -9,7 +9,7 @@
 # create a fresh empty place to build this custom distribution
 BUILD_DIR=${WORKSPACE}/patch_tester
 POM_FILE=${WORKSPACE}/patch_tester/pom.xml
-DISTRIBUTION_BRANCH_TO_BUILD=$BRANCH  #renaming variable for clarity
+DISTRIBUTION_BRANCH_TO_BUILD=$DISTROBRANCH  #renaming variable for clarity
 
 rm -rf $BUILD_DIR
 mkdir -p $BUILD_DIR
@@ -86,14 +86,3 @@ fi
 # finish pom file
 echo "</modules>" >> ${POM_FILE}
 echo "</project>" >> ${POM_FILE}
-
-# Extract the BUNDLEVERSION from the distribution pom.xml
-BUNDLEVERSION=`xpath $BUILD_DIR/distribution/pom.xml '/project/version/text()' 2> /dev/null`
-echo "Bundle version is ${BUNDLEVERSION}"
-
-BUNDLEURL=${BUILD_URL}org.opendaylight.integration\$distribution-karaf/artifact/org.opendaylight.integration/distribution-karaf/${BUNDLEVERSION}/distribution-karaf-${BUNDLEVERSION}.zip
-echo "Bundle url is ${BUNDLEURL}"
-
-# Set BUNDLEVERSION & BUNDLEURL
-echo BUNDLEVERSION=${BUNDLEVERSION} > ${WORKSPACE}/bundle.txt
-echo BUNDLEURL=${BUNDLEURL} >> ${WORKSPACE}/bundle.txt
index 2cf8eee2efa654ffaac1a014da005c4e1457ce77..d7204ed8f7247e801c0b249089a5d141dfee1b24 100644 (file)
     builders:
       - shell: !include-raw: include-raw-integration-start-cluster-run-test.sh
 
-# Macro: integration-get-bundle-url
-# Operation: this macro gets the job generated distribution URL from distribution pom.xml
-# Used by: integration-patch-test-{stream} job template
-
-- builder:
-    name: integration-get-bundle-url
-    builders:
-      - shell: !include-raw: include-raw-integration-get-bundle-url.sh
-
-# Macro: integration-get-bundle-url-root
-# Operation: this macro gets the job generated distribution URL from root pom.xml
-# Used by: distribution-verify-{stream} job template
-
-- builder:
-    name: integration-get-bundle-url-root
-    builders:
-      - shell: !include-raw: include-raw-integration-get-bundle-url-root.sh
-
 # Macro: integration-install-robotframework
 # Operation: Installs robotframework using pip to a virtualenv
 # Used by: {project}-csit-* job templates
index 3b46c1324da7c287349a8c1eaa1b357aec95951b..187dd76cbfa93cbae4a8226d3cfdf755cfdc325d 100644 (file)
 - job-template:
     name: '{project}-patch-test-{feature}-{stream}'
 
-    project-type: maven
+    project-type: freestyle
     node: centos7-java-builder-2c-8g
     concurrent: true
     jdk: '{jdk}'
           os-cloud: '{os-cloud}'
           project: '{project}'
           branch: '{branch}'
-          refspec: '$GERRIT_REFSPEC'
+          refspec: 'refs/heads/{branch}'
           artifacts: '{archive-artifacts}'
       - integration-distribution-branch:
           branch: '{branch}'
           name: feature
           default: 'all'
           description: 'Specific feature test for patch'
+      - maven-exec:
+          maven-version: mvn33
 
     scm:
       - integration-gerrit-scm:
             unstable: true
             notbuilt: true
 
-    prebuilders:
+    builders:
       - integration-rebase-gerrit-patch
-      - integration-get-bundle-url
-      - inject:
-          properties-file: 'bundle.txt'
       - wipe-org-opendaylight-repo
-      - provide-maven-settings:
-          global-settings-file: 'odl-global-settings'
-          settings-file: 'integration-settings'
       - maven-target:
-          maven-version: 'mvn33'
+          maven-version: mvn33
           pom: '{project}/pom.xml'
-          goals: >
+          goals: |
               clean install dependency:tree
-              -V -B -Pq
+              -Pq
               -Dgitid.skip=false
-              -Djenkins
               -DgenerateReports=false
-              -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
               -Dstream={stream}
+              {opendaylight-infra-mvn-opts}
           java-opts:
             - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
-          settings: 'integration-settings'
+          settings: integration-settings
           settings-type: cfp
-          global-settings: 'odl-global-settings'
+          global-settings: odl-global-settings
           global-settings-type: cfp
-
-    maven:
-      maven-name: 'mvn33'
-      root-pom: 'distribution/pom.xml'
-      goals: >
-          clean install dependency:tree
-          -V -B -Pq
-          -Dgitid.skip=false
-          -Djenkins
-          -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
-      maven-opts: '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
-      settings: 'integration-settings'
-      settings-type: cfp
-      global-settings: 'odl-global-settings'
-      global-settings-type: cfp
-      ignore-upstream-changes: true
-      post-step-run-condition: 'SUCCESS'
-
-    postbuilders:
+      - maven-target:
+          maven-version: mvn33
+          pom: distribution/pom.xml
+          goals: |
+              clean install dependency:tree
+              -Pq
+              -Dgitid.skip=false
+              {opendaylight-infra-mvn-opts}
+          java-opts:
+            - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
+          settings: integration-settings
+          settings-type: cfp
+          global-settings: odl-global-settings
+          global-settings-type: cfp
+      - distribution-check-deploy-distribution:
+          dist-pom: distribution/pom.xml
       - trigger-builds:
           - project: '{csit-list}'
             block: true
             predefined-parameters:
-              BUNDLEURL=$BUNDLEURL
+              BUNDLEURL=$BUNDLE_URL
 
     publishers:
       - email-notification:
index e8e396fa82b03b40b51b7ec41606e1fd19288def..875872dd487101bab1004df9705809c6905a7aef 100644 (file)
@@ -12,6 +12,7 @@
       - 'integration-patch-test-{stream}'
       - 'integration-multipatch-test-{stream}'
       - 'integration-distribution-weekly-test-trigger-{stream}'
+      - 'integration-distribution-high-frequency-test-trigger-{stream}'
 
     # CSIT Lists in releng-defaults.yaml
     stream:
@@ -22,6 +23,9 @@
           csit-sanity-list: '{csit-sanity-list-nitrogen}'
           csit-weekly-list: '{csit-weekly-list-nitrogen}'
           schedule-weekly: 'H 12 * * 0'
+          csit-high-frequency-list: ''
+          schedule-high-frequency: ''
+
       - carbon:
           branch: 'stable/carbon'
           jdk: 'openjdk8'
@@ -30,6 +34,8 @@
           csit-sanity-list: '{csit-sanity-list-carbon}'
           csit-weekly-list: '{csit-weekly-list-carbon}'
           schedule-weekly: 'H 12 * * 0'
+          csit-high-frequency-list: '{csit-high-frequency-list-carbon}'
+          schedule-high-frequency: 'H H/4 * * *'
 
       - boron:
           branch: 'stable/boron'
@@ -39,6 +45,8 @@
           csit-sanity-list: '{csit-sanity-list-boron}'
           csit-weekly-list: '{csit-weekly-list-boron}'
           schedule-weekly: 'H 12 * * 0'
+          csit-high-frequency-list: ''
+          schedule-high-frequency: ''
 
       - beryllium:
           branch: 'stable/beryllium'
@@ -48,6 +56,8 @@
           csit-sanity-list: ''
           csit-weekly-list: ''
           schedule-weekly: 'H 12 * * 0'
+          csit-high-frequency-list: ''
+          schedule-high-frequency: ''
 
     # tools system image
     tools_system_image: Ubuntu 14.04 - mininet-ovs-25 - 20170210-0300
 - job-template:
     name: 'integration-patch-test-{stream}'
 
-    project-type: maven
+    project-type: freestyle
     node: centos7-java-builder-2c-8g
     jdk: '{jdk}'
 
           branch: '{branch}'
       - integration-distribution-git-url:
           git-url: '{git-url}'
+      - maven-exec:
+          maven-version: mvn33
 
     scm:
       - integration-gerrit-scm:
             unstable: true
             notbuilt: true
 
-    prebuilders:
+    builders:
       - integration-rebase-gerrit-patch
-      - integration-get-bundle-url
-      - inject:
-          properties-file: 'bundle.txt'
       - wipe-org-opendaylight-repo
       - provide-maven-settings:
           global-settings-file: 'odl-global-settings'
       - maven-target:
           maven-version: 'mvn33'
           pom: '$GERRIT_PROJECT/pom.xml'
-          goals: >
+          goals: |
               clean install dependency:tree -DoutputFile=dependency_tree.txt
-              -V -B -Pq -Djenkins
-              -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
+              -Pq
               -Dstream={stream}
+              {opendaylight-infra-mvn-opts}
           java-opts:
             - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
-          settings: 'integration-settings'
+          settings: integration-settings
           settings-type: cfp
-          global-settings: 'odl-global-settings'
+          global-settings: odl-global-settings
           global-settings-type: cfp
-
-    maven:
-      maven-name: 'mvn33'
-      root-pom: 'distribution/pom.xml'
-      goals: >
-          clean install dependency:tree -DoutputFile=dependency_tree.txt
-          -V -B -Djenkins
-          -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
-      maven-opts: '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
-      settings: 'integration-settings'
-      settings-type: cfp
-      global-settings: 'odl-global-settings'
-      global-settings-type: cfp
-      ignore-upstream-changes: true
-      post-step-run-condition: 'SUCCESS'
-
-    postbuilders:
+      - maven-target:
+          maven-version: mvn33
+          pom: distribution/pom.xml
+          goals: |
+              clean install dependency:tree -DoutputFile=dependency_tree.txt
+              {opendaylight-infra-mvn-opts}
+          java-opts:
+            - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
+          settings: integration-settings
+          settings-type: cfp
+          global-settings: odl-global-settings
+          global-settings-type: cfp
+      - distribution-check-deploy-distribution:
+          dist-pom: distribution/pom.xml
       - trigger-builds:
           - project: '{csit-list}'
             block: true
             predefined-parameters:
-              BUNDLEURL=$BUNDLEURL
+              BUNDLEURL=$BUNDLE_URL
 
     publishers:
       - opendaylight-infra-shiplogs:
           email-recipients: '{email-recipients}'
           email-prefix: '[$GERRIT_PROJECT]'
 
-# Template: integration-multipatch-test-{stream}
-# Goal: Build one or more patches and run all available system test on a distribution containing the change
-# Operation: This job template checks out and builds each patch provided in job parameters, creates a distribution
-# containing these patches, and triggers the distribution test job which includes most (if not all) available
-# CSIT jobs
 
 - job-template:
     name: 'integration-multipatch-test-{stream}'
+    # Goal: Build one or more patches and run all available system test on a distribution containing the change.
+    # Operation: This job template checks out and builds each patch provided in job parameters, creates a distribution
+    # containing these patches, and triggers the distribution test job which includes most (if not all) available
+    # CSIT jobs
+    # TODO: Move the following to appropriate readthedocs document.
+    # Recommended Sandbox usage:
+    # 0. Create this job and a CSIT job you want to run on the new .zip in Sandbox (disable timed triggers).
+    # 1. Copy the csit job name to clipboard.
+    # 2. Navigate to Sandbox page of this job.
+    # 3. Click "Configure".
+    # 4. Locate "Trigger/call builds on other projects" (under "Post Steps" tab).
+    # 5. Delete the long value of "Projects to build" field and paste the job name from clipboard (ctrl+a, ctrl+v).
+    # 6. Click "Save" button.
+    # 7. Click "Build with Parameters".
+    # yamllint disable-line rule:line-length
+    # 8. Start the job with your parameters, see https://wiki.opendaylight.org/view/Integration/Test/Running_System_Tests#Running_System_Tests_Using_Custom_Distribution_Built_From_Multiple_Patches
+    # 9. The multipatch job waits for the csit job to finish, so abort csit if you see something went wrong.
+    # 10. Navigate to Sandbox page of the csit job, click the run triggered from multipatch.
+    # 11. Click Parameters and copy the long value of BUNDLEURL field to clipboard.
+    # 12. Run the same csit job woth different patchset or test options, or other csit jobs, with this BUNDLEURL value
+    #     so you do not have to wait for multipatch build. Repeat step 12.
+    # 13. Currently, the .zip lasts 24 hours (?) so you may need to jump to step 2 (or 0) after some time.
 
-    project-type: maven
+    project-type: freestyle
     node: centos7-java-builder-8c-8g
     jdk: '{jdk}'
 
     parameters:
       - patches-to-build-parameter:
           patches_to_build: '$PATCHES_TO_BUILD'
+      - run-test-parameter:
+          run-test: 'false'
       - integration-distribution-branch:
           branch: '{branch}'
       - opendaylight-infra-parameters:
           branch: '{branch}'
           refspec: 'refs/heads/{branch}'
           artifacts: '{archive-artifacts} **/dependency_tree.txt'
+      - maven-exec:
+          maven-version: mvn33
+
+    wrappers:
+      - opendaylight-infra-wrappers:
+          build-timeout: '1200'
 
-    prebuilders:
+    builders:
       - wipe-org-opendaylight-repo
       - integration-multipatch-builder
-      - inject:
-          properties-file: 'bundle.txt'
       - provide-maven-settings:
           global-settings-file: 'odl-global-settings'
           settings-file: 'yangtools-settings'
-
-    wrappers:
-      - opendaylight-infra-wrappers:
-          build-timeout: '1200'
-
-    maven:
-      maven-name: 'mvn33'
-      root-pom: 'patch_tester/pom.xml'
-      # TODO: Make Maven options configurable. Currently tests are not skipped, everything else is.
-      goals: >
-          clean install dependency:tree -DoutputFile=dependency_tree.txt
-          -f patch_tester/pom.xml -V -B -Pq -Djenkins
-          -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
-          -Dstream={stream}
-      maven-opts: '-Xmx7168m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
-      settings: 'yangtools-settings'
-      settings-type: cfp
-      global-settings: 'odl-global-settings'
-      global-settings-type: cfp
-      post-step-run-condition: 'SUCCESS'
-
-    postbuilders:
-      - trigger-builds:
-          - project: '{csit-list}'
-            block: true
-            predefined-parameters:
-              BUNDLEURL=$BUNDLEURL
+      - maven-target:
+          maven-version: mvn33
+          pom: patch_tester/pom.xml
+          # TODO: Make Maven options configurable. Currently tests are not skipped, everything else is.
+          goals: |
+              clean install dependency:tree -DoutputFile=dependency_tree.txt
+              -Pq
+              -Dstream={stream}
+              {opendaylight-infra-mvn-opts}
+          java-opts:
+            - '-Xmx7168m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
+          settings: integration-settings
+          settings-type: cfp
+          global-settings: odl-global-settings
+          global-settings-type: cfp
+      - distribution-check-deploy-distribution:
+          dist-pom: patch_tester/distribution/pom.xml
+      - conditional-step:
+          condition-kind: boolean-expression
+          condition-expression: $RUNTEST
+          steps:
+            - trigger-builds:
+                - project: '{csit-list}'
+                  block: true
+                  predefined-parameters:
+                    BUNDLEURL=$BUNDLE_URL
 
     publishers:
       - opendaylight-infra-shiplogs:
       - email-notification:
           email-recipients: '{email-recipients}'
           email-prefix: '[integration]'
+
+- job-template:
+    name: 'integration-distribution-high-frequency-test-trigger-{stream}'
+
+    project-type: freestyle
+    node: centos7-robot-2c-2g
+
+    properties:
+      - opendaylight-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+
+    parameters:
+      - integration-bundleurl:
+          bundleurl: '{bundleurl}'
+      - integration-jdk-version:
+          jdkversion: '{jre}'
+
+    triggers:
+      - timed: '{schedule-high-frequency}'
+
+    builders:
+      - trigger-builds:
+          - project: '{csit-high-frequency-list}'
+            block: true
+            predefined-parameters:
+              BUNDLEURL=$BUNDLEURL
+
+    publishers:
+      - email-notification:
+          email-recipients: '{email-recipients}'
+          email-prefix: '[integration]'
index 00c0e6fbc6360ccb0eda3b5fa079e49a986f728f..b45507557b2e7fbb8f66bafc92c82592abd15a72 100644 (file)
 
     functionality:
       - upstream-transparent:
-          schedule: 'H H * * *'
+          schedule: ''
           sg-mode: 'transparent'
       - upstream-stateful:
-          schedule: 'H H/4 * * *'
+          schedule: ''
           sg-mode: 'stateful'
       - upstream-learn:
-          schedule: 'H H * * *'
+          schedule: ''
           sg-mode: 'learn'
       - gate-learn:
           schedule: ''
 
     functionality:
       - upstream-stateful:
-          schedule: 'H H * * *'
+          schedule: ''
           sg-mode: 'stateful'
       - upstream-learn:
-          schedule: 'H H * * *'
+          schedule: ''
           sg-mode: 'learn'
 
     stream:
index ad53c5328efbe4de39c99467a90f8c5bf393077f..b8e0f72b1967db596b0e312a0549d7b652da8cb5 100644 (file)
           build-timeout: '{build-timeout}'
 
     triggers:
-      - timed: '@midnight'
       - gerrit:
           server-name: '{server-name}'
           trigger-on:
index cc2b73f7a94e3e3a88f30b138a7f8d761beea07d..c006e5082b1d440dd98ca0c47948ae5a30c8aafc 100644 (file)
@@ -9,7 +9,6 @@
     # Timeout in minutes
     build-timeout: 360
     build-node: centos7-java-builder-2c-8g
-    num-openstack-sites: 1
 
     email-recipients: 'jenkins@lists.opendaylight.org'
     odl-ml2-driver-repo: 'https://github.com/openstack/networking-odl'
     devstack-networking-sfc-plugin-repo: 'https://github.com/openstack/networking-sfc'
     server-name: 'OpenDaylight'
     git-url: 'ssh://jenkins-$SILO@git.opendaylight.org:29418'
-    ipsec-vxlan-tunnels-enabled: 'no'
 
-    public-bridge: 'br-physnet1'
-    public-physical-network: 'physnet1'
-    odl-enable-l3: 'yes'
-    odl-ml2-driver-version: 'v1'
-    odl-ml2-port-binding: 'network-topology'
-    enable-openstack-plugins: 'networking-odl'
-    enable-openstack-services: 'q-svc,q-dhcp,q-meta,n-cauth,tempest'
+    # defaults for parameters installing openstack for csit jobs
+    create-initial-networks: 'False'
+    disable-odl-l3-service-plugin: 'no'
     disable-openstack-services: 'swift,cinder,n-net,q-vpn,n-cpu'
     enable-networking-l2gw: 'no'
+    enable-openstack-plugins: 'networking-odl'
+    enable-openstack-services: 'q-svc,q-dhcp,q-meta,n-cauth,tempest'
+    ipsec-vxlan-tunnels-enabled: 'no'
     lbaas-service-provider: ''
-    create-initial-networks: 'False'
-    tenant-network-type: 'vxlan'
+    num-openstack-sites: 1
+    odl-enable-l3: 'yes'
+    odl-ml2-driver-version: 'v1'
+    odl-ml2-port-binding: 'network-topology'
+    public-bridge: 'br-physnet1'
+    public-physical-network: 'physnet1'
     security-group-mode: 'none'
+    tenant-network-type: 'vxlan'
 
     # openstack-infra-parameters defaults
     archive-artifacts: ''
     10-inclusion-flag: 'off'
     10-exclude-value: ''
 
-    # Manual CSIT job lists used by sanity
-    # and weekly distribution test jobs
+    # Manual CSIT job lists used by sanity or periodic in nature.
+    csit-high-frequency-list-carbon: >
+        netvirt-csit-1node-openstack-newton-nodl-v2-upstream-stateful-carbon
     csit-sanity-list-nitrogen: >
         openflowplugin-csit-1node-sanity-only-nitrogen
     csit-sanity-list-carbon: >
         armoury-csit-1node-basic-all-nitrogen,
         armoury-csit-1node-basic-only-nitrogen,
         bgpcep-csit-1node-periodic-bgp-ingest-all-nitrogen,
+        bgpcep-csit-1node-periodic-bgp-ingest-mixed-all-nitrogen,
+        bgpcep-csit-1node-periodic-bgp-ingest-mixed-only-nitrogen,
         bgpcep-csit-1node-periodic-bgp-ingest-only-nitrogen,
         bgpcep-csit-1node-periodic-throughpcep-all-nitrogen,
         bgpcep-csit-1node-periodic-throughpcep-only-nitrogen,
index a6a58855be87f4815dfa355c6eb2fd92529b7d58..ab2f6b732116cf37af44f28692655b97f71b4b3b 100644 (file)
           name: OS_CLOUD
           default: '{os-cloud}'
           description: |
-              The name of a cloud configuration in clouds.yaml.
+              The name of a cloud configuration in clouds.yaml. OS_CLOUD is a
+              variable name that is significant to openstack client as a
+              environment variable. Please refer to the documentation for
+              further details.
               https://docs.openstack.org/developer/python-openstackclient/
 
 - parameter:
           default: ''
           description: 'csv list of patches in project:changeset format to build distribution with'
 
+- parameter:
+    name: run-test-parameter
+    parameters:
+      - string:
+          name: RUNTEST
+          default: '{run-test}'
+          description: 'Set true to run test after build'
+
 - parameter:
     name: distribution-branch-to-build-parameter
     parameters:
       - maven-target:
           maven-version: 'mvn33'
           pom: '{pom}'
-          goals: >
+          goals: |
               clean deploy dependency:tree
               -DoutputFile=dependency_tree.txt
-              -V -B -Pq
-              -Djenkins
+              -Pq
               -DaltDeploymentRepository=fake-nexus::default::file:///tmp/n/
-              -Dmaven.repo.local=/tmp/r
-              -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
+              {mvn-opts}
           java-opts:
             - '-Xmx4096m -XX:MaxPermSize=1024m -Dmaven.compile.fork=true'
           settings: 'integration-settings'
       - maven-target:
           maven-version: 'mvn33'
           pom: '{dist-pom}'
-          goals: >
+          goals: |
               clean install dependency:tree
               -DoutputFile=dependency_tree.txt
-              -V -B -Pq
-              -Djenkins
-              -Dmaven.repo.local=/tmp/r
-              -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
+              -Pq
+              {mvn-opts}
           java-opts:
             - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
           settings: 'integration-settings'
       - maven-target:
           maven-version: 'mvn33'
           pom: '{dist-pom}'
-          goals: >
+          goals: |
               clean install dependency:tree
               -DoutputFile=dependency_tree.txt -s fake_remotes.xml
-              -V -B -Pq
+              -Pq
               -DskipTests=false
-              -Djenkins
-              -Dmaven.repo.local=/tmp/r
-              -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
+              {mvn-opts}
           java-opts:
             - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
+
+- builder:
+    name: distribution-check-deploy-distribution
+    # Deploy distribution-karaf zip to Nexus SNAPSHOT repo for testing.
+    # Arguments:
+    #   {settings-file} to use for opendaylight-snapshot credentials
+    builders:
+      - inject:
+          properties-content: BUNDLE_POM={dist-pom}
+      - shell: !include-raw-escape: deploy-distribution-get-vars.sh
+      - inject:
+          properties-file: deploy-distribution.env
+      - config-file-provider:
+          files:
+            - file-id: odl-global-settings
+              variable: GLOBAL_SETTINGS_FILE
+            - file-id: integration-settings
+              variable: SETTINGS_FILE
+      - shell: !include-raw-escape: deploy-distribution.sh
+      # Re-inject BUNDLE_URL so that downstream projects can use it.
+      - inject:
+          properties-file: deploy-distribution.env
index c6af80ec2fde9d7385bfcf1002e1a2360ea4a4c2..2db2ec9ae143192a4ee88544bed616fb76daa628 100644 (file)
@@ -93,6 +93,8 @@
           artifacts: '{archive-artifacts} **/dependency_tree.txt **/target/surefire-reports/*-output.txt'
       - integration-distribution-git-url:
           git-url: '{git-url}'
+      - maven-exec:
+          maven-version: mvn33
 
     scm:
       - integration-gerrit-scm:
       - distribution-check-wipe
       - distribution-check-build-project:
           pom: '$GERRIT_PROJECT/pom.xml'
+          mvn-opts: '{opendaylight-infra-mvn-opts}'
       - distribution-check-verify-groupid:
           gerrit-project: '$GERRIT_PROJECT'
       - distribution-check-download-deps:
           dist-pom: 'distribution/pom.xml'
+          mvn-opts: '{opendaylight-infra-mvn-opts}'
       - distribution-check-delete-snapshots
       - distribution-check-configure-remotes
       - distribution-check-repeat-build:
           dist-pom: 'distribution/pom.xml'
+          mvn-opts: '{opendaylight-infra-mvn-opts}'
+      - distribution-check-deploy-distribution:
+          dist-pom: distribution/pom.xml
       - integration-distribution-check
 
+
     publishers:
       - email-notification:
           email-recipients: '{email-recipients}'
           script-only-if-succeeded: false
           script-only-if-failed: false
           mark-unstable-if-failed: true
-      - archive:
-          artifacts: '*.zip'
       - opendaylight-infra-shiplogs:
           maven-version: 'mvn33'
 
diff --git a/scripts/branch_cut/branch_cut.awk b/scripts/branch_cut/branch_cut.awk
new file mode 100755 (executable)
index 0000000..f2d1991
--- /dev/null
@@ -0,0 +1,234 @@
+#!/usr/bin/awk -f
+
+# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
+##############################################################################
+# Copyright (c) 2017 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
+#
+##############################################################################
+
+BEGIN {
+    new_tag                     = new_reltag       # new release tag
+    curr_tag                    = curr_reltag      # current release tag
+    prev_tag                    = prev_reltag      # previous release tag
+
+    new_release                 = tolower(new_tag)
+    curr_release                = tolower(curr_tag)
+    prev_release                = tolower(prev_tag)
+
+    ws = "[\\t ]*"                                 # white-spaces
+    startpat = "^" ws "- project:"                 # start pattern
+    endpat = startpat                              # end pattern
+    op = "^" ws "---" ws "$"                       # match files starts with "---"
+
+    next_release_tag            = "^" ws "next-release-tag: " curr_tag
+    master                      = "'master'"
+    new_branch                  = "'stable/" new_release "'"
+    curr_branch                 = "'stable/" curr_release "'"
+    prev_branch                 = "'stable/" prev_release "'"
+
+    # replace block to add new release
+    new_rel_yaml_tag            = "- " new_release ":";
+    br_master_yaml_tag          = "    branch: 'master'";
+    jre_yaml_tag                = "    jre: 'openjdk8'";
+    curr_rel_yaml_tag           = "- " curr_release ":";
+    br_stable_curr_yaml_tag     = "    branch: 'stable/" curr_release "'";
+
+    # replace block for autorelease-projects
+    #new_rel_yaml_tag           = "- " new_release ":";
+    next_rel_tag_new_yaml_tag   = "    next-release-tag: " new_tag;
+    #br_master_yaml_tag         = "    branch: 'master'";
+    jdk_yaml_tag                = "    jdk: 'openjdk8'";
+    intg_test_yaml_tag          = "    integration-test: " new_release;
+    #curr_rel_yaml_tag          = "- " curr_release ":";
+    next_rel_tag_curr_yaml_tag  = "    next-release-tag: " curr_tag;
+    #br_stable_curr_yaml_tag    = "    branch: 'stable/" curr_release "'";
+
+    # search patterns
+    smaster = "^" ws "- master:"
+    sstream = "^" ws "stream:"
+    srelease = "^" ws "- " curr_release ":"
+    #if (l ~ next_release_tag) { next_release_tag = 1; continue; }
+    sbranch = "^" ws "branch: " master
+
+    debug = 0                                   # set to 1 to print debug info
+    file_format = 2                             # project stream format
+
+    release_found = 0
+    stream_found = 0
+    nrt_found = 0
+}
+
+{
+    # exit if release info is not available
+    if ((length(new_release) == 0 || length(curr_release) == 0)) {
+        exit;
+    }
+
+    # read all lines of the file into an array
+    file[NR] = $0
+}
+
+END {
+    n = NR                                      # total number of lines
+    find_blks()                                 # gets number of blocks between start/end pattern
+    process_blk(arr_bs[1], arr_be[1], 1)        # pass start and end of each block and process first block
+    update_file(arr_be[1])                      # write processed content
+
+    if (debug) {
+        print "number of blocks="nb;
+        print "total records in file[]="length(f);
+        print "size of firstblk[]="length(firstblk);
+        print "size of newblk[]="length(newblk);
+        print "size of oldmaster[]="length(oldmaster);
+        print "size of newblk[]="length(newblk);
+    }
+}
+
+function find_blks(   i, l, bs, be) {
+    for (i = 1; i <= n; i++) {
+        l = file[i]
+        if (l ~ startpat) project = 1                        # start pattern
+        if (bs > be && l ~ endpat) arr_be[++be] = i - 1      # block end
+        if (           l ~ startpat) arr_bs[++bs] = i - 1    # block start
+    }
+    nb = be
+
+    # to handle files with single blocks
+    if (nb == 0 && length(file) > 1 && project == 1) {
+        nb = 1
+        arr_bs[1] = 1                               # start after line '---'
+        arr_be[1] = length(file)                    # set length of the file
+    }
+
+    if (debug) {
+        for (i = 1; i < nb; i++)
+            print "find_blks: nb=" nb " arr_bs[" i "]="arr_bs[i]" arr_be[" i "]="arr_be[i];
+    }
+}
+
+function process_blk(bs, be, bn,   i, l) {
+    if (debug) {
+        print "process_blk: bn=" bn ", bs=" bs " ,be=" be
+    }
+
+    # get the first block
+    for (i = bs + 1; i <= be ; i++) {
+        l = file[i]
+        # determine file format
+        if (l ~ /stream:/) {
+            x=index(l,":")
+            s = substr(l, x+2, length(l) - x)
+            if (s == curr_release || s == new_release) {
+                file_format = 1
+            } else if (length(s) == 0 ) {
+                file_format = 0
+            }
+        }
+        firstblk[++nex] = l
+    }
+
+    if (debug) {
+        print "process_blk: stream='" s "' length(s)=" length(s)" file_format='" file_format "'"
+    }
+
+    # Handle single stream format
+    if (file_format == 1) {
+        # create new block to be inserted
+        for (i = 1; i <= length(firstblk); i++) {
+            l = firstblk[i]
+            if (l ~ /name:|stream:/) sub(curr_release, new_release, l)
+            newblk[++nex1] = l
+        }
+        # re-create old block and change master to stable/branch
+        for (i = 1; i <= length(firstblk)-1; i++) {
+            l = firstblk[i]
+            if (l ~ /branch:/) sub(master, curr_branch, l)
+            oldmaster[++nex2] = l
+        }
+    } else if (file_format == 0) {
+        # Handle multi-stream format
+        for (i = 1; i <= length(firstblk)-1; i++) {
+            l = firstblk[i]
+            if (l ~ sstream) { stream_found = 1; }
+            if (l ~ srelease) { release_found = 1; indent = substr(l, 1, index(l, "-")-1); continue; }
+            if (l ~ next_release_tag) { nrt_found = 1; continue; }
+            if (l ~ sbranch) {
+                # append lines
+                if (stream_found && release_found && !nrt_found) {
+                    newblk[++nex3] = indent new_rel_yaml_tag;
+                    newblk[++nex3] = indent br_master_yaml_tag;
+                    newblk[++nex3] = indent jre_yaml_tag;
+                    newblk[++nex3] = indent curr_rel_yaml_tag;
+                    newblk[++nex3] = indent br_stable_curr_yaml_tag;
+                    stream_found = 0; release_found = 0;
+                    continue;
+                }
+                if (stream_found && release_found && nrt_found) {
+                    newblk[++nex3] = indent new_rel_yaml_tag;
+                    newblk[++nex3] = indent next_rel_tag_new_yaml_tag;
+                    newblk[++nex3] = indent br_master_yaml_tag;
+                    newblk[++nex3] = indent jdk_yaml_tag;
+                    newblk[++nex3] = indent intg_test_yaml_tag;
+                    newblk[++nex3] = indent curr_rel_yaml_tag;
+                    newblk[++nex3] = indent next_rel_tag_curr_yaml_tag;
+                    newblk[++nex3] = indent br_stable_curr_yaml_tag;
+                    stream_found = 0; release_found = 0; nrt_found=0;
+                    continue;
+                }
+            }
+            newblk[++nex3] = l
+
+            if (debug) {
+                print "process_blk: append(newblk[]) : stream="stream" release_found="release_found
+            }
+        }
+    } else {
+        # exit on unknown file format
+        exit;
+    }
+}
+
+function update_file(be,   i, j, l) {
+    i = 1
+    # handle lines before "---"
+    while (i <= n) {
+        print l = file[i++]
+        if (l ~ op) break
+    }
+
+    if (debug) {
+        print "writing master block"
+    }
+
+    # Handle single stream format
+    if (file_format == 1) {
+        for (j = 1; j <= nex1; j++)                   # write new branch block
+            print newblk[j]
+
+        if (debug) {
+            print "writing stable block"
+        }
+
+        for (j = 1; j <= nex2; j++)                   # write updated branch block
+            print oldmaster[j]
+
+    # Handle multi-stream format
+    } else if (file_format == 0) {
+        # print the first block
+        for (j = 1; j <= nex3; j++)                   # write multi-stream block
+            print newblk[j]
+    }
+
+    if (debug) {
+        print "writing rest of the file"
+    }
+
+    while (be <= n) {                                 # write rest of the file
+        print file[be++]
+    }
+}
diff --git a/scripts/branch_cut/branch_cutter.sh b/scripts/branch_cut/branch_cutter.sh
new file mode 100755 (executable)
index 0000000..6f9c7a3
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
+##############################################################################
+# Copyright (c) 2017 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
+#
+##############################################################################
+
+# List of files exclude
+declare -a excludes=("releng-defaults.yaml"
+                     "releng-macros.yaml")
+
+TEMP="/tmp/tmp.yaml"
+mod=0
+count=0
+
+function usage {
+    echo "Usage: $(basename $0) options (-n [next release]) (-c [current release]) (-p [previous release]) -h for help";
+    exit 1;
+}
+
+if ( ! getopts ":n:c:p:h" opt ); then
+    usage;
+fi
+
+while getopts ":n:c:p:h" opt; do
+    case $opt in
+        n)
+            new_reltag=$OPTARG
+            ;;
+        c)
+            curr_reltag=$OPTARG
+            ;;
+        p)
+            prev_reltag=$OPTARG
+            ;;
+        \?)
+            echo "Invalid option: -$OPTARG" >&2
+            exit 1
+            ;;
+        h)
+            usage
+            ;;
+        :)
+            echo "Option -$OPTARG requires an argument." >&2
+            exit 1
+            ;;
+    esac
+done
+
+echo "Start Branch Cutting:"
+
+while IFS="" read -r y; do
+    found=0
+    for f in "${excludes[@]}"; do
+        if [[ $y =~ $f && $found -eq 0 ]]; then
+            found=1
+            break
+        fi
+    done
+    if [[ $found -eq 1 ]]; then
+        echo "Ignore file $y found in excludes list"
+    else
+        ./branch_cut.awk -v new_reltag="$new_reltag" -v curr_reltag="$curr_reltag" -v prev_reltag="$prev_reltag" "$y" > "$TEMP"
+        [[ ! -s "$TEMP" ]] && echo "$y: excluded"
+        [[ -s "$TEMP" ]] && mv "$TEMP" "$y" && echo "$y: Done" && let "mod++"
+        let "count++"
+    fi
+done < <(find ../../jjb -name "*.yaml")
+
+echo "Modified $mod out of $count files"
+echo "Completed"