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