(re-posting with corrections) Has anyone managed to write pipeline code (or even their own plugin) to approve an input using pipeline code from another job (shared library NonCPS method or whatever)?
I have this scenario - JobA input id: 'JOBA_CALLBACK', message: 'Waiting for JobB', parameters: [string( defaultValue: '', description: 'ID of the callback', name: 'CALLBACK_ID')] JobB I want to write this with this hypothetical pipeline DSL which doesn't exist: approveInput jobName:'JobA', buildNumber: 1234, , inputId: 'JOBA_CALLBACK', parameters: [CALLBACK_ID: '5678'] Job B in my scenario is actually called by an external system and can route to a couple of other jobs based on job parameters (so I cannot simply put Job B code into A). CloudBees support recommended that I use a REST call-back onto Jenkins to do this (REST call onto Jenkins from JobB), I do have this and it works, the code looks like this using the HTTP Request plugin: def REQUEST_URL = "${env.JENKINS_URL}/job/JobA/1234/wfapi/inputSubmit?inputId=JOBA_CALLBACK". toString() def formJsonParamUrlEncoded = java.net.URLEncoder.encode( "{\"parameter\":[{\"name\":\"CALLBACK_ID\",\"value\":5678]}").toString() request = httpRequest authentication: 'LOCAL_JENKINS', consoleLogResponseBody: true, customHeaders: [[name: 'content-type', value: 'application/x-www-form-urlencoded']], httpMode: 'POST', requestBody: "json=${formJsonParamUrlEncoded}", url: REQUEST_URL, validResponseCodes: '200' echo "Request returned: ${request.toString()}" However this does introduce some failures into our system when our IT folks have outages that affect our authentication and such like (the REST call to Jenkins has authentication). I would like to remove this possibility of failure hence looking at code to do it. I feel that there ought to be a way to call Jenkins internals to do this, but probably it would be best to write a plugin that implements the hypothetical DSL I have. If I did write a plugin, would others find this useful? --Bill -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1a2f3183-1243-4f71-aeec-a499c6e5bf77%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.