Last active
August 29, 2015 13:57
-
-
Save bryantrobbins/9872943 to your computer and use it in GitHub Desktop.
Example of using JenkinsClient from bryantrobbins/jenkinsutils
This file contains 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
// Get credentials and URL for Jenkins server from args | |
// This constructor builds URL of "http://host:port/path", e.g., localhost, 8080, "" for default install | |
jenkinsClient = new JenkinsClient(jenkinsHost, jenkinsPort, jenkinsPath, jenkinsUser, jenkinsPass) | |
// Also Process input arguments (args) to get any global params for Jenkins job | |
for(int i=0; i<batchSize; i++){ | |
// update/obtain job-specific params | |
// build Map of params | |
// I have only used text params, but perhaps others supported via Jenkins Remote API | |
def jobParams = new HashMap<String, String>(); | |
jobParams.put("PARAM_A", param_a) | |
jobParams.put("PARAM_B", param_b) | |
jobParams.put("PARAM_C", param_c) | |
jobParams.put("PARAM_D", param_d) | |
jobParams.put("PARAM_E", param_e) | |
// Use Jenkins client to launch job | |
jenkinsClient.submitJob("MySingleJob", jobParams) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment