Created
April 15, 2018 20:56
-
-
Save hartzell/aeeb688bcb4e080e4cc1ec80d1c14070 to your computer and use it in GitHub Desktop.
Demonstration of defining a job interactively from the Jenkins script console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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