Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In Jenkins is it possible to store the Blueriq Studio username and password credentials as a Secret. With the Credentials Binding Plugin u are able to configure a Secret, such as a username and password and map it to an credentials id. These credentials are then store stored on the master Jenkins instance, which are encrypted by the Jenkins instance ID. If you want to know more about configuring credentials in Jenkins read the using credentials page.

Using

...

a Secret inside a Jenkins Pipeline Script

For this example we have created a Secret in Jenkins with the name id 'studio-credentials'. In order to use the credentials binding plugin you will need to specify a withCredentials block inside your pipeline script. The plugin will automatically redact every referral to the username and password credentials.

Code Block
languagegroovy
titleExample
withCredentials([usernamePassword(credentialsId: 'studio-credentials', usernameVariable: 'studio-user', passwordVariable: 'studio-password')]) {
  // available as an env variable, but will be masked if you try to print it out any which way
  // note: single quotes prevent Groovy interpolation; expansion is by Bourne Shell, which is what you want
  bat "C:\model-mapper\cli-test-runner-win.exe --proxyServerUrl=http://localhost:1337 --studioUsername=${studio-user} --studioPassword=${studio-password} --repository=MyRepository --branch=Trunk --project=MyProject"
}


Running this particular script will result in the following output. As you can see content of the studio-user and studio-password variable is replaced by '****'.

...