Convert Maven Central parameter to macro 63/13663/6
authorThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 27 Nov 2018 04:45:08 +0000 (12:45 +0800)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 27 Nov 2018 16:05:53 +0000 (00:05 +0800)
This would make it easier for say ODL's autorelease project to
reuse this macro.

Change-Id: I73771b26041dd9e27ca470f3f9ebb54cbe67e654
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
.jjb-test/lf-macros/lf-maven-central-minimal.yaml [new file with mode: 0644]
docs/jjb/lf-macros.rst
jjb/lf-macros.yaml
jjb/lf-maven-jobs.yaml
releasenotes/notes/lf-maven-central-2aba5d88dfbae7a3.yaml [new file with mode: 0644]

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 (file)
index 0000000..5fb58b0
--- /dev/null
@@ -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}'
index afd6f28..4d2d4f5 100644 (file)
@@ -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
 ----------------
 
index 01cf059..206e717 100644 (file)
           - ../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:
index eb2c701..4bfb142 100644 (file)
           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 (file)
index 0000000..1878000
--- /dev/null
@@ -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