jenkinsci / pyenv-pipeline-plugin

Execute commands in Python virtualenvs in Jenkins Pipeline DSL
https://plugins.jenkins.io/pyenv-pipeline/
MIT License
33 stars 15 forks source link

Unable to find executable in PATH when using the plugin on Windows. #41

Open Proksima opened 4 years ago

Proksima commented 4 years ago

This is on Windows 10.

Minimal reproduction:

steps {
    bat "ECHO ${env.PATH}"
    bat "WHERE hg"

    withPythonEnv(params.PYTHON_VERSION) {
        bat "ECHO ${env.PATH}"
        bat "WHERE hg"
    }
}

And the generated logs:

[Pipeline] bat
11:23:46  
11:23:46  C:\Jenkins\workspace\main_SDK-4633-build-system>ECHO C:\Python38\Scripts\;C:\Python38\;C:\Python37\Scripts\;C:\Python37\;C:\Python36\Scripts\;C:\Python36\;C:\Python35\Scripts\;C:\Python35\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Amazon\cfn-bootstrap\;C:\ProgramData\chocolatey\bin;C:\Program Files\Amazon\AWSCLI\bin\;C:\Program Files\doxygen\bin;C:\Program Files\Git\cmd;C:\Go\bin;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Program Files\LLVM\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\ProgramData\nvm;C:\Program Files\nodejs;C:\tools\python;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\go\bin;C:\Program Files\Mercurial\ 
11:23:46  C:\Python38\Scripts\;C:\Python38\;C:\Python37\Scripts\;C:\Python37\;C:\Python36\Scripts\;C:\Python36\;C:\Python35\Scripts\;C:\Python35\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Amazon\cfn-bootstrap\;C:\ProgramData\chocolatey\bin;C:\Program Files\Amazon\AWSCLI\bin\;C:\Program Files\doxygen\bin;C:\Program Files\Git\cmd;C:\Go\bin;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Program Files\LLVM\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\ProgramData\nvm;C:\Program Files\nodejs;C:\tools\python;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\go\bin;C:\Program Files\Mercurial\
[Pipeline] bat
11:23:47  
11:23:47  C:\Jenkins\workspace\main_SDK-4633-build-system>WHERE hg 
11:23:47  C:\Program Files\Mercurial\hg.exe
[Pipeline] withPythonEnv
11:23:47  Matched ShiningPanda tool name: python-3.8

[Pipeline] {
[Pipeline] bat
11:23:47  
11:23:47  (.pyenv-python-3.8) C:\Jenkins\workspace\main_SDK-4633-build-system>
ECHO C:\Jenkins\workspace\main_SDK-4633-build-system\.pyenv-python-3.8\Scripts;C:\Python38\Scripts\;C:\Python38\;C:\Python37\Scripts\;C:\Python37\;C:\Python36\Scripts\;C:\Python36\;C:\Python35\Scripts\;C:\Python35\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Amazon\cfn-bootstrap\;C:\ProgramData\chocolatey\bin;C:\Program Files\Amazon\AWSCLI\bin\;C:\Program Files\doxygen\bin;C:\Program Files\Git\cmd;C:\Go\bin;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Program Files\LLVM\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\ProgramData\nvm;C:\Program Files\nodejs;C:\tools\python;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\go\bin;C:\Program Files\Mercurial\ 
11:23:47  C:\Jenkins\workspace\main_SDK-4633-build-system\.pyenv-python-3.8\Scripts;C:\Python38\Scripts\;C:\Python38\;C:\Python37\Scripts\;C:\Python37\;C:\Python36\Scripts\;C:\Python36\;C:\Python35\Scripts\;C:\Python35\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Amazon\cfn-bootstrap\;C:\ProgramData\chocolatey\bin;C:\Program Files\Amazon\AWSCLI\bin\;C:\Program Files\doxygen\bin;C:\Program Files\Git\cmd;C:\Go\bin;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Program Files\LLVM\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\ProgramData\nvm;C:\Program Files\nodejs;C:\tools\python;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\Users\Administrator\go\bin;C:\Program Files\Mercurial\
[Pipeline] bat
11:23:48  
11:23:48  (.pyenv-python-3.8) C:\Jenkins\workspace\main_SDK-4633-build-system>
WHERE hg 
11:23:48  INFO: Could not find files for the given pattern(s).
[Pipeline] }
[Pipeline] // withPythonEnv

I am currently investigating if the bug happens because the Mercurial directory is last in the PATH...

Proksima commented 4 years ago

I was able to confirm the issue only affect the last member of PATH.

Proksima commented 4 years ago

I was also able to confirm that the trailing \ does not impact this bug.