Skip to content

Instantly share code, notes, and snippets.

@hartzell
Created April 15, 2018 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hartzell/aeeb688bcb4e080e4cc1ec80d1c14070 to your computer and use it in GitHub Desktop.
Save hartzell/aeeb688bcb4e080e4cc1ec80d1c14070 to your computer and use it in GitHub Desktop.
Demonstration of defining a job interactively from the Jenkins script console
// I end up recreating this every time I need it, so, notes...
// This will run in the Jenkins script console and define a job.
//
import javaposse.jobdsl.dsl.DslScriptLoader
import javaposse.jobdsl.plugin.JenkinsJobManagement
def workspace = new File('.')
def jobManagement = new JenkinsJobManagement(System.out, [:], workspace)
new DslScriptLoader(jobManagement).runScript('''
job('a-job') {
steps {
shell """#!/bin/bash
echo "Hello world!"
"""
}
}
''')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment