From a7822fcdc18c0730d931851b4297a78413f59e2c Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Tue, 27 Nov 2018 12:45:08 +0800 Subject: [PATCH] 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 --- .jjb-test/lf-macros/lf-maven-central-minimal.yaml | 19 ++++++++++++++++++ docs/jjb/lf-macros.rst | 23 ++++++++++++++++++++++ jjb/lf-macros.yaml | 13 ++++++++++++ jjb/lf-maven-jobs.yaml | 12 +++-------- .../notes/lf-maven-central-2aba5d88dfbae7a3.yaml | 8 ++++++++ 5 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 .jjb-test/lf-macros/lf-maven-central-minimal.yaml create mode 100644 releasenotes/notes/lf-maven-central-2aba5d88dfbae7a3.yaml 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 -- 2.16.6