From: Thanh Ha Date: Fri, 19 Jan 2018 01:10:24 +0000 (-0500) Subject: Split maven-deploy into a macro X-Git-Tag: v0.16.0~21^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=7ff047e6606b384cd84cd6dbc5bea3d93e29357f;p=releng%2Fglobal-jjb.git Split maven-deploy into a macro Split out maven-deploy into a reusable macro. Change-Id: I6ddad68576cdbf9d9ef8b4805da94dc6a80cbefd Signed-off-by: Thanh Ha --- diff --git a/docs/jjb/lf-maven-jobs.rst b/docs/jjb/lf-maven-jobs.rst index 6073594c..d1acc8de 100644 --- a/docs/jjb/lf-maven-jobs.rst +++ b/docs/jjb/lf-maven-jobs.rst @@ -57,6 +57,10 @@ lf-maven-common Common Jenkins configuration for Maven jobs. +lf-maven-deploy +--------------- + +Calls the maven deploy script to push artifacts to Nexus. Job Templates ============= diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index 8b3f3ace..d2901156 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -48,6 +48,17 @@ - github-maven-javadoc-publish - github-maven-javadoc-verify +########## +# Macros # +########## + +- builder: + name: lf-maven-deploy + builders: + - shell: !include-raw: + - ../shell/common-variables.sh + - ../shell/maven-deploy.sh + #################### # COMMON FUNCTIONS # #################### @@ -502,7 +513,7 @@ - ../shell/common-variables.sh - ../shell/maven-fetch-metadata.sh - ../shell/maven-build.sh - - ../shell/maven-deploy.sh + - lf-maven-deploy - lf-provide-maven-settings-cleanup publishers: diff --git a/shell/common-variables.sh b/shell/common-variables.sh index 20c1c5c7..7bbc36fe 100644 --- a/shell/common-variables.sh +++ b/shell/common-variables.sh @@ -20,3 +20,10 @@ MAVEN_OPTIONS="$(echo --show-version \ -Dmaven.repo.local=/tmp/r \ -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r)" echo "$MAVEN_OPTIONS" + +# Activates the lftools virtualenv +lftools_activate() { + virtualenv --quiet "/tmp/v/lftools" + # shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091 + source "/tmp/v/lftools/bin/activate" +} diff --git a/shell/maven-deploy.sh b/shell/maven-deploy.sh index 15928eea..6d4165ed 100644 --- a/shell/maven-deploy.sh +++ b/shell/maven-deploy.sh @@ -20,6 +20,8 @@ set -eu -o pipefail m2repo_dir="$WORKSPACE/m2repo" nexus_repo_url="$NEXUS_URL/content/repositories/$NEXUS_REPO" +lftools_activate + # Remove metadata files that were not updated. set +e # Temporarily disable to run diff command. IFS=" " read -r -a metadata_files <<< "$(diff -s -r "$m2repo_dir" "$WORKSPACE/m2repo-backup" \