Skip to content

Instantly share code, notes, and snippets.

@ctran
Last active May 9, 2023 12:21
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ctran/8f82adedaa23ea924c52 to your computer and use it in GitHub Desktop.
Save ctran/8f82adedaa23ea924c52 to your computer and use it in GitHub Desktop.
Check slave.jar versions of slaves against expected version on Jenkins master
import jenkins.model.*
import hudson.remoting.Launcher
import hudson.slaves.SlaveComputer
def expectedVersion = Launcher.VERSION
for (computer in Jenkins.instance.getComputers()) {
if (! (computer instanceof SlaveComputer)) continue
if (!computer.getChannel()) continue
def version = computer.getSlaveVersion()
if (!expectedVersion.equals(version)) {
println "${computer.name} - expected ${expectedVersion} but got ${version}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment