Hello
I have a file input that pauses the build. The user may manually upload the file using the file input or make the file available on a network share. I am using the parallel construct to fork two branches - one for the input and one to look for the file on the share. Is there a way I can dismiss or approve the input if a file is found on the share?
I have tried a couple of ways but haven't had any luck so far.
I tried to approve/remove this input:
input id: '1005', message: 'hello world', ok: 'ok', parameters: [string(defaultValue: 'ans', description: '', name: 'test')]
My first option:
def INPUT_URL = "${currentBuild.getAbsoluteUrl()}input/1005/submit"
def queryString = "name=test&value=ans&proceed=ok"
def conn = INPUT_URL.toURL().openConnection()
conn.setRequestMethod("POST")
conn.doOutput = true
def writer = new OutputStreamWriter(conn.outputStream)
writer.write(queryString)
writer.flush()
writer.close()
conn.connect()
This gives me a 403 forbidden.
My second option:
@NonCPS
def enumActions(){
def actionsList = currentBuild.rawBuild.getAllActions()
Action npt = null
for(Action acn : actionsList){
if(acn.getUrlName() == 'input') npt = acn
}
currentBuild.rawBuild.removeAction(npt)
//def npta = (org.jenkinsci.plugins.workflow.support.steps.input.InputAction)npt
//Is there a way to call approve methods on the above.
}
I have tried several things with this code and they mostly fail with NonSerializable exception.
Thank you
Raja