mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Add a Cloud Build task to update YAML configs (#177)
* Add a Cloud Build task to update YAML configs * CR responses * Move config deployment to a script * Pin builder version * Create different beam and deploy-config files per environment * Update comments and make a for loop
This commit is contained in:
parent
91ceae6aeb
commit
1abfd169f0
4 changed files with 76 additions and 2 deletions
22
release/cloudbuild-deploy-configs.yaml
Normal file
22
release/cloudbuild-deploy-configs.yaml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# To run the build locally, install cloud-build-local first.
|
||||||
|
# See: https://cloud.google.com/cloud-build/docs/build-debug-locally
|
||||||
|
# You will need access to a private registry, so be sure to install the docker
|
||||||
|
# credential helper.
|
||||||
|
# Then, in the release folder, run:
|
||||||
|
# cloud-build-local --config=cloudbuild-deploy-configs.yaml --dryrun=false \
|
||||||
|
# --substitutions TAG_NAME=[TAG],_ENV=[ENV] ..
|
||||||
|
# This will build the contents of the current directory and generate the
|
||||||
|
# nomulus war-files locally.
|
||||||
|
# The PROJECT_ID is the current project name that gcloud uses.
|
||||||
|
# You can add "--push true" to have the image pushed to GCR.
|
||||||
|
#
|
||||||
|
# To manually trigger a build on GCB, run:
|
||||||
|
# gcloud builds submit --config cloudbuild-deploy-configs.yaml \
|
||||||
|
# --substitutions TAG_NAME=[TAG],_ENV=[ENV] ..
|
||||||
|
#
|
||||||
|
# To trigger a build automatically, follow the instructions below and add a trigger:
|
||||||
|
# https://cloud.google.com/cloud-build/docs/running-builds/automate-builds
|
||||||
|
steps:
|
||||||
|
# Download and unzip the tarball that contains the relevant config files
|
||||||
|
- name: 'gcr.io/${PROJECT_ID}/builder:latest'
|
||||||
|
args: ['release/deploy_configs_to_env.sh', '${_ENV}', '${TAG_NAME}']
|
|
@ -64,7 +64,9 @@ artifacts:
|
||||||
- 'output/nomulus.jar'
|
- 'output/nomulus.jar'
|
||||||
- 'release/cloudbuild-tag.yaml'
|
- 'release/cloudbuild-tag.yaml'
|
||||||
- 'release/cloudbuild-sync.yaml'
|
- 'release/cloudbuild-sync.yaml'
|
||||||
- 'release/cloudbuild-beam.yaml'
|
- 'release/cloudbuild-beam-*.yaml'
|
||||||
|
- 'release/cloudbuild-deploy-configs-*.yaml'
|
||||||
|
|
||||||
timeout: 3600s
|
timeout: 3600s
|
||||||
options:
|
options:
|
||||||
machineType: 'N1_HIGHCPU_8'
|
machineType: 'N1_HIGHCPU_8'
|
||||||
|
|
|
@ -84,12 +84,17 @@ steps:
|
||||||
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-proxy.yaml
|
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-proxy.yaml
|
||||||
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-nomulus.yaml
|
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-nomulus.yaml
|
||||||
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-beam.yaml
|
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-beam.yaml
|
||||||
|
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-deploy-configs.yaml
|
||||||
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-sync.yaml
|
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-sync.yaml
|
||||||
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-tag.yaml
|
sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-tag.yaml
|
||||||
sed -i s/GCP_PROJECT/${PROJECT_ID}/ proxy/kubernetes/proxy-*.yaml
|
sed -i s/GCP_PROJECT/${PROJECT_ID}/ proxy/kubernetes/proxy-*.yaml
|
||||||
sed -i s/'$${TAG_NAME}'/${TAG_NAME}/g release/cloudbuild-sync.yaml
|
sed -i s/'$${TAG_NAME}'/${TAG_NAME}/g release/cloudbuild-sync.yaml
|
||||||
sed -i s/'$${TAG_NAME}'/${TAG_NAME}/g release/cloudbuild-beam.yaml
|
sed -i s/'$${TAG_NAME}'/${TAG_NAME}/g release/cloudbuild-beam.yaml
|
||||||
sed -i s/'$${_ENV}'/${_ENV}/g release/cloudbuild-beam.yaml
|
sed -i s/'$${TAG_NAME}'/${TAG_NAME}/g release/cloudbuild-deploy-configs.yaml
|
||||||
|
for environment in alpha crash sandbox production; do
|
||||||
|
sed s/'$${_ENV}'/${environment}/g release/cloudbuild-beam.yaml > release/cloudbuild-beam-${environment}.yaml
|
||||||
|
sed s/'$${_ENV}'/${environment}/g release/cloudbuild-deploy-configs.yaml > release/cloudbuild-deploy-configs-${environment}.yaml
|
||||||
|
done
|
||||||
# Upload the gradle binary to GCS if it does not exist and point URL in gradle wrapper to it.
|
# Upload the gradle binary to GCS if it does not exist and point URL in gradle wrapper to it.
|
||||||
- name: 'gcr.io/cloud-builders/gsutil'
|
- name: 'gcr.io/cloud-builders/gsutil'
|
||||||
entrypoint: /bin/bash
|
entrypoint: /bin/bash
|
||||||
|
|
45
release/deploy_configs_to_env.sh
Executable file
45
release/deploy_configs_to_env.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2019 The Nomulus Authors. All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# This script downloads the tagged tarball from GCS and uploads the AppEngine config files therein
|
||||||
|
# to the provided environment. The standard AppEngine deployment process doesn't automatically
|
||||||
|
# update these configs, so we must do it manually.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ $# -ne 2 ];
|
||||||
|
then
|
||||||
|
echo "Usage: $0 alpha|crash|sandbox|production <tag_name>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
environment="$1"
|
||||||
|
tag_name="$2"
|
||||||
|
|
||||||
|
if [ "${environment}" == alpha ]; then
|
||||||
|
project_id="domain-registry-alpha"
|
||||||
|
elif [ "${environment}" == crash ]; then
|
||||||
|
project_id="domain-registry-crash"
|
||||||
|
elif [ "${environment}" == sandbox ]; then
|
||||||
|
project_id="domain-registry-sandbox"
|
||||||
|
elif [ "${environment}" == production ]; then
|
||||||
|
project_id="domain-registry"
|
||||||
|
fi
|
||||||
|
|
||||||
|
gsutil cp gs://domain-registry-dev-deploy/${tag_name}/${environment}.tar .
|
||||||
|
tar -xvf ${environment}.tar
|
||||||
|
for filename in cron dispatch dos index queue; do
|
||||||
|
gcloud -q --project ${project_id} app deploy default/WEB-INF/appengine-generated/${filename}.yaml
|
||||||
|
done
|
Loading…
Add table
Reference in a new issue