X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fmaven-javadoc-generate.sh;h=4a66eece197bc9f446f127e5b69b22157b0d813a;hb=b9eb4581940562effcf67863704a3ec2c47ceca0;hp=ec4743a742df4c367ce1b8ed13f25f603a8c03f9;hpb=de18ad26d2d5c8e0aa65483813ba1092abe80191;p=releng%2Fglobal-jjb.git diff --git a/shell/maven-javadoc-generate.sh b/shell/maven-javadoc-generate.sh index ec4743a7..4a66eece 100644 --- a/shell/maven-javadoc-generate.sh +++ b/shell/maven-javadoc-generate.sh @@ -1,4 +1,4 @@ -#!/bin/bash -l +#!/bin/bash # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. @@ -11,9 +11,9 @@ 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 -xe -o pipefail +# DO NOT enable -u because $MAVEN_PARAMS and $MAVEN_OPTIONS could be unbound. +set -e -o pipefail set +u JAVADOC_DIR="$WORKSPACE/archives/javadoc" @@ -21,9 +21,16 @@ mkdir -p "$WORKSPACE/archives" export MAVEN_OPTS +# use absolute path as workaround for javadoc:aggregate +# silent failure on relative path, for example "-f ." +maven_dir_abs=$(readlink -f "$MAVEN_DIR") + # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters. # shellcheck disable=SC2086 -$MVN clean install javadoc:aggregate \ +# Use -x via subshell to show maven invocation details in the log +(set -x + $MVN clean install javadoc:aggregate \ + -f "$maven_dir_abs" \ -e -Pq -Dmaven.javadoc.skip=false \ -DskipTests=true \ -Dcheckstyle.skip=true \ @@ -31,16 +38,19 @@ $MVN clean install javadoc:aggregate \ --global-settings "$GLOBAL_SETTINGS_FILE" \ --settings "$SETTINGS_FILE" \ $MAVEN_OPTIONS $MAVEN_PARAMS +) -mv "$WORKSPACE/target/site/apidocs" "$JAVADOC_DIR" +mv "$WORKSPACE/$MAVEN_DIR/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 +# large number of small files. Remove the workaround when 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 + tarball="$WORKSPACE/archives/javadoc.tar.xz" + echo "INFO: archiving $JAVADOC_DIR as $tarball" pushd "$JAVADOC_DIR" - tar cvJf "$WORKSPACE/archives/javadoc.tar.xz" . - rm -rf "$JAVADOC_DIR" + tar cvJf "$tarball" . popd + rm -rf "$JAVADOC_DIR" fi