From: Thanh Ha Date: Thu, 19 May 2016 23:05:36 +0000 (-0400) Subject: Improve p2deploy scripts to support snapshot deploy X-Git-Tag: release/beryllium-sr3~347 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=c0bb22d63b1f1fe08e2550e400976d4cca3bc42f;hp=-c;p=releng%2Fbuilder.git Improve p2deploy scripts to support snapshot deploy - Will deploy a release if an opendaylight.snapshot URL is not found - Will deploy latest SNAPSHOT build if P2ZIP_URL is blank - Will deploy snapshot build if P2ZIP_URL contains opendaylight.snapshot TODO: - Currently hardcoded version to 1.1.1-SNAPSHOT it would be better if we can detect the latest x.y.z-SNAPSHOT automatically Bug: 5869 Change-Id: I1fe343e0664ae8badc1f1f2bce88f66dea759c19 Signed-off-by: Thanh Ha --- c0bb22d63b1f1fe08e2550e400976d4cca3bc42f diff --git a/jjb/include-raw-generate-p2pom.sh b/jjb/include-raw-generate-p2pom.sh index 5e5ffde6f..8a9731703 100644 --- a/jjb/include-raw-generate-p2pom.sh +++ b/jjb/include-raw-generate-p2pom.sh @@ -9,10 +9,23 @@ # http://www.eclipse.org/legal/epl-v10.html ############################################################################## -FILE_NAME=`echo $P2ZIP_URL | awk -F'/' '{ print $NF }'` -VERSION=`echo $P2ZIP_URL | awk -F'/' '{ print $(NF-1) }'` +if [[ $P2ZIP_URL == "" ]]; then + P2ZIP_URL=opendaylight.snapshot/$(find . -name "*.zip" -type f -exec ls "{}" + | head -1) + FILE_NAME=`echo $P2ZIP_URL | awk -F'/' '{ print $NF }'` + RELEASE_PATH="snapshot" +else + FILE_NAME=`echo $P2ZIP_URL | awk -F'/' '{ print $NF }'` + VERSION=`echo $P2ZIP_URL | awk -F'/' '{ print $(NF-1) }'` + RELEASE_PATH="release/$VERSION" + wget --quiet $P2ZIP_URL -O $FILE_NAME +fi -wget $P2ZIP_URL -O $FILE_NAME +# If we detect a snapshot build then release to a snapshot repo +# YangIDE has indicated that the only want the latest snapshot released to +# the snapshot directory. +if echo $P2ZIP_URL | grep opendaylight.snapshot; then + RELEASE_PATH="snapshot" +fi cat > ${WORKSPACE}/pom.xml < @@ -47,7 +60,7 @@ cat > ${WORKSPACE}/pom.xml <opendaylight-p2 https://nexus.opendaylight.org/service/local/repositories/p2repos/content-compressed $FILE_NAME - org.opendaylight.$PROJECT/$VERSION + org.opendaylight.$PROJECT/$RELEASE_PATH diff --git a/jjb/include-raw-update-p2composite-metadata.sh b/jjb/include-raw-update-p2composite-metadata.sh index f4223af4a..353689b86 100644 --- a/jjb/include-raw-update-p2composite-metadata.sh +++ b/jjb/include-raw-update-p2composite-metadata.sh @@ -9,6 +9,16 @@ # http://www.eclipse.org/legal/epl-v10.html ############################################################################## +# If we detect a snapshot build then there is no need to run this script. +# YangIDE has indicated that the only want the latest snapshot released to +# the snapshot directory. +if echo $P2ZIP_URL | grep opendaylight.snapshot; then + exit 0 +fi +if [[ "$P2ZIP_URL" == "" ]]; then + exit 0 +fi + EPOCH_DATE=`date +%s%3N` MVN_METADATA=`echo $P2ZIP_URL | sed 's,/*[^/]\+/*$,,' | sed 's,/*[^/]\+/*$,,'`/maven-metadata.xml P2_COMPOSITE_ARTIFACTS=compositeArtifacts.xml @@ -109,7 +119,7 @@ cat > deploy-composite-repo.xml <opendaylight-p2 https://nexus.opendaylight.org/service/local/repositories/p2repos/content-compressed composite-repo.zip - org.opendaylight.$PROJECT + org.opendaylight.$PROJECT/release diff --git a/jjb/releng-macros.yaml b/jjb/releng-macros.yaml index 8c8ad0884..5234161e2 100644 --- a/jjb/releng-macros.yaml +++ b/jjb/releng-macros.yaml @@ -268,6 +268,25 @@ - file-id: '{settings-file}' variable: 'SETTINGS_FILE' +- builder: + name: releng-fetch-p2zip-if-necessary + builders: + - shell: | + # Cleanup any existing zips and metadata before we download the new update site + rm -f *.zip *.xml + - conditional-step: + condition-kind: strings-match + condition-string1: '$P2ZIP_URL' + condition-string2: '' + condition-basedir: workspace + steps: + # TODO: Figure out latest snapshot version number to pull rather than hardcoding 1.1.1-SNAPSHOT + - maven-target: + maven-version: '{maven-version}' + goals: 'org.apache.maven.plugins:maven-dependency-plugin:get org.apache.maven.plugins:maven-dependency-plugin:copy -V -B -Dartifact=org.opendaylight.yangide:org.opendaylight.yangide.update-site:1.1.1-SNAPSHOT:zip -DoutputDirectory=$WORKSPACE' + settings: '{settings}' + global-settings: '{global-settings}' + - builder: name: releng-generate-p2pom builders: @@ -277,12 +296,17 @@ name: releng-update-p2composite-metadata builders: - shell: !include-raw: include-raw-update-p2composite-metadata.sh - - maven-target: - maven-version: '{maven-version}' - pom: 'deploy-composite-repo.xml' - goals: 'clean deploy -V -Dmaven.repo.local=/tmp/r' - settings: '{settings}' - global-settings: '{global-settings}' + - conditional-step: + condition-kind: file-exists + condition-filename: deploy-composite-repo.xml + condition-basedir: workspace + steps: + - maven-target: + maven-version: '{maven-version}' + pom: 'deploy-composite-repo.xml' + goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r' + settings: '{settings}' + global-settings: '{global-settings}' - builder: name: releng-stage-release diff --git a/jjb/releng-templates.yaml b/jjb/releng-templates.yaml index 3b6dd9126..c39080eca 100644 --- a/jjb/releng-templates.yaml +++ b/jjb/releng-templates.yaml @@ -77,12 +77,16 @@ prebuilders: - wipe-org-opendaylight-repo - jacoco-nojava-workaround + - releng-fetch-p2zip-if-necessary: + maven-version: '{mvn33}' + settings: '{project-settings}' + global-settings: '{odl-global-settings}' - releng-generate-p2pom maven: maven-name: '{mvn33}' root-pom: 'pom.xml' - goals: 'clean deploy -V -Dmaven.repo.local=/tmp/r' + goals: 'clean deploy -V -B -Dmaven.repo.local=/tmp/r' settings: '{project-settings}' global-settings: '{odl-global-settings}' post-step-run-condition: UNSTABLE