Skip to content

Instantly share code, notes, and snippets.

@macg33zr
Last active April 28, 2018 00:53
Show Gist options
  • Save macg33zr/5810981 to your computer and use it in GitHub Desktop.
Save macg33zr/5810981 to your computer and use it in GitHub Desktop.
Jenkins CLI Gradle Skeleton - what is needed to get started to use the Jenkins CLI from Gradle scripts
import hudson.cli.CLI
buildscript {
repositories {
maven {
url 'http://repo.jenkins-ci.org/repo/'
}
}
dependencies {
classpath 'org.jenkins-ci.main:cli:1.519'
}
}
def rootUrl = "http://localhost:8080"
def runCliCommandArgs = { args ->
def CLI cli = new CLI(rootUrl.toURI().toURL())
cli.execute(args, System.in, System.out, System.err)
cli.close()
}
task help << {
runCliCommandArgs(["help"])
}
task list_plugins << {
runCliCommandArgs(["list-plugins"])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment