Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. # Clone the git repo.
  2. steps:
  3. - name: 'gcr.io/cloud-builders/git'
  4. id: 'Clone'
  5. args: ['clone', '<github_repository>']
  6.  
  7. # This step builds the container image.
  8.  
  9. - name: 'gcr.io/cloud-builders/docker'
  10. args:
  11. - 'build'
  12. - '-t'
  13. - 'gcr.io/$PROJECT_ID/<preffered_image_name>:$SHORT_SHA'
  14. - '.'
  15. # This step pushes the image to Container Registry
  16. # The PROJECT_ID and SHORT_SHA variables are automatically
  17. # replaced by Cloud Build.
  18. - name: 'gcr.io/cloud-builders/docker'
  19. id: Push
  20. args:
  21. - 'push'
  22. - 'gcr.io/$PROJECT_ID/<preffered_image_name>:$SHORT_SHA'
  23.  
  24. # This step generates the new manifest
  25. - name: 'gcr.io/cloud-builders/gcloud'
  26. id: Generate manifest
  27. entrypoint: /bin/sh
  28. args:
  29. - '-c'
  30. - |
  31. sed "s/GOOGLE_CLOUD_PROJECT/${PROJECT_ID}/g" deployment.yaml.tpl | \
  32. sed "s/latest/${SHORT_SHA}/g" > deployment.yaml
  33.  
  34. # This step deploys the new version of our container image
  35. # in the Kubernetes Engine cluster.
  36. - name: 'gcr.io/cloud-builders/kubectl'
  37. id: Deploy
  38. args: ['apply' , '-f' , 'deployment.yaml']
  39. env:
  40. - 'CLOUDSDK_COMPUTE_ZONE=<gke_cluster_zone/region>'
  41. - 'CLOUDSDK_CONTAINER_CLUSTER=<gke_cluster_name>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement