-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Powered by SuggestiMate
When an Active Choice reactive reference is rendered as a Jenkins File Chooser, the name of the selected file is not cascaded to other active choices that reference it.
[JENKINS-38893] Active Choice Reactive Reference parameter value rendered as File Selector not cascaded
Hi Ioannis,
Thanks for attaching the config.xml file. That is extremely helpful.
Here are some screen shots.
I am not sure if I can reproduce it or not... I suspect it is working in my environment? Could be because I am running within Eclipse, locally, with no security policies, HTTP server, etc.
But at least when I choose a file from my desktop, the input fields are updated, and the values are both submitted to Jenkins.
Maybe the example is confusing. But you have actually reproduced the issue as described in my comment.
Your screenshot shows that the Krita.desktop file, attached using the AC_RENDERED file button was NOT uploaded. And this is exactly my issue.
I want an Active Choice rendered 'Choose File' button that both cascades its value AND uploads the file
Changed the severity, as this is directly affecting the expected behavior of the AC control
Ok, I think I finally understood the issue and what's going on. What we have when we use Jenkins' File parameter is a FileParameterValue.
The Jelly file used to render is very simple and it seems like the part we are missing here is that the input field's name must be "file", not "value".
If you want to cascade to other parameters, I think you will have to find some JavaScript that reacts to the event when the user chooses the file, then copies the file name in another input name="value".
So in summary, the only thing I changed from your example to get it working was: <input name="file" type="file" jsonAware="true" />
To match Jenkins' jelly file.
Could you check if that works for you ioannis, please? Here's a screen shot (also checked in the disk, and both files were uploaded, but no file name in the latter).
Thanks for looking into this Bruno! So you have clearly confirmed my previous investigation: https://issues.jenkins-ci.org/browse/JENKINS-38893?focusedCommentId=305784&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-305784 Excellent!
I will investigate the workaround you suggested, but I think this is the first case where we can't reproduce a functional Jenkins UI control whose value can be cascaded in the typical AC way. I will try to document on wiki after I find a workaround for it.
Thank you-have a great Sunday afternoon in NZ!
The issue mentioned ioannis is there, but I could add another finding, when we use the same active choice in pipeline job, the file is not uploaded either you specify
<input name="file" type="file" jsonaware="true">
OR
<input name="value" type="file" jsonaware="true">
In Pipeline type of job, you can get the name of the file, but do not have a space where the file could be located.
dozinbatty did you ever figure this out? I'm facing the same issue.
[ $class: 'DynamicReferenceParameter', choiceType: 'ET_FORMATTED_HTML', description: '', name: 'File', omitValueField: true, referencedParameters: actionParam, script: [ $class: 'GroovyScript', fallbackScript: [ classpath: [], sandbox: false, script: '' ], script: [ classpath: [], sandbox: false, script: 'if(Action == \'ExecuteScript\') { return \'\'\'<input name="value" type="file" jsonaware="true">\'\'\'}' ] ] ],
This code results in the env.File parameter getting the value 'file0', but there is no file. Changing the input name to "file" also does not result in a file being uploaded.
EDIT: Figured it out. File was getting uploaded, needed to use input name "file" and I borrowed some of this code to get that file to the current workspace- https://github.com/janvrany/jenkinsci-unstashParam-library
I cannot figure it out and appreciate if someone can share a fix or clear instructions how to solve this. No matter what I do the AC Reactive Reference Parameter with name "File" is always empty.
<input name="file" type="file" jsonaware="true">: empty variable in Jenkinsfile <input name="name" type="hidden" value="File"><input name="file" type="file" jsonaware="true">: HTTP 500
As a 2nd step I like to pass the files as base64 encoded string variable - not sure how to do it with AC.
Thank you.
Hi, I want to implement the possibility of two or more file inputs with the AC plugin conditioned with another parameter (referencedParameters).
I finally do the trick and I can select two files. I even do the post processing with the code in: https://github.com/janvrany/jenkinsci-unstashParam-library
But at the time of processing the files, I only have the last file uploaded.
After investigating a bit more, the issue is as follows:
When the AC-RefParam is rendered as:
When the AC-RefParam is rendered as:
This is expected as we need to render a parameter with name="value". It's just not useful for us to propagate the name of the selected file.