Bitbucket Pipelines:使用环境变量从GCR中提取图像失败

The*_*fNL 5 google-container-registry bitbucket-pipelines

所以我正在尝试使用我的Google容器注册表中的图像,因为这是我需要进行身份验证的私有注册表.

显然我不想每小时更新我的​​身份验证令以使我的管道工作,所以我需要去找json密钥文件.

它在我定义图像时有效,如下所示:

image:
   name: eu.gcr.io/project_id/image:latest
   username: _json_key
   password: >
      {JSON file content}
   email: pipelines@bitbucket.com
Run Code Online (Sandbox Code Playgroud)

但这意味着你的json密钥文件是公开的,所有人都可以访问管道,而不是我想要的.

然后我将JSON文件的内容放入环境变量中,并用环境变量替换实际的json,如下所示:

image:
   name: eu.gcr.io/project_id/image:latest
   username: _json_key
   password: >
      ${JSON_KEY}
   email: pipelines@bitbucket.com
Run Code Online (Sandbox Code Playgroud)

不知何故,在第二种情况下它不起作用:(

The*_*fNL 9

经过一些测试,我发现这有效:

image:
   name: eu.gcr.io/project_id/image:latest
   username: _json_key
   password: '$JSON_KEY'
Run Code Online (Sandbox Code Playgroud)