Upload proxy manifests during GCB build

GCB will now upload the images to GCR and the manifests to GCS. A Spinnaker pipeline can then be triggered by the GCB Pub/Sub message and use both the image and the manifests to deploy the proxy to GKE.

Also temporarily moves customized Maven repo location while it is being worked on.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=239853011
This commit is contained in:
jianglai 2019-03-22 13:26:18 -07:00
parent 6e1e4769a9
commit c25486ec32
8 changed files with 33 additions and 8 deletions

View file

@ -29,14 +29,40 @@ steps:
- ':proxy:deployJar' - ':proxy:deployJar'
- '-x' - '-x'
- 'autoLintGradle' - 'autoLintGradle'
- '-PrepositoryUrl=gcs://domain-registry-maven-repository'
dir: 'gradle' dir: 'gradle'
# Build the docker image. # Build the docker image.
- name: 'gcr.io/cloud-builders/docker' - name: 'gcr.io/cloud-builders/docker'
args: ['build', '--tag', 'gcr.io/${PROJECT_ID}/proxy:${TAG_NAME}', '.'] args: ['build', '--tag', 'gcr.io/${PROJECT_ID}/proxy:${TAG_NAME}', '.']
dir: 'gradle/proxy' dir: 'gradle/proxy'
# Move config files to the working directory. This is necessary because of Spinnaker limitations.
# It will concantinate `location' and `path' in the artifact field to construct the artifact
# path, even though the artifact is always uploaded to the `location', and `path' can be a regular
# expression.
- name: 'alpine'
args: ['sh', '-c', 'mv java/google/registry/proxy/kubernetes/* .']
# Replace the tag "latest" with the git tag that triggered this build. This is due to a bug in
# Spinnaker where the tag is appended to the image name when the deployment pipeline is triggered
# by GCB pubsub messages. The bug is fixed in https://github.com/spinnaker/echo/pull/498 and we can
# remove this step and the "latest" tag in the manifests when Spinnaker 1.13 is deployed.
- name: 'alpine'
args: ['sh', '-c', 'sed -i s/:latest/:${TAG_NAME}/ proxy-*.yaml']
# Replace project name.
- name: 'alpine'
args: ['sh', '-c', 'sed -i s/GCP_PROJECT/${PROJECT_ID}/ proxy-*.yaml']
# Images to upload to GCR. # Images to upload to GCR.
images: ['gcr.io/${PROJECT_ID}/proxy:${TAG_NAME}'] images: ['gcr.io/${PROJECT_ID}/proxy:${TAG_NAME}']
# Config files to upload to GCS.
artifacts:
objects:
location: 'gs://${PROJECT_ID}-deploy/${TAG_NAME}'
# This cannot be regexs because of how Spinnaker constructs artifact paths.
paths:
- 'proxy-deployment-sandbox.yaml'
- 'proxy-deployment-production.yaml'
- 'proxy-deployment-sandbox-canary.yaml'
- 'proxy-deployment-production-canary.yaml'
- 'proxy-service.yaml'
- 'proxy-service-canary.yaml'
timeout: 3600s timeout: 3600s
options: options:
machineType: 'N1_HIGHCPU_8' machineType: 'N1_HIGHCPU_8'

View file

@ -78,5 +78,4 @@ container_push(
image = ":proxy_image", image = ":proxy_image",
registry = "gcr.io", registry = "gcr.io",
repository = "GCP_PROJECT/IMAGE_NAME", repository = "GCP_PROJECT/IMAGE_NAME",
tag = "bazel",
) )

View file

@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: proxy - name: proxy
image: gcr.io/GCP_PROJECT/IMAGE_NAME:bazel image: gcr.io/GCP_PROJECT/proxy:latest
ports: ports:
- containerPort: 30000 - containerPort: 30000
name: health-check name: health-check

View file

@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: proxy - name: proxy
image: gcr.io/GCP_PROJECT/IMAGE_NAME:bazel image: gcr.io/GCP_PROJECT/proxy:latest
ports: ports:
- containerPort: 30000 - containerPort: 30000
name: health-check name: health-check

View file

@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: proxy-canary - name: proxy-canary
image: gcr.io/GCP_PROJECT/IMAGE_NAME:bazel image: gcr.io/GCP_PROJECT/proxy:latest
ports: ports:
- containerPort: 30000 - containerPort: 30000
name: health-check name: health-check

View file

@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: proxy - name: proxy
image: gcr.io/GCP_PROJECT/IMAGE_NAME:bazel image: gcr.io/GCP_PROJECT/proxy:latest
ports: ports:
- containerPort: 30000 - containerPort: 30000
name: health-check name: health-check

View file

@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: proxy-canary - name: proxy-canary
image: gcr.io/GCP_PROJECT/IMAGE_NAME:bazel image: gcr.io/GCP_PROJECT/proxy:latest
ports: ports:
- containerPort: 30000 - containerPort: 30000
name: health-check name: health-check

View file

@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: proxy - name: proxy
image: gcr.io/GCP_PROJECT/IMAGE_NAME:bazel image: gcr.io/GCP_PROJECT/proxy:latest
ports: ports:
- containerPort: 30000 - containerPort: 30000
name: health-check name: health-check