You'll need a specific script to read that share (a shell/powershell I
mean, avoid using Jenkins API in Pipelines) before and handle this,
independently of Jenkins (though you could also consider writing a plugin,
depending on your use case).

Then if that script finds something, it'll be some simple if().



2017-03-21 19:36 GMT+01:00 Raja Chinnam <[email protected]>:

> 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
>
> --
> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/adf671a8-7f92-496a-8557-978c1062805a%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/adf671a8-7f92-496a-8557-978c1062805a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS6_0aqaLLnnCC%2Bgq%2Bi%2BV1nd1ju-RktHQQ%2Bz-YAjUbkLSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to