0

I want to use a curl with a username and password that I set in the bashrc. ie:

curl -u $jenkuser:$jenkpass foobar.org

but this isn't working for me. So what is a good way to set secret credentials that I don't want in my repo/Jenkinsfile

Adiii
  • 54,482
  • 7
  • 145
  • 148
  • specify `is not working for me` – Crocsx Dec 03 '19 at 02:45
  • it's saying that credentials were not provided. The same curl command works via command line, but the creds aren't being passed here – Cary Snyder Dec 03 '19 at 02:48
  • Does this answer your question? [Environment variables in Jenkins](https://stackoverflow.com/questions/21130931/environment-variables-in-jenkins) – Adiii Dec 03 '19 at 06:48

1 Answers1

0

Create a Jenkins project with Execute shell build step. In that shell you can run curl command and to set credentials, there is one option named This build is parameterized, where you can create Password Parameter. These parameters can be used in shell with curl command. Here is screenshot of my test project. This way is secure because password is stored in encrypted format.

enter image description here.