Fix OS_CLOUD export for image validation
[releng/global-jjb.git] / shell / maven-javadoc-generate.sh
index 6199b4d..ec4743a 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -l
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2017 The Linux Foundation and others.
@@ -8,12 +8,12 @@
 # which accompanies this distribution, and is available at
 # http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
-
+echo "---> maven-javadoc-generate.sh"
 # Generates javadoc in a Maven project.
 
 # DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound.
 # Ensure we fail the job if any steps fail.
-set -e -o pipefail
+set -xe -o pipefail
 set +u
 
 JAVADOC_DIR="$WORKSPACE/archives/javadoc"
@@ -24,7 +24,7 @@ export MAVEN_OPTS
 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
 # shellcheck disable=SC2086
 $MVN clean install javadoc:aggregate \
-    -Pq -Dmaven.javadoc.skip=false \
+    -e -Pq -Dmaven.javadoc.skip=false \
     -DskipTests=true \
     -Dcheckstyle.skip=true \
     -Dfindbugs.skip=true \
@@ -33,3 +33,14 @@ $MVN clean install javadoc:aggregate \
     $MAVEN_OPTIONS $MAVEN_PARAMS
 
 mv "$WORKSPACE/target/site/apidocs" "$JAVADOC_DIR"
+
+# TODO: Nexus unpack plugin throws a "504 gateway timeout" for jobs archiving
+# large number of small files. Remove the workaround only we move away from
+# using Nexus as the log server.
+if [[ "$JOB_NAME" =~ "javadoc-verify" ]]; then
+    # Tarball the javadoc dir and rm the directory to avoid re-upload into logs
+    pushd "$JAVADOC_DIR"
+    tar cvJf "$WORKSPACE/archives/javadoc.tar.xz" .
+    rm -rf "$JAVADOC_DIR"
+    popd
+fi