I am passing in System variables using IntelliJ's Run/Debug Configuration tool as follows:
Tasks: clean headlessTest
VM options: -Denv=test -DstoreCode=189 -Ddept=apparel
Arguments: -PdepartmentJourney=department_journey
Environment variables: UI_USERNAME=test;UI_PASSWORD=12345...//These are passed in the pipeline script in CI
This issues the local Gradle command of:
./gradlew clean headlessTest -Denv=test -DstoreCode=189 -Ddept=apparel -PdepartmentJourney=department_journey --no-daemon
And in my CI pipeline:
def setEnvironmentVariables(){
env.UI_USERNAME = getFromSecrets....
env.UI_PASSWORD = getFromSecrets....
}
./gradlew clean headlessTest -Denv=${env.ENVIRONMENT} - DstoreCode=${env.storeCode} -Ddept=${env.dept} -PdepartmentJourney=department_journey --no-daemon
I assume this calls the System.setProperty(String key, String value) method at runtime.
When I debug the code using getProperty
only the storeCode
value is set, with dept
being set to null.
I am using the same getProperty(String key)
method for each.
Running from the Terminal and in a pipeline also sees the apparel == null.
Is there an obvious reason?