It can be any format file you like XML, properties, txt whatever you need 
for some sort of configuration (except large binary files I guess). 

There is a CloudBees article here that should help:
https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs

The article shows creating these globally but you can create them scoped on 
a folder.

Then to use in the pipelines I suggest to drop into the pipeline syntax 
link on  a pipeline job that drops into the snipper generator in the 
Jenkins pipeline UI and go through the 'withCredentials' snippet generator. 
It found it best to experiment around a bit to figure it out.

--Bill


On Thursday, 9 March 2017 08:41:23 UTC, [email protected] wrote:
>
> Hi Bill.
>
> Thanks so much for your reply.
>
> I like this credential file option. That would mean I can create a file 
> with all the environment variables I need for my branches inside (one per 
> branch I guess). And if I could scope it inside my project folder even 
> better.
>
> I've tried to google information about how to use credential files, but 
> without much success. Would you have an example of how you'd write one?
> Is it a key / value format? bash variables declarations? JSON? XML?
>
> Thank you for your time and your help.
>
> Regards.
>
> Jeremy.
>
> Le mercredi 8 mars 2017 10:05:02 UTC+1, Bill Dennis a écrit :
>>
>> Just some other things I thought of -
>>
>> If you use the credentials file feature you can put all those sensitive 
>> properties in a properties file stored as 'jenkins credentials'. 
>>
>> Then pull that props file into your workspace using 'withCredentials' in 
>> the pipeline.
>>
>> Next thing is to grab the pipeline utility steps plugin which has a 
>> readProperties step (it is not one of the standard pipe plugins - you will 
>> need to add it).
>> https://plugins.jenkins.io/pipeline-utility-steps
>>
>> Then you have the file properties loaded as Java properties and you can 
>> use them as before.
>>
>> I did this move from Freestyle too and there is a lot to learn but it is 
>> worth it. Another recommendation is to look at the declarative pipeline not 
>> just scripted pipeline. Declarative has post build handling in the pipeline 
>> which you may miss from FreeStyle jobs. In scripted pipeline you have to do 
>> a lot of try-catch handling for build errors.
>>
>> Bill
>>
>>
>> On Wednesday, 8 March 2017 08:45:03 UTC, Bill Dennis wrote:
>>>
>>> If you put the pipeline / branch jobs inside a folder, you can scope the 
>>> credentials to just that folder. Pretty sure that is available in Jenkins 
>>> OSS and not just Enterprise - you need the CloudBees Folders plugin. Have a 
>>> look on here, it might have some clues: 
>>> https://support.cloudbees.com/hc/en-us/articles/204264974-How-inject-your-Maven-settings-xml-at-folder-level-with-the-Credentials-plugin
>>>
>>> I am not sure if this helps in your branch scenario. I put all my 
>>> credentials globally then realised I could scope them to the folder level - 
>>> I missed it due to some nuances in the credentials UI.
>>>
>>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/31e3d425-7067-4fd8-a3d3-a04ab783db25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to