From 2603e945c85a51dbbc1b832d13da0c65b331a163 Mon Sep 17 00:00:00 2001 From: Jinesh <50176918+jineshb@users.noreply.github.com> Date: Tue, 25 Jun 2019 13:01:01 -0400 Subject: [PATCH] GRN2-yyy: Added initial cloudbuild scripts (#581) * Initial cloudbuild scripts * Update sample.env * Update sample.env --- cloudbuild-staging.yaml | 31 +++++++++++++++++++++++++++++++ cloudbuild.yaml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 cloudbuild-staging.yaml create mode 100644 cloudbuild.yaml diff --git a/cloudbuild-staging.yaml b/cloudbuild-staging.yaml new file mode 100644 index 00000000..b0330a39 --- /dev/null +++ b/cloudbuild-staging.yaml @@ -0,0 +1,31 @@ +steps: +- name: 'gcr.io/cloud-builders/docker' + entrypoint: 'bash' + args: [ + '-c', + 'docker pull gcr.io/$PROJECT_ID/${_URL}:latest || exit 0' + ] +- name: 'gcr.io/cloud-builders/docker' + args: ['build', + '--build-arg', + 'version_code=${BRANCH_NAME} (${SHORT_SHA})', + '-t', + 'gcr.io/$PROJECT_ID/${_URL}:${BRANCH_NAME}.${SHORT_SHA}', + '-t', + 'gcr.io/$PROJECT_ID/${_URL}:latest', + '.'] +- name: 'gcr.io/cloud-builders/kubectl' + args: [ + 'set', + 'image', + 'deployment', + '${_APP_NAME}', + '${_IMAGE_NAME}=gcr.io/$PROJECT_ID/${_URL}:${BRANCH_NAME}.${SHORT_SHA}' + ] + env: + - 'CLOUDSDK_COMPUTE_ZONE=${_COMPUTE_ZONE}' + - 'CLOUDSDK_CONTAINER_CLUSTER=${_CLUSTER_NAME}' +images: [ + 'gcr.io/$PROJECT_ID/${_URL}:${BRANCH_NAME}.${SHORT_SHA}', + 'gcr.io/$PROJECT_ID/${_URL}:latest' +] \ No newline at end of file diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 00000000..3a090eae --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,31 @@ +steps: +- name: 'gcr.io/cloud-builders/docker' + entrypoint: 'bash' + args: [ + '-c', + 'docker pull gcr.io/$PROJECT_ID/${_URL}:latest || exit 0' + ] +- name: 'gcr.io/cloud-builders/docker' + args: ['build', + '--build-arg', + 'version_code=${TAG_NAME}', + '-t', + 'gcr.io/$PROJECT_ID/${_URL}:${TAG_NAME}.${SHORT_SHA}', + '-t', + 'gcr.io/$PROJECT_ID/${_URL}:latest', + '.'] +- name: 'gcr.io/cloud-builders/kubectl' + args: [ + 'set', + 'image', + 'deployment', + '${_APP_NAME}', + '${_IMAGE_NAME}=gcr.io/$PROJECT_ID/${_URL}:${TAG_NAME}.${SHORT_SHA}' + ] + env: + - 'CLOUDSDK_COMPUTE_ZONE=${_COMPUTE_ZONE}' + - 'CLOUDSDK_CONTAINER_CLUSTER=${_CLUSTER_NAME}' +images: [ + 'gcr.io/$PROJECT_ID/${_URL}:${TAG_NAME}.${SHORT_SHA}', + 'gcr.io/$PROJECT_ID/${_URL}:latest' +] \ No newline at end of file