google/secrets-gradle-plugin

CI/CD system doesn't resolve environment variables

MaxMichel2 opened this issue · 1 comments

Using this plugin, I am able to easily keep my API keys locally and not upload them via git.

However, when using the Gitlab CI system to deliver application via runners, this plugin doesn't resolve the keys in environment variables defined in Gitlab (ORG_GRADLE_PROJECT_) and defaults to using the default variables in the specified file (local.defaults.properties for example).

The expected behaviour is:

  • Check for the given properties file (local.properties)
  • Check environment variables
  • Use the default properties file (local.defaults.properties)

I use bitriss(no idea for gitlab ci) and creating a script that creates and fills local.properties file worked for me

The script:

#!/usr/bin/env bash
cat > "./local.properties" <<- FILE_CONTENT
SECRET_VARIABLE1=value1
SECRET_VARIABLE2=value2
FILE_CONTENT

note that the values should be stored in secrets variables in github/bitrise