Fix: Switch maven-build vars to double quotes 56/74056/2 v0.92.11
authorEric Ball <eball@linuxfoundation.org>
Tue, 13 Jan 2026 02:19:53 +0000 (18:19 -0800)
committerEric Ball <eball@linuxfoundation.org>
Tue, 13 Jan 2026 04:33:48 +0000 (20:33 -0800)
The previous fix had the $WORKSPACE env var in a single-quoted string,
causing it not to expand when run. This was causing builds to be put
in a directory with the literal name '$WORKSPACE' rather than the
actual Jenkins workspace.

Issue: IT-29164
Change-Id: I2055a32a82d282d1c130d2d09fc0819da8b127a3
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
releasenotes/notes/fix-maven-build-quotes-cc42f697184a42f0.yaml [new file with mode: 0644]
shell/maven-build.sh

diff --git a/releasenotes/notes/fix-maven-build-quotes-cc42f697184a42f0.yaml b/releasenotes/notes/fix-maven-build-quotes-cc42f697184a42f0.yaml
new file mode 100644 (file)
index 0000000..562055c
--- /dev/null
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    The previous fix had an environment variable contained in single quotes,
+    causing it to not to expand when run. Putting the entire string into double
+    quotes solves the issue while maintaining the validity of the string.
index d4b2ddd..6829d10 100644 (file)
@@ -24,15 +24,9 @@ plugin_version=$($MVN help:describe -Dplugin=org.apache.maven.plugins:maven-depl
     | grep "^Version:" | awk '{print $2}' || echo "2.8.2")
 
 if [[ "${plugin_version%%.*}" -lt 3 ]]; then  # Compare only major version number
-  # Disable SC2016 because we don't want $WORKSPACE to be expanded here.
-  # shellcheck disable=SC2016
-  alt_repo='-DaltDeploymentRepository=staging::default::file:"$WORKSPACE"/m2repo'
+  alt_repo="-DaltDeploymentRepository=staging::default::file:$WORKSPACE/m2repo"
 else
-  # Disable SC2016 because we don't want $WORKSPACE to be expanded here.
-  # shellcheck disable=SC2016
-  # Disable SC2089 because the embedded quotes are intentional.
-  # shellcheck disable=SC2089
-  alt_repo='-DaltDeploymentRepository=staging::file:"$WORKSPACE"/m2repo'
+  alt_repo="-DaltDeploymentRepository=staging::file:$WORKSPACE/m2repo"
 fi
 
 export MAVEN_OPTS