Private GCR Image as build environment fails Edited

Hullo,

I've been trying to get bitbucket-pipelines to use a private GCR (Google Container Registry) image as a build environment without any luck.

I tried to have the service account json as raw & as base64 in an environment variable but neither worked.

gcr-bitbucket-roles.pngpipelines-env-vars.pngpipeline-sample.pngpipelines-error.png

I'm not sure how to get this to work... I'm out of ideas.

 

Thanks for the help!

 

1 answer

1 accepted

If found my answer thanks to support. Such a small detail yet so important.

In the bitbucket-pipelines.yml when we specify credentials for a private repository the property image becomes an object with 3 properties: name, username & password.

should of been like this:

- step:
name: Build & Push image to GCR
image:
name: us.gcr.io/boilerplates-190517/cloud-sdk-kubectl@sha256:58de8eb98a7d442b1d5bedbbf3da682821e480825dc58a9ceb06aad27c8114cb
username: _json_key
password: '$GCLOUD_PIPELINE_JSON'
script:
- echo $GCLOUD_API_KEYFILE | base64 -d > ./gcloud-api-key.json
- export GCLOUD_API_KEYFILE=./gcloud-api-key.json
- export GCLOUD_CLUSTER=$BITBUCKET_BRANCH
- gcp-k8s image-build
- gcp-k8s image-push

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

272 views 0 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you