I've got a cloud function that needs to install dependencies from a private pypi.
- I've set up a secret called
pypi_password
for the project and given it the correct value. - I've set up a service account to do deployment and given that service account
roles/secretmanager.secretAccessor
. - I've added
--update-secrets PYPI_PASSWORD=pypi_password:latest
to mydeploy
command so the function should have access to the secret. - I've added
--extra-index-url=https://account:${PYPI_PASSWORD}@pypi.my-company.com/pypi
to my function'srequirements.txt
.
When I deploy, I briefly see
before the during-deployment pip install
fails because my credentials aren't right.
To investigate, I've gone and added an extra ${PYPI_PASSWORD}
in my requirements.txt
to a portion that's not starred-out in deploy
's printed outputs, like: --extra-index-url=https://${PYPI_PASSWORD}account:${PYPI_PASSWORD}@pypi.my-company.com/pypi
.
What I see is that the value of ${PYPI_PASSWORD} is coming out as %7BPYPI_PASSWORD%!D(MISSING)
, which makes it seem like the environment variable doesn't exist.
But shouldn't the secret be accessible as an environment variable this way? This makes no sense to me, and I can't find a solution in the documentation.