Reputation: 11
I am trying to run postman collection in jenkins getting below error Could you please help on it . Thanks.
Running as SYSTEM Building in workspace C:\Users.jenkins\workspace\Postman [Postman] $ sh -xe C:\Users\AppData\Local\Temp\12\jenkins4131098184637934114.sh The system cannot find the file specified FATAL: command execution failed
Caused: java.io.IOException: Cannot run program "sh" (in directory "C:\Users.jenkins\workspace\Postman"): CreateProcess error=2, The system cannot find the file specified
Upvotes: 1
Views: 4018
Reputation: 3
This works Fine for me :
Instead of using sh 'your command'
, use bat 'your command'
since your shell is cmd.exe
on a Windows machine. You could also change your default shell in the Jenkins settings to use a Unix-based one, ex: using wsl.exe
, then sh 'your command'
...
stage('Build') {
steps {
echo 'Building Stage Start'
bat './gradlew assemble'
echo 'Building Stage End'
}
}
Upvotes: 0
Reputation: 978
The answer was provided here, you have two options:
On your {jenkinsUrl}/job/{jobName}/configure
build step you can choose "Execute Windows batch command" rather than "Execute shell"
In Manage Jenkins -> Configure System -> Shell, set the shell path as
C:\Windows\system32\cmd.exe
Upvotes: 2