Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Clone the git repo.
- steps:
- - name: 'gcr.io/cloud-builders/git'
- id: 'Clone'
- args: ['clone', '<github_repository>']
- # This step builds the container image.
- - name: 'gcr.io/cloud-builders/docker'
- args:
- - 'build'
- - '-t'
- - 'gcr.io/$PROJECT_ID/<preffered_image_name>:$SHORT_SHA'
- - '.'
- # This step pushes the image to Container Registry
- # The PROJECT_ID and SHORT_SHA variables are automatically
- # replaced by Cloud Build.
- - name: 'gcr.io/cloud-builders/docker'
- id: Push
- args:
- - 'push'
- - 'gcr.io/$PROJECT_ID/<preffered_image_name>:$SHORT_SHA'
- # This step generates the new manifest
- - name: 'gcr.io/cloud-builders/gcloud'
- id: Generate manifest
- entrypoint: /bin/sh
- args:
- - '-c'
- - |
- sed "s/GOOGLE_CLOUD_PROJECT/${PROJECT_ID}/g" deployment.yaml.tpl | \
- sed "s/latest/${SHORT_SHA}/g" > deployment.yaml
- # This step deploys the new version of our container image
- # in the Kubernetes Engine cluster.
- - name: 'gcr.io/cloud-builders/kubectl'
- id: Deploy
- args: ['apply' , '-f' , 'deployment.yaml']
- env:
- - 'CLOUDSDK_COMPUTE_ZONE=<gke_cluster_zone/region>'
- - 'CLOUDSDK_CONTAINER_CLUSTER=<gke_cluster_name>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement