Hi Jonathan,

I got a question related to your post.
I have a requirement to browse a directory (which is multiple files and sub 
directories) instead of a file (which is done by File parameter plugin).
I know with string parameter, I can ask user to give the path of the 
directory.  But this is error prone when he types or does the copy +paste 
of the directory path.
is there any way (or nay plugin) to have a browse button to take the 
directory instead of a file?

Thanks,
Siva Rajesh

On Monday, May 23, 2016 at 4:54:35 PM UTC+5:30, Jonathan Hodgson wrote:
>
> For the record, I got around this by using a string parameter.
>
> It's a bit of a rigmarole, since I have to escape the diff to use it as a 
> string parameter, and then write that string to a file before using it in 
> Hg Patch (it may be possible to skip that step if I can work out how to 
> pass it vias stdin without losing quotes), but it seems to work... at least 
> for a small test diff.
>
> On Thursday, May 19, 2016 at 7:39:55 PM UTC+1, Jonathan Hodgson wrote:
>>
>> The problem is, right now I'm not getting it to the build... but the idea 
>> is that the diff is generated locally and a build started by a local 
>> command line script, along the lines of this...
>>
>> https://codeascraft.com/2011/10/11/did-you-try-it-before-you-committed/
>>
>> It looks like one possibility is to escape the diff and then send it as a 
>> string parameter, is there a limit to the size one parameter can be, or is 
>> it just for the total POST?
>>
>>
>> On Thursday, May 19, 2016 at 7:30:40 PM UTC+1, Brian Ray wrote:g
>>>
>>> Gotcha, did not follow how you were getting it across to the build.
>>>
>>> On Thursday, May 19, 2016 at 4:15:06 AM UTC-7, Jonathan Hodgson wrote:
>>>>
>>>> The remote machine currently isn't sharing the file, that's part of the 
>>>> point of uploading it in the http POST, sorting out a share seems like it 
>>>> would be an issue, it needs to be dynamic.
>>>>
>>>> On Thursday, May 19, 2016 at 2:25:47 AM UTC+1, Brian Ray wrote:
>>>>>
>>>>> Sorry, the API was URL#withInputStream, not #withReader.
>>>>>
>>>>> On Wednesday, May 18, 2016 at 6:24:11 PM UTC-7, Brian Ray wrote:
>>>>>>
>>>>>> Aha. Pipeline's under heavy development so unfortunately, there are 
>>>>>> gaps like this.
>>>>>>
>>>>>> How's the remote machine sharing the file? Windows directory share, 
>>>>>> e.g.?
>>>>>>
>>>>>> Depending on the type of file and how it's shared will likely 
>>>>>> determine the strategy. I had no success getting a pipeline script to 
>>>>>> use 
>>>>>> the Groovy GDK URL#withReader API to slurp a file from a URL and plop it 
>>>>>> into the workspace with the *writeFile *step but that was several 
>>>>>> revisions back with Pipeline. Instead I do the same with a Groovy script 
>>>>>> executed via a *sh/bat* step, inside a *node* block. But that fit my 
>>>>>> use case.
>>>>>>
>>>>>> On Wednesday, May 18, 2016 at 9:39:10 AM UTC-7, Jonathan Hodgson 
>>>>>> wrote:
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> What I've found so far also seems to indicate there is an issue with 
>>>>>>> File Parameters in Pipeline plugins. If that's the case then it really 
>>>>>>> begs 
>>>>>>> the question as to why they're an option on the pipeline project setup 
>>>>>>> page.
>>>>>>>
>>>>>>> I'm having trouble seeing how I'm going to do what I need to do 
>>>>>>> though, because the file has to be provided from a remote machine in 
>>>>>>> the 
>>>>>>> build call.. it's a diff file, I need to achieve a "try before commit".
>>>>>>>
>>>>>>> As I said, I'm rather new to Jenkins.
>>>>>>>
>>>>>>> On Wednesday, May 18, 2016 at 5:14:37 PM UTC+1, Brian Ray wrote:
>>>>>>>>
>>>>>>>> Not 100% sure but I suspect that Pipeline job params can only be 
>>>>>>>> "regular" String parameters and perhaps param types whose values 
>>>>>>>> easily 
>>>>>>>> resolve to strings. My gut instinct is that more exotic param types 
>>>>>>>> that 
>>>>>>>> have side effects--like the File type--will not work.
>>>>>>>>
>>>>>>>> So in the current use case the straightforward workaround would be 
>>>>>>>> to use a String parameter to specify a filesystem path or URI, and 
>>>>>>>> then 
>>>>>>>> have the Pipeline script place it in the workspace. There may be 
>>>>>>>> Pipeline-friendly plugins that could do this for you as well, though 
>>>>>>>> they 
>>>>>>>> are not coming to mind. (In our use cases all resources needed in the 
>>>>>>>> workspace come from *checkout* steps against a source repo and 
>>>>>>>> some custom scripting to grab binary artifacts from Artifactory.)
>>>>>>>>
>>>>>>>> On Wednesday, May 18, 2016 at 12:53:13 AM UTC-7, Jonathan Hodgson 
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Ok, I tried creating two projects, one a freestyle job, the other 
>>>>>>>>> a pipeline.
>>>>>>>>>
>>>>>>>>> The only thing I set up in each was a file as parameter. I ran a 
>>>>>>>>>  "Build using parameters" selecting the same file to upload.
>>>>>>>>>
>>>>>>>>> When I tried to view the file in the freestyle job, it worked, but 
>>>>>>>>> in the pipeline job I got the same error as above.
>>>>>>>>>
>>>>>>>>> On Wednesday, May 18, 2016 at 2:21:11 AM UTC+1, Jonathan Hodgson 
>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> I've been experimenting, and if I do what appears to be exactly 
>>>>>>>>>> the same thing with a Freestyle project, file upload is successful.
>>>>>>>>>>
>>>>>>>>>> I can't state yet whether the freestyle/pipeline job difference 
>>>>>>>>>> coinciding with a failure to upload the file is a coincidence, or 
>>>>>>>>>> the 
>>>>>>>>>> deciding factor.
>>>>>>>>>>
>>>>>>>>>

-- 
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/41519e8c-90e5-4dd7-8de1-12b6fb3e616c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to