Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitbucket Pipelines: pulling an image from GCR with environment variables fails

So I'm trying to use an image from my Google Container Registry, since this is a private registry I need to authenticate.

Obviously I don't want to renew my auth token every hour to make my pipelines work, so I need to go for the json key file.

It works when I define the image as follows:

image:
   name: eu.gcr.io/project_id/image:latest
   username: _json_key
   password: >
      {JSON file content}
   email: [email protected]

But that means your json key file is out in the open available for everyone with access to the pipelines fine to see, not what I'd like.

Then I've put the contents of the JSON file into an Environment Variable and replaced the actual json with the environment variable as follows:

image:
   name: eu.gcr.io/project_id/image:latest
   username: _json_key
   password: >
      ${JSON_KEY}
   email: [email protected]

Somehow in the second scenario it doesn't work :(

like image 476
TheWolfNL Avatar asked Feb 17 '17 15:02

TheWolfNL


1 Answers

After some more testing, I found that this worked:

image:
   name: eu.gcr.io/project_id/image:latest
   username: _json_key
   password: '$JSON_KEY'
like image 123
TheWolfNL Avatar answered Oct 15 '22 06:10

TheWolfNL