From: Thanh Ha Date: Tue, 27 Nov 2018 04:45:08 +0000 (+0800) Subject: Convert Maven Central parameter to macro X-Git-Tag: v0.28.0~1 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F63%2F13663%2F6;p=releng%2Fglobal-jjb.git Convert Maven Central parameter to macro This would make it easier for say ODL's autorelease project to reuse this macro. Change-Id: I73771b26041dd9e27ca470f3f9ebb54cbe67e654 Signed-off-by: Thanh Ha --- diff --git a/.jjb-test/lf-macros/lf-maven-central-minimal.yaml b/.jjb-test/lf-macros/lf-maven-central-minimal.yaml new file mode 100644 index 00000000..5fb58b0e --- /dev/null +++ b/.jjb-test/lf-macros/lf-maven-central-minimal.yaml @@ -0,0 +1,19 @@ +--- +- job-template: + name: lf-maven-central-macro-test + + ##################### + # Default variables # + ##################### + + mvn-central: true + ossrh-profile-id: '' + + ##################### + # Job configuration # + ##################### + + builders: + - lf-maven-central: + mvn-central: '{mvn-central}' + ossrh-profile-id: '{ossrh-profile-id}' diff --git a/docs/jjb/lf-macros.rst b/docs/jjb/lf-macros.rst index afd6f288..4d2d4f5f 100644 --- a/docs/jjb/lf-macros.rst +++ b/docs/jjb/lf-macros.rst @@ -164,6 +164,29 @@ lf-jacoco-nojava-workaround Workaround for Jenkins not able to find Java in JaCoCo runs. +.. _lf-maven-central: + +lf-maven-central +---------------- + +Publish artifacts to OSSRH (Maven Central) staging. + +Requires that the project's settings.xml contains a ServerId 'ossrh' with the +credentials for the project's OSSRH account. + +This macro assumes the directory ``$WORKSPACE/m2repo`` contains a Maven 2 +repository which is to upload to OSSRH. + +:Required parameters: + + :mvn-central: Whether or not to upload to mvn-central. (true|false) + :ossrh-profile-id: Nexus staging profile ID as provided by OSSRH. + +.. literalinclude:: ../../.jjb-test/lf-macros/lf-maven-central-minimal.yaml + :language: yaml + +.. _lf-maven-install: + lf-maven-install ---------------- diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index 01cf0595..206e717e 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -175,6 +175,19 @@ - ../shell/deploy-maven-file.sh - lf-provide-maven-settings-cleanup +- builder: + name: lf-maven-central + builders: + - conditional-step: + condition-kind: boolean-expression + condition-expression: '{mvn-central}' + steps: + - lf-infra-create-netrc: + server-id: 'ossrh' + - inject: + properties-content: 'OSSRH_PROFILE_ID={ossrh-profile-id}' + - shell: !include-raw-escape: ../shell/maven-central.sh + - builder: name: lf-maven-install builders: diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index eb2c701c..4bfb1427 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -725,15 +725,9 @@ sign-artifacts: '{sign-artifacts}' sign-dir: '$WORKSPACE/m2repo' - lf-maven-stage - - conditional-step: - condition-kind: boolean-expression - condition-expression: '{mvn-central}' - steps: - - lf-infra-create-netrc: - server-id: 'ossrh' - - inject: - properties-content: 'OSSRH_PROFILE_ID={ossrh-profile-id}' - - shell: !include-raw-escape: ../shell/maven-central.sh + - lf-maven-central: + mvn-central: '{mvn-central}' + ossrh-profile-id: '{ossrh-profile-id}' - lf-provide-maven-settings-cleanup - job-template: diff --git a/releasenotes/notes/lf-maven-central-2aba5d88dfbae7a3.yaml b/releasenotes/notes/lf-maven-central-2aba5d88dfbae7a3.yaml new file mode 100644 index 00000000..1878000e --- /dev/null +++ b/releasenotes/notes/lf-maven-central-2aba5d88dfbae7a3.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + New macro **lf-maven-central** is available to deploy artifacts to OSSRH + staging for jobs that want to eventually deploy to Maven Central. + + .. literalinclude:: ../.jjb-test/lf-macros/lf-maven-central-minimal.yaml + :language: yaml