-
-
Save samaddico/2e373a5505cbbd9547637d5c6c50ffa8 to your computer and use it in GitHub Desktop.
Bitbucket Pipelines deployment to a Google Container Engine configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options: | |
docker: true | |
pipelines: | |
branches: | |
master: | |
- step: | |
image: google/cloud-sdk:latest | |
name: Deploy to production | |
deployment: production | |
caches: | |
- docker | |
script: | |
# SETUP | |
- export IMAGE_NAME=us.gcr.io/$GCLOUD_PROJECT/$BITBUCKET_REPO_SLUG:$BITBUCKET_COMMIT | |
- export ENVIRONMENT=production | |
- echo $GCLOUD_API_KEYFILE | base64 -d > ~/.gcloud-api-key.json | |
- gcloud auth activate-service-account --key-file ~/.gcloud-api-key.json | |
- gcloud config set project $GCLOUD_PROJECT | |
- gcloud container clusters get-credentials $GCLOUD_CLUSTER --zone=$GCLOUD_ZONE --project $GCLOUD_PROJECT | |
- gcloud auth configure-docker --quiet | |
# BUILD IMAGE | |
- docker build . -t $IMAGE_NAME | |
# PUBLISH IMAGE | |
- docker push $IMAGE_NAME | |
# DEPLOYMENT | |
- kubectl set image deployment $BITBUCKET_REPO_SLUG-$ENVIRONMENT $BITBUCKET_REPO_SLUG=$IMAGE_NAME --record --namespace=$K8S_NAMESPACE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment