diff --git a/release/cloudbuild-release.yaml b/release/cloudbuild-release.yaml index 9c5a818b7..37e1bb4c6 100644 --- a/release/cloudbuild-release.yaml +++ b/release/cloudbuild-release.yaml @@ -38,7 +38,7 @@ steps: rm -rf .git && rm -rf nomulus-internal/.git cp -rf nomulus-internal/* . rm -rf nomulus-internal -# Build the builder image and tag the proxy base image, to be uploaded later. +# Build the builder image and tag the proxy base image, then upload them to GCR. - name: 'gcr.io/cloud-builders/docker' entrypoint: /bin/bash args: @@ -68,6 +68,32 @@ steps: sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-proxy.yaml sed -i s/builder:latest/builder@$builder_digest/g release/cloudbuild-nomulus.yaml sed -i s/GCP_PROJECT/${PROJECT_ID}/ java/google/registry/proxy/kubernetes/proxy-*.yaml +# Upload the gradle binary to GCS if it does not exist and point URL in gradle wrapper to it. +- name: 'gcr.io/cloud-builders/gsutil' + entrypoint: /bin/bash + args: + - -c + - | + gradle_url=$(grep distributionUrl gradle/gradle/wrapper/gradle-wrapper.properties \ + | awk -F = '{print $2}' | sed 's/\\//g') + gradle_bin=$(basename $gradle_url) + gcs_loc="domain-registry-maven-repository/gradle" + curl -O -L ${gradle_url} + if gsutil -q stat gs://${gcs_loc}/${gradle_bin} + then + local_md5=$(md5sum ${gradle_bin} | awk '{print $1}') + remote_md5=$(gsutil hash -h gs://${gcs_loc}/${gradle_bin} | grep md5 | awk '{print $3}') + if [[ ${local_md5} != ${remote_md5} ]] + then + echo "${gradle_bin} HAS CHANGED ON GRADLE WEBSITE, USING THE BINARY ON GCS." + fi + else + gsutil cp $gradle_bin gs://${gcs_loc}/ + gsutil acl ch -u AllUsers:R gs://${gcs_loc}/${gradle_bin} + fi + rm ${gradle_bin} + sed -i s%services.gradle.org/distributions%storage.googleapis.com/${gcs_loc}% \ + gradle/gradle/wrapper/gradle-wrapper.properties # Check out the release repo. - name: 'gcr.io/cloud-builders/gcloud' args: ['source', 'repos', 'clone', 'nomulus-release']