1
0
mirror of https://github.com/google/nomulus synced 2026-01-08 07:11:44 +00:00
Files
nomulus/cloudbuild.yaml
jianglai 879c48b079 Use gradlew in Cloud Build
Also moved pushing tags to the private repo to the last step as we do not want
to tag the configs unless the build is successful.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=223982622
2018-12-05 15:59:10 -05:00

45 lines
1.8 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.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.yaml --substitutions TAG_NAME=[TAG] .
#
# To trigger a build automatically, follow the instructions below and add a tigger:
# 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, tag it, and copy its contents to the correct place.
- name: 'gcr.io/cloud-builders/gcloud'
args: ['source', 'repos', 'clone', 'nomulus-config']
- name: 'gcr.io/cloud-builders/git'
args: ['tag', '$TAG_NAME']
dir: 'nomulus-config'
- name: 'alpine'
args: ['sh', '-c', 'cp -r nomulus-config/proxy/* java/google/registry/proxy/config/']
# Build the deploy jar.
- name: 'openjdk:8-slim'
args: ['./gradlew', 'testClasses', ':proxy:deployJar']
dir: 'gradle'
# Build the docker image.
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '--tag', 'gcr.io/$PROJECT_ID/proxy:$TAG_NAME', '.']
dir: 'gradle/proxy'
# Push the tag to the private repo after a successful build.
- name: 'gcr.io/cloud-builders/git'
args: ['push', 'origin', '$TAG_NAME']
dir: 'nomulus-config'
# Images to upload to GCR.
images: ['gcr.io/$PROJECT_ID/proxy:$TAG_NAME']
timeout: 3600s
options:
machineType: 'N1_HIGHCPU_8'