Thanks Gaven. Groovy is cool but we are using JCasC yaml to create
credentials. I want to populate an environment variable and use it in my
config.yaml. I want to know if there is a way to do it without using docker
secrets. For example, when running Jenkins instance inside a VM or using
jenkins.war file on local machine. Is there a way to do it in these cases
(without going through UI)?

The config file looks like this:

> credentials:
>   system:
>     domainCredentials:
>       - credentials:
>           - gitlabPersonalAccessToken:
>               scope: SYSTEM
>               id: "i<3GitLab"
>               token: ${GITLAB_PERSONAL_ACCESS_TOKEN}
>
>

On Tue, Jun 11, 2019 at 10:04 AM Gavin Mogan <gmo...@cloudbees.com> wrote:

> You can unsafely access the script console -
> https://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console
>
> then you can create credentials using groovy, example -
> https://github.com/halkeye-docker/docker-jenkins/blob/22ba8c4408b3a16188dc9fe967293849e8f12468/groovy/0012-add-tokens.groovy#L50-L57
>
> On Mon, Jun 10, 2019 at 8:12 PM Parichay Barpanda <
> parichay.barpa...@gmail.com> wrote:
>
>> For example,
>>
>> To delete a job, you can make a POST request to Jenkins server as:
>>
>> curl -X POST http://localhost:8080/job/my-job-name/doDelete --user
>> jenkins:f1499cc9852c899d327a1f644e61a64d
>>
>> where,
>> *username*: jenkins
>> *api token*: f1499cc9852c899d327a1f644e61a64d
>>
>> On Tuesday, June 11, 2019 at 8:24:32 AM UTC+5:30, Parichay Barpanda wrote:
>>>
>>> Hi all,
>>>
>>> I am trying to figure out a way to add an environment variable to
>>> Jenkins without using the UI. Is there a way to do it via API? The
>>> intention is to let user add credentials to Jenkins without using UI.
>>> Please let me know if you have a solution to this.
>>>
>>> Thanks.
>>>
>>> Regards,
>>> Parichay (baymac)
>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to jenkinsci-dev+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-dev/abc16929-b9e6-4e38-86c9-af7233f2451e%40googlegroups.com
>> <https://groups.google.com/d/msgid/jenkinsci-dev/abc16929-b9e6-4e38-86c9-af7233f2451e%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 Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/CAAgr96%2B2deU7v64sgJruQ02X0S34D31FYtEFN9ak57zN4Uo2PA%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/CAAgr96%2B2deU7v64sgJruQ02X0S34D31FYtEFN9ak57zN4Uo2PA%40mail.gmail.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 Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAD0DWANNZbsP%3D-jJ58Va-4t3a%3Dko5A2nWseXA46SXk23WT9%2BHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to