![2020-09-21 18_13_01-gradle-build [Jenkins]](https://i0.wp.com/www.chunho-ling.com/wp-content/uploads/2020/09/2020-09-21-18_13_01-gradle-build-Jenkins.png?resize=596%2C290&ssl=1)
No matter what kind of program, hard-code sensitive information is not a recommend approach.
In Jenkins, credentials can store in its own credential store and fetch in pipeline.1. Getting in withCredential
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId:'credential_id', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD'] ]) { echo 'userName= $USERNAME' echo 'password= $PASSWORD' }
Credential will store in environment variable so it can fetch in pipeline, however, value will not shown in echo.
Leave a Reply