Hello,
I am having issues injecting doppler secrets into my GitHub actions.
I’ve done the steps here: https://docs.doppler.com/docs/enclave-github-actions
And my actions file contains the following code:
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v1
- name: Test Doppler Access
run: doppler run -- printenv | grep GCP_PROJECT
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
- name: Pass all secrets to next steps
run: doppler secrets download --no-file --format=env >> $GITHUB_ENV;
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
However, when I try to use the environment values, GitHub actions is adding escape characters which is messing up the parsing. Ideally, I would like to use doppler as my single source of truth for secrets and avoid GitHub secrets but something is up when I inject them. For example, here are the GitHub actions logs:
env:
5 IMAGE: mctwist_server
6 AZURE_COSMOS_DB_NAME: “db_name”
7 AZURE_COSMOS_KEY: “key”
9 AZURE_RESOURCE_GROUP: “resource group”
10 GCP_PROJECT: “project id”
11 PIP_INDEX_URL: “index url”
12 PIP_TRUSTED_HOST_URL: “host”
13 DOPPLER_PROJECT: “mctwist”
14 DOPPLER_ENVIRONMENT: “prd”
15 DOPPLER_CONFIG: “prd”
16 CLOUDSDK_METRICS_ENVIRONMENT: github-actions-setup-gcloud
And when I try to use the doppler secret for creating an image, I get the following output:
26invalid argument “gcr.io/\“project id\”/mctwist_server:3b413277c5786c0d586d04a77a733f78582f3bd9” for “-t, --tag” flag: invalid reference format
When running this step in my GitHub actions code:
docker build
–tag “gcr.io/$GCP_PROJECT/$IMAGE:$GITHUB_SHA”
–build-arg GITHUB_SHA="$GITHUB_SHA"
–build-arg GITHUB_REF="$GITHUB_REF"
–build-arg AZURE_COSMOS_KEY="$AZURE_COSMOS_KEY"
–build-arg AZURE_COSMOS_URI="$AZURE_COSMOS_URI"
–build-arg TRUSTED_HOST_URL="$PIP_TRUSTED_HOST_URL"
–build-arg INDEX_URL="$PIP_INDEX_URL" \ .
For some reason, the characters \ are being injected before and after the secret. Anyway around this to configure my secret?
This is also happening when I try to use the secret for a variable in a step
- uses: google-github-actions/setup-gcloud@v0.2.0
with:
service_account_key: {{ secrets.GKE_SA_KEY }}
project_id: {{ env.GCP_PROJECT }}
And what happens is that GitHub actions injects it as a string, rather than a variable, leading to the project id to not be found