Open fearnycompknowhow opened 2 years ago
I have the same issue.
The error: interpolate environment variables for XYZ manifest: environment variable "GH_TOKEN" is not defined
I'm doing this:
secrets:
GH_TOKEN: 'test/ctf-poc/gh-token'
image:
build:
dockerfile: Dockerfile.text
args:
GH_TOKEN: ${GH_TOKEN}
Using copilot version: v1.23.0
Update: this workaround helped me.
Hello, I apologize if this question has already been asked. I've been searching the internet for about a day and a half now, and I haven't found anything that works.
My pipeline builds a docker image. Both the
buildspec.yml
and the servicemanifest.yml
files were generated through the AWS CLI.I'm struggling with how to pass values from Secrets Manager into Dockerfile at build time. Based on my reading, it's possible to pull in values from Secrets Manager using either this syntax in the service's
manfiest.yml
file:Or you can specify them in the top-level
buildspec.yml
file using the following syntax:The problem comes when I attempt to pass the values into the Docker file as build args. Within the service's manifest.yml file:
The problem seems to be that neither of the two environment variables are replaced with the environment variable values. Instead the literal string values of "${SECRET_1}" and "$SECRET_2" are passed into the Dockerfile.
I notice here that the person is referencing custom environment variables in the exact same way that I am, and it seems to have worked for them.
What's weird is that Copilot seems to recognize that
SECRET_1
andSECRET_2
are actual environment variables, it just doesn't interpolate/insert them.I know this, because if I remove every and all definition for the variables (both in the
buildspec.yml
file and in themanifest.yml
file), the error message changes and the Dockerfile build never even runs due to the fact that there is an error in the Copilot config itself (i.e. missing environment variables).