google-nomulus/cloudbuild-nomulus.yaml
mmuller 4eb1cd592d Make cloud build of nomulus use the GCS repo.
Also change comments to cover a few ambiguous points.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=241731091
2019-04-05 11:39:53 -04:00

68 lines
2.5 KiB
YAML

# 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 root of a nomulus source tree, run:
# cloud-build-local --config=cloudbuild-nomulus.yaml --dryrun=false --substitutions TAG_NAME=[TAG] .
# 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-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'
- '-PmavenUrl=gcs://domain-registry-maven-repository/maven'
- '-PpluginsUrl=gcs://domain-registry-maven-repository/plugins'
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'
- '-PmavenUrl=gcs://domain-registry-maven-repository/maven'
- '-PpluginsUrl=gcs://domain-registry-maven-repository/plugins'
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'