secrets-gradle-plugin icon indicating copy to clipboard operation
secrets-gradle-plugin copied to clipboard

CI/CD system doesn't resolve environment variables

Open MaxMichel2 opened this issue 2 years ago • 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_<API Key Name>) 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)

MaxMichel2 avatar Jun 27 '23 13:06 MaxMichel2

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

fedesenmartin avatar Jul 06 '23 20:07 fedesenmartin