From 7acf1362184ee4bb72bc9d23f9cd52273e8896a7 Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Tue, 11 Feb 2020 14:50:22 -0500 Subject: [PATCH] Use dependency cache in all Gradle tasks in GCB (#481) * Use dependency cache in all Gradle tasks in GCB Make the initial test and the final publishing steps use the shared dependency cache. Also make the initial test use the registry's own maven repo instead of Maven Central. --- release/build_nomulus_for_env.sh | 1 + release/cloudbuild-nomulus.yaml | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/release/build_nomulus_for_env.sh b/release/build_nomulus_for_env.sh index fc82ef811..2f9cabb53 100755 --- a/release/build_nomulus_for_env.sh +++ b/release/build_nomulus_for_env.sh @@ -34,6 +34,7 @@ gcs_prefix="storage.googleapis.com/domain-registry-maven-repository" # task. (See ./cloudbuild-nomulus.yaml, which calls this script in several # steps). If left at their default location, the caches will be lost after # each step. +# Note: must be consistent with value in ./cloudbuild-nomulus.yaml export GRADLE_USER_HOME="./cloudbuild-caches" if [ "${environment}" == tool ] diff --git a/release/cloudbuild-nomulus.yaml b/release/cloudbuild-nomulus.yaml index 4bb4dd0ec..c2377f975 100644 --- a/release/cloudbuild-nomulus.yaml +++ b/release/cloudbuild-nomulus.yaml @@ -21,7 +21,15 @@ steps: args: ['mkdir', 'nomulus'] # Run tests - name: 'gcr.io/${PROJECT_ID}/builder:latest' - args: ['./gradlew', 'test', '-PskipDockerIncompatibleTests=true'] + # Set home for Gradle caches. Must be consistent with last step below + # and ./build_nomulus_for_env.sh + env: [ 'GRADLE_USER_HOME=./cloudbuild-caches' ] + args: ['./gradlew', + 'test', + '-PskipDockerIncompatibleTests=true', + '-PmavenUrl=https://storage.googleapis.com/domain-registry-maven-repository/maven', + '-PpluginsUrl=https://storage.googleapis.com/domain-registry-maven-repository/plugins' + ] # Build the tool binary and image. - name: 'gcr.io/${PROJECT_ID}/builder:latest' args: ['release/build_nomulus_for_env.sh', 'tool', 'output'] @@ -70,6 +78,9 @@ steps: # server/schema compatibility tests. - name: 'gcr.io/${PROJECT_ID}/builder:latest' entrypoint: /bin/bash + # Set home for Gradle caches. Must be consistent with second step above + # and ./build_nomulus_for_env.sh + env: [ 'GRADLE_USER_HOME=./cloudbuild-caches' ] args: - -c - |