Masking credentials in Jenkins

Provar now supports execution on Jenkins without needing to check the Provar .secrets file into GitHub. This is to reduce exposure of the credentials used in Test Case execution. The solution is to use Jenkins’ credentials plugin to set up the passwords and security tokens as environment variables.

Prerequisites


  • A Jenkins server
  • Required privileges on Jenkins to install plugins and create a project

Download required plugins


You will need to download and install three Jenkins plugins:

When all three plugins are installed, your Jenkins installation has the required directives to allow you to inject secrets into Jenkins.

Create credentials


Go to Jenkins (menu) and choose Credentials.

Create a new user and password credentials. Once it’s created, copy its credentials ID. This is a hash which is used by Jenkins to identify these specific credentials.

Create and configure your new build job


Create a new item (new job), name it, and select Freestyle project or any other.

After installing the plugins, you will now have a new option under Build Environment which is called Use secret text(s) or file(s). Tick this option and a new box will appear: Binding and underneath it Add:

Click Add and choose Username and password (separated):

A new box will appear. Here you can enter the variable name which will hold the real username as in the credentials. You can also enter the variable name for the password which will hold the real password as in the credentials:

Provide a Build Step of Invoke Ant:

Provide the ANT build file path location:

Then save your Project.

Test configuration


Remove .secrets from the Provar Project.

Run your job and check console output.

Console output


Application successfully launched without having .secrets file in a Project:

And if run same project from Provar you will see error message:

Documentation library

Other available resources

Looking for something different?

We use cookies to better understand how our website is used so we can tailor content for you. For more information about the different cookies we use please take a look at our Privacy Policy.