On Jenkins I'm using the Conditional BuildStep Plugin. Is there a way to have it run some build steps depending on whether or not the slave node it's running on is Windows vs. Linux?
You can use isUnix() function available in jenkins for identifying the OS type.
So you can use something like below inside your jenkinsfile under script block:-
if (isUnix()) {
sh 'ls -la'
} else {
bat 'dir'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With