Use lftools nexus-zip command to deploy Maven site 15/59715/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 29 Jun 2017 22:42:16 +0000 (18:42 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 30 Jun 2017 01:16:49 +0000 (21:16 -0400)
Rather than uploading 1 small file at a time using cURL to upload a
Nexus site allows us to push a single binary blob to the site url. This
massively speeds up site deploys.

Issue: RELENG-210
Change-Id: I365739ce13cfe805fe3ec51ad10c5b974647c9a0
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/opendaylight-infra-deploy-maven-site.sh [new file with mode: 0644]
jjb/releng-macros.yaml
jjb/releng-templates-java.yaml

diff --git a/jjb/opendaylight-infra-deploy-maven-site.sh b/jjb/opendaylight-infra-deploy-maven-site.sh
new file mode 100644 (file)
index 0000000..6664532
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
+##############################################################################
+# Copyright (c) 2017 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+# Ensure we fail the job if any steps fail.
+set -eu -o pipefail
+
+MAVEN_GROUP_ID=$(xmlstarlet sel \
+      -N "x=http://maven.apache.org/POM/4.0.0" \
+      -t \
+      --if "/x:project/x:groupId" \
+      -v "/x:project/x:groupId" \
+      --elif "/x:project/x:parent/x:groupId" \
+      -v "/x:project/x:parent/x:groupId" \
+      --else -o "" \
+      pom.xml 2>/dev/null)
+
+cd "$WORKSPACE/target"
+mv staged-site "$STREAM"
+zip -r maven-site.zip "$STREAM"
+lftools deploy nexus-zip "$NEXUS_URL" site "$MAVEN_GROUP_ID" maven-site.zip
index fc4395df47a0908d795df551864af5f947930938..75ab2cfb6ba5f6a3360989e0f5da0c4aedc8412b 100644 (file)
                 healthy: 50
                 unhealthy: 40
 
+- builder:
+    # Deploys a maven site to Nexus using lftools nexus-zip command
+    name: opendaylight-infra-deploy-maven-site
+    builders:
+      - lf-provide-maven-settings:
+          global-settings-file: global-settings
+          settings-file: '{settings-file}'
+      - lf-infra-create-netrc:
+          server-id: opendaylight-site
+      - shell: !include-raw-escape:
+          - global-jjb/shell/lftools-install.sh
+          - opendaylight-infra-deploy-maven-site.sh
+      - lf-provide-maven-settings-cleanup
+
 - builder:
     name: opendaylight-infra-stack
     # opendaylight-infra-stack.sh has a required variable {stack-template} that
index ee30c6ba9be8e697b57efb216f70d366eb21891e..3cd9c2cb82d95ff68387785d2840e66dca6961d6 100644 (file)
           branch: '{branch}'
           refspec: 'refs/heads/{branch}'
           artifacts: '{archive-artifacts}'
+      - string:
+          name: STREAM
+          default: '{stream}'
+          description: "String representing release name"
 
     scm:
       - gerrit-trigger-scm:
                 settings-type: cfp
                 global-settings: 'global-settings'
                 global-settings-type: cfp
-            - maven-target:
-                maven-version: 'mvn33'
-                pom: deploy-site.xml
-                goals: 'site:deploy -V -B -Dstream={stream}'
-                java-opts:
-                  - '-Xmx2g'
-                settings: '{mvn-settings}'
-                settings-type: cfp
-                global-settings: 'global-settings'
-                global-settings-type: cfp
+            - opendaylight-infra-deploy-maven-site:
+                settings-file: '{mvn-settings}'
 
     reporters:
       - findbugs