Modify and Override Build Settings Before a Build

Updated 1 day ago by Manish Jaiswal

This topic describes how to modify and override build settings before a build in Harness CIE.

If you want to override Secrets present in settings.xml files at Pipeline execution, perform the following steps:

In this topic:

Before You Begin

Step 1: Create a Secret at Account level

  1. Go to Account Settings, Account Resources, Secrets.
  2. Click Secrets. For details on creating a secret, see Add File Secret.

In this example, we create a new secret file named: settingsXML.

settingsXML contains the actual secrets. The content of settings.xml file is copied to settingsXML.

Step 2: Run the Referenced Secrets

Option 1: Add in the Run step

In the Command, in the Run step, enter:

echo '<+secrets.getValue("account.settingsXML")>' > settings.xml.

Option 2: Add in the Run Tests step

If you are using the Run Tests step, add the command in the PreCommand section of the Run Tests step:

echo '<+secrets.getValue("account.settingsXML")>' > settings.xml

The above command creates a settings.xml file in the current directory (Harness working directory).

Step 3: Run Your Maven Test

You can now run your Maven test.

mvn test -s settings.xml 

If you create settings.xml in ~/.m2/, Maven test will read the secrets from the default location and you don't need to use the -s flag.

See Also

Run a Script in a CI Stage

Please Provide Feedback