mirror of
https://github.com/google/nomulus.git
synced 2025-04-29 19:47:51 +02:00
Do not delete build cache when building release candidates (#1619)
We would like to re-use the build cache when building RCs for different environments. There's not much practical use in doing a "clean" for every build when Gradle should be able to figure out which artifacts need to be rebuilt. It also does not make sense to build each environment in a separate step, which also introduces redunency because not all artifacts are cached across steps. The build cache is enabled by default. Lastly, the cache needs to be inside the /workspace folder, which is the default persisted storage location. TESTED=tried to build the RCs on alpha and saved about 10 min. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/1619) <!-- Reviewable:end -->
This commit is contained in:
parent
7dfdffbbad
commit
5352c06c7b
5 changed files with 21 additions and 28 deletions
|
@ -57,6 +57,7 @@ PROPERTIES_HEADER = """\
|
|||
#
|
||||
# DO NOT EDIT THIS FILE BY HAND
|
||||
org.gradle.jvmargs=-Xmx1024m
|
||||
org.gradle.caching=true
|
||||
"""
|
||||
|
||||
# Help text to be displayed (in addition to the synopsis and flag help, which
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#
|
||||
# DO NOT EDIT THIS FILE BY HAND
|
||||
org.gradle.jvmargs=-Xmx1024m
|
||||
org.gradle.caching=true
|
||||
mavenUrl=
|
||||
pluginsUrl=
|
||||
uploaderDestination=
|
||||
|
|
|
@ -29,19 +29,11 @@ environment="$1"
|
|||
dest="$2"
|
||||
gcs_prefix="gcs://domain-registry-maven-repository"
|
||||
|
||||
# Let Gradle put its caches (dependency cache and build cache) in the source
|
||||
# tree. This allows sharing of the caches between steps in a Cloud Build
|
||||
# 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 ]
|
||||
then
|
||||
mkdir -p "${dest}"
|
||||
|
||||
./gradlew clean :core:buildToolImage \
|
||||
./gradlew :core:buildToolImage \
|
||||
-PmavenUrl="${gcs_prefix}"/maven \
|
||||
-PpluginsUrl="${gcs_prefix}"/plugins
|
||||
|
||||
|
@ -50,7 +42,7 @@ else
|
|||
dest="${dest}/$1"
|
||||
mkdir -p "${dest}"
|
||||
|
||||
./gradlew clean stage -Penvironment="${environment}" \
|
||||
./gradlew stage -Penvironment="${environment}" \
|
||||
-PmavenUrl="${gcs_prefix}"/maven \
|
||||
-PpluginsUrl="${gcs_prefix}"/plugins
|
||||
|
||||
|
|
|
@ -23,16 +23,27 @@ steps:
|
|||
- name: 'gcr.io/${PROJECT_ID}/builder:latest'
|
||||
# Set home for Gradle caches. Must be consistent with last step below
|
||||
# and ./build_nomulus_for_env.sh
|
||||
env: [ 'GRADLE_USER_HOME=./cloudbuild-caches' ]
|
||||
env: [ 'GRADLE_USER_HOME=/workspace/cloudbuild-caches' ]
|
||||
args: ['./gradlew',
|
||||
'test',
|
||||
'-PskipDockerIncompatibleTests=true',
|
||||
'-PmavenUrl=gcs://domain-registry-maven-repository/maven',
|
||||
'-PpluginsUrl=gcs://domain-registry-maven-repository/plugins'
|
||||
]
|
||||
# Build the tool binary and image.
|
||||
# Build and package the deployment files for each environment, and the tool
|
||||
# binary and image.
|
||||
- name: 'gcr.io/${PROJECT_ID}/builder:latest'
|
||||
args: ['release/build_nomulus_for_env.sh', 'tool', 'output']
|
||||
# Set home for Gradle caches. Must be consistent with last step below
|
||||
# and ./build_nomulus_for_env.sh
|
||||
env: [ 'GRADLE_USER_HOME=/workspace/cloudbuild-caches' ]
|
||||
entrypoint: /bin/bash
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
for _env in tool alpha crash sandbox production
|
||||
do
|
||||
release/build_nomulus_for_env.sh $${_env} output
|
||||
done
|
||||
# Save TAG_NAME in ./output/tag_name, to be uploaded later. This file is purely
|
||||
# informational. It makes it easier to tell the tag of the current 'live' release.
|
||||
- name: 'gcr.io/${PROJECT_ID}/builder:latest'
|
||||
|
@ -61,24 +72,12 @@ steps:
|
|||
sed -i s/'$${_IMAGE}'/nomulus-tool/g release/cloudbuild-tag.yaml
|
||||
sed -i s/':$${TAG_NAME}'/@$digest/g release/cloudbuild-tag.yaml
|
||||
sed -i s/'nomulus-tool:latest'/nomulus-tool@$digest/g release/cloudbuild-deploy-*.yaml
|
||||
# Build and package the deployment files for alpha.
|
||||
- name: 'gcr.io/${PROJECT_ID}/builder:latest'
|
||||
args: ['release/build_nomulus_for_env.sh', 'alpha', 'output']
|
||||
# Build and package the deployment files for crash.
|
||||
- name: 'gcr.io/${PROJECT_ID}/builder:latest'
|
||||
args: ['release/build_nomulus_for_env.sh', 'crash', 'output']
|
||||
# Build and package the deployment files for sandbox.
|
||||
- name: 'gcr.io/${PROJECT_ID}/builder:latest'
|
||||
args: ['release/build_nomulus_for_env.sh', 'sandbox', 'output']
|
||||
# Build and package the deployment files for production.
|
||||
- name: 'gcr.io/${PROJECT_ID}/builder:latest'
|
||||
args: ['release/build_nomulus_for_env.sh', 'production', 'output']
|
||||
# Build and stage Dataflow Flex templates.
|
||||
- name: 'gcr.io/${PROJECT_ID}/builder:latest'
|
||||
entrypoint: /bin/bash
|
||||
# Set home for Gradle caches. Must be consistent with previous steps above
|
||||
# and ./build_nomulus_for_env.sh
|
||||
env: [ 'GRADLE_USER_HOME=./cloudbuild-caches' ]
|
||||
env: [ 'GRADLE_USER_HOME=/workspace/cloudbuild-caches' ]
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
|
@ -108,7 +107,7 @@ steps:
|
|||
entrypoint: /bin/bash
|
||||
# Set home for Gradle caches. Must be consistent with previous steps above
|
||||
# and ./build_nomulus_for_env.sh
|
||||
env: [ 'GRADLE_USER_HOME=./cloudbuild-caches' ]
|
||||
env: [ 'GRADLE_USER_HOME=/workspace/cloudbuild-caches' ]
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
|
|
|
@ -53,7 +53,7 @@ shift 4
|
|||
|
||||
maven_gcs_prefix="gcs://domain-registry-maven-repository"
|
||||
nom_build_dir="$(dirname $0)/.."
|
||||
${nom_build_dir}/nom_build clean :core:"${uberjar_task}" \
|
||||
${nom_build_dir}/nom_build :core:"${uberjar_task}" \
|
||||
--mavenUrl="${maven_gcs_prefix}"/maven \
|
||||
--pluginsUrl="${maven_gcs_prefix}"/plugins
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue