Is it possible to use password variables in a task shell script? For example deployment variables have been defined as follows:
Deployment_variables.png
And when used in a task script, it does not work (Script body, running on a Linux server):
set -x
echo "********** db.username: ${bamboo_db_username}"
echo "********** db.password: ${bamboo_db_password}"
echo "********** db.admin.username: ${bamboo_db_admin_username}"
echo "********** db.admin.password: ${bamboo_db_admin_password}"
./gradlew $bamboo_sbox_gradle_liquibase_update_arguments -Dorg.gradle.project.db_username=$bamboo_db_username -Dorg.gradle.project.db_password=$bamboo_db_password -Dorg.gradle.project.db_admin_username=$bamboo_db_admin_username -Dorg.gradle.project.db_admin_password=$bamboo_db_admin_passwordResults in:
build 24-Mar-2016 06:11:40 ********** db.username: pshnt
error 24-Mar-2016 06:11:40 + echo ********** db.username: pshnt
build 24-Mar-2016 06:11:40 ********** db.admin.username: pshnt
build 24-Mar-2016 06:11:40 ********** db.admin.password: ********
error 24-Mar-2016 06:11:40 + echo ********** db.admin.username: pshnt
error 24-Mar-2016 06:11:40 + echo ********** db.admin.password: ********
error 24-Mar-2016 06:11:40 + ./gradlew lb-update -PenvironmentName=sbox -Dorg.gradle.project.db_username=pshnt -Dorg.gradle.project.db_password=******** -Dorg.gradle.project.db_admin_username=pshnt -Dorg.gradle.project.db_admin_password=********
build 24-Mar-2016 06:11:55 [buildinfo] Not using buildInfo properties file for this build.
build 24-Mar-2016 06:11:55 :lb-Update
build 24-Mar-2016 06:11:55 liquibase-plugin: Running the 'init' activity...
error 24-Mar-2016 06:11:56 Unexpected error running Liquibase: java.sql.SQLException: ORA-01017: invalid username/password; logon denied
If we define these as global variables, it works fine (but the password show up in the clear in the logs).
Using global variables would make it harder to maintain as we are using global variables to define commons variables to all deployment and use deployment variables that are specific to each app deployment.
What we are trying to achieve is to pass sensitive information for each deployment project. We could simply do away with the variables and put the values directly in the -D parameters, but our goal is to replace the replace the body of the script with a file so that we can reuse code as much as possible.
Am I missing something obvious / doing this the wrong way?
Thanks