You are viewing the documentation for Blueriq 17. Documentation for other versions is available in our documentation directory.

In Jenkins is it possible to store the Blueriq Studio username and password credentials as a Secret. With the Credentials Binding Plugin you are able to configure a Secret, such as a username and password and map it to an credentials id. These credentials are then 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 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.

Example
withCredentials([usernamePassword(credentialsId: 'studio-credentials', usernameVariable: 'studio-user', passwordVariable: 'studio-password')]) {
  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 '****'.

Run Output
[Pipeline] {
[Pipeline] withCredentials
[Pipeline] {
[Pipeline] bat

C:\jenkins\workspace\test-cli-runner>C:\model-mapper\cli-test-runner-win.exe --proxyServerUrl=http://localhost:1337 --studioUsername=**** --studioPassword=**** --repository=MyRepository --branch=Trunk --project=MyProject
Successfully logged in
Created project export for project 'MyProject'.
Retrieving all data mapping test cases from workspace.
Found '1' data mapping test cases in workspace.
Retrieving data mapping 'fwd_DataMapping' from Studio.
Retrieving meta models from Studio.
Executing test 'Test' for data mapping 'fwd_DataMapping' in module 'configuration'.
Test 'Test': Succeeded 

[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }

More information about how to inject Secrets into Jenkins Build Jobs can be found here.

  • No labels