google-nomulus/cloudbuild-nomulus.yaml
jianglai 454afcdf30 Build an uber tarball in Cloud Build
Spinnaker currently cannot have inter-dependencies between different pipelines.
As a result we put the WAR files for all environments in one tarball which
triggers a single pipeline that first deploys to sandbox and then to
production.

Temporarily disabled pulling dependencies from GCS while that is being worked
out.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=239448777
2019-03-21 14:51:57 -04:00

61 lines
2.1 KiB
YAML

# To run the build locally, install cloud-build-local first.
# See: https://cloud.google.com/cloud-build/docs/build-debug-locally
# Then run:
# cloud-build-local --config=cloudbuild-nomulus.yaml --dryrun=false --substitutions TAG_NAME=[TAG] .
# This will create a docker image named gcr.io/[PROJECT_ID]/proxy:[TAG] 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-nomulus.yaml --substitutions TAG_NAME=[TAG] .
#
# 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:
# Set permissions correctly. Not sure why it is necessary, but it is.
- name: 'alpine'
args: ['chown', '-R', 'root:root', '.']
- name: 'alpine'
args: ['chmod', '-R', '777', '.']
# Clone the private repo and merge its contents.
- name: 'gcr.io/cloud-builders/gcloud'
args: ['source', 'repos', 'clone', 'nomulus-internal']
- name: 'alpine'
args: ['sh', '-c', 'cp -r nomulus-internal/* .']
# Create a directory to store the artifacts
- name: 'alpine'
args: ['mkdir', 'nomulus']
# Build the deployment files for sandbox.
- name: 'gcr.io/${PROJECT_ID}/builder'
args:
- './gradlew'
- 'stage'
- '-x'
- 'autoLintGradle'
- '-Penvironment=sandbox'
dir: 'gradle'
- name: 'alpine'
args: ['sh', './move_artifacts.sh', 'sandbox', 'nomulus']
# Build the deployment files for alpha.
- name: 'gcr.io/${PROJECT_ID}/builder'
args:
- './gradlew'
- 'stage'
- '-x'
- 'autoLintGradle'
- '-Penvironment=alpha'
dir: 'gradle'
- name: 'alpine'
args: ['sh', './move_artifacts.sh', 'alpha', 'nomulus']
# Create the uber tarball including all environments.
- name: 'alpine'
args: ['tar', 'cvf', '../nomulus.tar', '.']
dir: 'nomulus'
# The tarball to upload to GCS.
artifacts:
objects:
location: 'gs://${PROJECT_ID}-deploy/${TAG_NAME}'
paths: ['nomulus.tar']
timeout: 3600s
options:
machineType: 'N1_HIGHCPU_8'