jenkinsci / jenkinsci/matrix-project-plugin
[JENKINS-5084] WORKSPACE env variable is incorrect for matrix project on windows slaves
- Dominant language
- Java
- Stars
- 17
- Forks
- 85
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 5
Description
WORKSPACE environment variable should have a windows format on windows platform.
The synthax is \workspace\\label/windows if (windows is the node alias)
This is for me a major drawback as workspace env variable is important.
To reproduce:
I create a matrix project "test_matrix" executed on 2 nodes (windows & solaris) for each platform define an env ARCH var=sunos/winnt
-------- configure ant task and a build.xml to execute a windows or unix script according platform.
Launch compilations on winnt: ${env.ARCH}
Launch compilations on unix: ${env.ARCH}
------- script for solaris unix
runKDBcc.sh
#! /bin/sh
echo $WORKSPACE
cd $WORKSPACE
------- script for windows
runKDBcc.bat
echo %WORKSPACE%
cd %WORKSPACE%
------- The results on windows with workspace bad name after label.
test:
[echo] Launch compilations on winnt: winnt
[exec]
[exec] The syntax of the command is incorrect.
[exec] C:\slave_hudson\workspace\test_matrix\label\winnt>echo C:\slave_hudson\workspace\test_matrix\label/winnt
[exec] C:\slave_hudson\workspace\test_matrix\label/winnt
[exec]
[exec] C:\slave_hudson\workspace\test_matrix\label\winnt>cd C:\slave_hudson\workspace\test_matrix\label/winnt
[exec]
---
Originally reported by erwan_q, imported from: WORKSPACE env variable is incorrect for matrix project on windows slaves
Raw content of original issue
WORKSPACE environment variable should have a windows format on windows platform.
The synthax is <Hudson_Root>\workspace\<project name>\label/windows if (windows is the node alias)
This is for me a major drawback as workspace env variable is important.To reproduce:
I create a matrix project "test_matrix" executed on 2 nodes (windows & solaris) for each platform define an env ARCH var=sunos/winnt
-------- configure ant task and a build.xml to execute a windows or unix script according platform.
<?xml version='1.0'?>
<project name="MyTest" default="test" basedir=".">
<property environment="env"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<target name="test" description="run test">
<if>
<equals arg1="${env.ARCH}" arg2="winnt" />
<then>
<echo>Launch compilations on winnt: ${env.ARCH}</echo>
<exec executable="runKDBcc.bat" failonerror="true" />
</then>
<else>
<echo>Launch compilations on unix: ${env.ARCH}</echo>
<exec executable="runKDBcc.sh" failonerror="true" />
</else>
</if>
</target>
</project>
------- script for solaris unix
runKDBcc.sh
#! /bin/sh
echo $WORKSPACE
cd $WORKSPACE
------- script for windows
runKDBcc.bat
echo %WORKSPACE%
cd %WORKSPACE%------- The results on windows with workspace bad name after label.
test:
[echo] Launch compilations on winnt: winnt
[exec]
[exec] The syntax of the command is incorrect.
[exec] C:\slave_hudson\workspace\test_matrix\label\winnt>echo C:\slave_hudson\workspace\test_matrix\label/winnt
[exec] C:\slave_hudson\workspace\test_matrix\label/winnt
[exec]
[exec] C:\slave_hudson\workspace\test_matrix\label\winnt>cd C:\slave_hudson\workspace\test_matrix\label/winnt
[exec]
environment
```
master on unix (solaris)
slave on windows
```
Contributor guide
Research direction
Start with the matrix project configuration and build.xml reproduction, then run runKDBcc.bat on a Windows slave while inspecting how WORKSPACE is assembled for the matrix label. Compare the observed mixed-separator value with the expected Windows path. Done means the reproduction can echo and cd to a valid Windows WORKSPACE path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100