What would be the way to determine the current OS a Jenkins pipeline is running?
Context: I\'m building a shared Jenkins pipeline script that should run on all platf
Using Java classes is probably not the best approach. I'm pretty sure that unless it's a jenkins / groovy plugin, those run on the master Jenkins JVM thread. I would look into a shell approach, such as the one outlined here: https://stackoverflow.com/a/8597411/5505255
You could wrap that script in a shell step to get the stdout like so:
def osName = sh(script: './detectOS', returnStdout: true)
to call a copy of the script being outlined above. Then just have that script return the OS names you want, and branch logic based on the osName var.