Use JSON API for Maven Repo on GCS (#483)

* Use JSON API for Maven Repo on GCS

The url pattern https://storage.googleapis.com/{Bucket}/{Path}
uses the legacy XML API, which seems to be less robust than
the JSON API. We have observed connection resets after a few
thousand-file download bursts over 30 minutes.

This PR changes all urls to registry's Maven repo on GCS to
gcs://{Bucket}/{Path}. Gradle uses the JSON API for such urls.

TESTED=In Cloud Build with local change
This commit is contained in:
Weimin Yu 2020-02-12 14:03:50 -05:00 committed by GitHub
parent a3a7bd8a2e
commit 20ad27cfdd
3 changed files with 13 additions and 13 deletions

View file

@ -27,7 +27,7 @@ fi
environment="$1" environment="$1"
dest="$2" dest="$2"
gcs_prefix="storage.googleapis.com/domain-registry-maven-repository" gcs_prefix="gcs://domain-registry-maven-repository"
# Let Gradle put its caches (dependency cache and build cache) in the source # 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 # tree. This allows sharing of the caches between steps in a Cloud Build
@ -42,8 +42,8 @@ then
mkdir -p "${dest}" mkdir -p "${dest}"
./gradlew clean :core:buildToolImage \ ./gradlew clean :core:buildToolImage \
-PmavenUrl=https://"${gcs_prefix}"/maven \ -PmavenUrl="${gcs_prefix}"/maven \
-PpluginsUrl=https://"${gcs_prefix}"/plugins -PpluginsUrl="${gcs_prefix}"/plugins
mv core/build/libs/nomulus.jar "${dest}" mv core/build/libs/nomulus.jar "${dest}"
else else
@ -51,8 +51,8 @@ else
mkdir -p "${dest}" mkdir -p "${dest}"
./gradlew clean stage -Penvironment="${environment}" \ ./gradlew clean stage -Penvironment="${environment}" \
-PmavenUrl=https://"${gcs_prefix}"/maven \ -PmavenUrl="${gcs_prefix}"/maven \
-PpluginsUrl=https://"${gcs_prefix}"/plugins -PpluginsUrl="${gcs_prefix}"/plugins
for service in default pubapi backend tools for service in default pubapi backend tools
do do

View file

@ -27,8 +27,8 @@ steps:
args: ['./gradlew', args: ['./gradlew',
'test', 'test',
'-PskipDockerIncompatibleTests=true', '-PskipDockerIncompatibleTests=true',
'-PmavenUrl=https://storage.googleapis.com/domain-registry-maven-repository/maven', '-PmavenUrl=gcs://domain-registry-maven-repository/maven',
'-PpluginsUrl=https://storage.googleapis.com/domain-registry-maven-repository/plugins' '-PpluginsUrl=gcs://domain-registry-maven-repository/plugins'
] ]
# Build the tool binary and image. # Build the tool binary and image.
- name: 'gcr.io/${PROJECT_ID}/builder:latest' - name: 'gcr.io/${PROJECT_ID}/builder:latest'
@ -87,14 +87,14 @@ steps:
set -e set -e
./gradlew \ ./gradlew \
:db:publish \ :db:publish \
-PmavenUrl=https://storage.googleapis.com/domain-registry-maven-repository/maven \ -PmavenUrl=gcs://domain-registry-maven-repository/maven \
-PpluginsUrl=https://storage.googleapis.com/domain-registry-maven-repository/plugins \ -PpluginsUrl=gcs://domain-registry-maven-repository/plugins \
-Ppublish_repo=gcs://${PROJECT_ID}-deployed-tags/maven \ -Ppublish_repo=gcs://${PROJECT_ID}-deployed-tags/maven \
-Pschema_version=${TAG_NAME} -Pschema_version=${TAG_NAME}
./gradlew \ ./gradlew \
:core:publish \ :core:publish \
-PmavenUrl=https://storage.googleapis.com/domain-registry-maven-repository/maven \ -PmavenUrl=gcs://domain-registry-maven-repository/maven \
-PpluginsUrl=https://storage.googleapis.com/domain-registry-maven-repository/plugins \ -PpluginsUrl=gcs://domain-registry-maven-repository/plugins \
-Ppublish_repo=gcs://${PROJECT_ID}-deployed-tags/maven \ -Ppublish_repo=gcs://${PROJECT_ID}-deployed-tags/maven \
-Pnomulus_version=${TAG_NAME} -Pnomulus_version=${TAG_NAME}
# Upload schema jar for use by schema deployment. # Upload schema jar for use by schema deployment.

View file

@ -19,8 +19,8 @@ steps:
- ./gradlew - ./gradlew
- :proxy:test - :proxy:test
- :proxy:buildProxyImage - :proxy:buildProxyImage
- -PmavenUrl=https://storage.googleapis.com/domain-registry-maven-repository/maven - -PmavenUrl=gcs://domain-registry-maven-repository/maven
- -PpluginsUrl=https://storage.googleapis.com/domain-registry-maven-repository/plugins - -PpluginsUrl=gcs://domain-registry-maven-repository/plugins
# Tag and push the image. We can't let Cloud Build's default processing do that for us # Tag and push the image. We can't let Cloud Build's default processing do that for us
# because we need to push the image before we can sign it in the following step. # because we need to push the image before we can sign it in the following step.
- name: 'gcr.io/${PROJECT_ID}/builder:latest' - name: 'gcr.io/${PROJECT_ID}/builder:latest'