<p>In order to pass masked credentials to your Jenkins job, do the following:</p>

<ol>
<li><p>In Jenkins, install <a href="https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin" rel="nofollow noreferrer">Credentials Binding plugin</a>.</p></li>
<li><p>In your Jenkins, go to Credentials and click the global domain.</p></li>
<li><p>In the left pane, click "Add credential".</p></li>
<li><p>From the "Kind" dropdown, choose "Username with password".</p></li>
<li><p>Enter the username and password in the reflective boxes and choose an ID (you will use this ID when you want to access the credentials) and click OK.</p></li>
<li><p>Then, in your job, under "Build environment", check "Use secret text(s) or file(s)" and it will add a "Binding" section and an "Add" button, click the "Add" button and "username and password separated", choose a variable name to hold the username and another to hold the password and choose the credentials you created earlier from the credentials dropdown.</p></li>
<li><p>Then, in the "Build" section of the job, you can access the credentials using your chosen username and password variables.</p></li>
</ol>

<p>I wrote <a href="https://www.tikalk.com/posts/2017/03/07/how-to-mask-credentials-in-your-jenkins-jobs/" rel="nofollow noreferrer">an article</a> about this subject in the past so feel free to check it for more detailed explanation and screen shots.</p>

CC BY-SA 4.0
2019-12-09T16:03:33.697Z
it works! Thanks !
paolo alborno
CC BY-SA 4.0
2019-12-09T09:13:34.567Z
2019-12-09T09:13:34.567Z
Itai Ganot
<p>I am trying to <strong>inject my credentials</strong> 
to a Jenkins Freestyle project.</p>

<p>The project is building a python project in virtual environment
with "behave" created with ShiningPanda plugin</p>

<p>can someone help me ?
thanks</p>

<jenkins><python><job-dsl>
How to inject credentials to python virtual env in jenkins?
paolo alborno
# How to inject credentials to python virtual env in jenkins?

(Asked by: username_0 on 2019-12-06)

I am trying to **inject my credentials**
to a Jenkins Freestyle project.

The project is building a python project in virtual environment
with "behave" created with ShiningPanda plugin

can someone help me ?
thanks

**Tags:** jenkins, python, job-dsl


---

## 1 answers

### Answer by username_1 on 2019-12-09. Score: 2 | Accepted answer

In order to pass masked credentials to your Jenkins job, do the following:

1. In Jenkins, install [Credentials Binding plugin](https://wiki.jenkins-ci.org/display/JENKINS/Credentials+Binding+Plugin).
2. In your Jenkins, go to Credentials and click the global domain.
3. In the left pane, click "Add credential".
4. From the "Kind" dropdown, choose "Username with password".
5. Enter the username and password in the reflective boxes and choose an ID (you will use this ID when you want to access the credentials) and click OK.
6. Then, in your job, under "Build environment", check "Use secret text(s) or file(s)" and it will add a "Binding" section and an "Add" button, click the "Add" button and "username and password separated", choose a variable name to hold the username and another to hold the password and choose the credentials you created earlier from the credentials dropdown.
7. Then, in the "Build" section of the job, you can access the credentials using your chosen username and password variables.

I wrote [an article](https://www.tikalk.com/posts/2017/03/07/how-to-mask-credentials-in-your-jenkins-jobs/) about this subject in the past so feel free to check it for more detailed explanation and screen shots.

> **Comments:**
> **username_0**: it works! Thanks !  

---

