From: Eric Ball Date: Wed, 9 Jan 2019 17:07:16 +0000 (-0800) Subject: Check MAVEN_PARAMS for -f flag in metadata fetch X-Git-Tag: v0.29.0~2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=c9e5000a4fdfbb63543b543814e95a480f09f743;p=releng%2Fglobal-jjb.git Check MAVEN_PARAMS for -f flag in metadata fetch maven-fetch-metadata.sh was not respecting the "-f" (for file path) flag in MAVEN_PARAMS, causing lf-maven-merge jobs that utilize this flag to fail. Issue: RELENG-1630 Change-Id: I23803fd2e4a46022d85dc2befab1438853c7c3ca Signed-off-by: Eric Ball --- diff --git a/releasenotes/notes/metadata-pom-path-d67d24874f3e1f43.yaml b/releasenotes/notes/metadata-pom-path-d67d24874f3e1f43.yaml new file mode 100644 index 00000000..04ebaed5 --- /dev/null +++ b/releasenotes/notes/metadata-pom-path-d67d24874f3e1f43.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + maven-fetch-metadata.sh was not respecting the "-f" (for file path) + flag in MAVEN_PARAMS, causing lf-maven-merge jobs that utilize this + flag to fail. It will now set a path based on this flag if it is present, + or default to the current working directory. diff --git a/shell/maven-fetch-metadata.sh b/shell/maven-fetch-metadata.sh index 26b2c96e..4696451b 100644 --- a/shell/maven-fetch-metadata.sh +++ b/shell/maven-fetch-metadata.sh @@ -11,6 +11,13 @@ # Uses wget to fetch a project's maven-metadata.xml files from a Maven repository. +# Check for "-f" maven param, indicating a change in pom location. +pom_path="pom.xml" +file_path=$(echo $MAVEN_PARAMS | grep -E "\-f \S+" | awk '{ print $2 }') +if [ ! -z $file_path ]; then + pom_path="$file_path/pom.xml" +fi + # Ensure we fail the job if any steps fail. set -xeu -o pipefail @@ -20,7 +27,7 @@ project=$(xmlstarlet sel \ -v "/x:project/x:groupId" \ --elif "/x:project/x:parent/x:groupId" \ -v "/x:project/x:parent/x:groupId" \ - --else -o "" pom.xml) + --else -o "" $pom_path) project_path="${project//.//}" mkdir -p "$WORKSPACE/m2repo/$project_path"