This article covers the topic on how to conceal your password when you are using scripts to run your Jenkins job.
Objective: Concealing passwords and other sensitive information.
Use Case: Users push scripts to hosting websites like Bitbucket, where the plain text password is visible to anyone accessing the code.
- While configuring a project, in the 'General' section, check the 'This project is parameterized' option.
- Create a String Parameter. Provide name and the Default Value that you are going to pass in the script. Refer screenshot below.
- In your pipeline script, enter the name of the String parameter in the place you want to pass the password or any other string. Refer screenshot below:
- When you execute the project, you will have to choose 'Build with parameters' option and provide the value that you want to be passed.
Conclusion: Since you are passing the values or password as a string parameter, the values are stored in Jenkins and not uploaded with the script.