Secret username and password on Jenkins

I am having troubles to manage secret password on Jenkins. I want that the password is not showed on the log but i tried in two ways without success:

First attempt

I tried setting up with user and pwd with Global credentials (unrestricted) like this :

enter image description here

and i executed :

docker run -u root -v $(pwd)/:/usr/src/app deploy npm run application -- --params.login.user=$USER --params.login.password=$PWD

but i can see in the log that the user is wrote correctly but the pwd is being written like its path:

[email protected] e2: `protractor dist/out-tsc/e2e/cucumberconfig.js "--params.login.user=user" "--**params.login.password=/var/lib/jenkins/workspace/application/app/e2e_test**"

And in my automatic test is also by entering the full path instead of the value of the variable.

Second attempt

I tried using a secret text like this:

enter image description here

 docker run -u root -v $(pwd)/:/usr/src/app deploy npm run application -- --params.login.user=$USER --params.login.password=$PASS

But on the console log is being displayed the password as it is.

Someone can help me?

Thank you in advance.

Upvotes: 0

Views: 223

Answers (2)

i used : set +x docker run -u root -v $(pwd)/:/usr/src/app deploy npm run application -- -params.login.user=$USER --params.login.password=$PWD set -x

and that worked.

Upvotes: 0

Dmitriy Tarasevich
Dmitriy Tarasevich

Reputation: 1242

But on the console log is being displayed the password as it is.

is it mean in clear text?

If so - use mask password plugin to solve the issue.

Upvotes: 1

Related Questions