From 863b0cfece0f94832205c9081efe75be4eb752bf Mon Sep 17 00:00:00 2001 From: Michael Ernst Date: Tue, 25 Apr 2023 09:12:30 -0700 Subject: [PATCH] Avoid long pauses while Maven tries to download resources (#5802) --- azure-pipelines.yml | 6 ++++-- checker/bin-devel/build.sh | 16 +++++++++++++--- checker/bin-devel/mvn-settings.xml | 13 +++++++++++++ checker/bin-devel/test-guava.sh | 4 +++- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 checker/bin-devel/mvn-settings.xml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ebd5b1bbfd8..2a350c6c549 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -250,8 +250,10 @@ jobs: pool: vmImage: 'ubuntu-latest' container: mdernst/cf-ubuntu-jdk17:latest - # The guava job sometimes times out, but that is because the job stalls. - # When it doesn't stall, it finishes in about 30 minutes. + # The guava job sometimes times out, because the time between these lines can be 30 minutes! + # [INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools-generators/3.5.1/maven-plugin-tools-generators-3.5.1.pom + # [INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-tools-generators/3.5.1/maven-plugin-tools-generators-3.5.1.pom + # I think I have configured Maven to prevent that problem from occurring in the future. timeoutInMinutes: 60 steps: - checkout: self diff --git a/checker/bin-devel/build.sh b/checker/bin-devel/build.sh index d08aa35c675..859ed0db8f5 100755 --- a/checker/bin-devel/build.sh +++ b/checker/bin-devel/build.sh @@ -5,6 +5,16 @@ echo Entering checker/bin-devel/build.sh in "$(pwd)" # Fail the whole script if any command fails set -e +DEBUG=0 +# To enable debugging, uncomment the following line. +# DEBUG=1 + +if [ $DEBUG -eq 0 ] ; then + DEBUG_FLAG= +else + DEBUG_FLAG=--debug +fi + echo "initial CHECKERFRAMEWORK=$CHECKERFRAMEWORK" export CHECKERFRAMEWORK="${CHECKERFRAMEWORK:-$(pwd -P)}" echo "CHECKERFRAMEWORK=$CHECKERFRAMEWORK" @@ -32,14 +42,14 @@ else fi # Clone the annotated JDK into ../jdk . -"$PLUME_SCRIPTS/git-clone-related" typetools jdk +"$PLUME_SCRIPTS/git-clone-related" ${DEBUG_FLAG} typetools jdk AFU="${AFU:-../annotation-tools/annotation-file-utilities}" # Don't use `AT=${AFU}/..` which causes a git failure. AT=$(dirname "${AFU}") ## Build annotation-tools (Annotation File Utilities) -"$PLUME_SCRIPTS/git-clone-related" typetools annotation-tools "${AT}" +"$PLUME_SCRIPTS/git-clone-related" ${DEBUG_FLAG} typetools annotation-tools "${AT}" if [ ! -d ../annotation-tools ] ; then ln -s "${AT}" ../annotation-tools fi @@ -50,7 +60,7 @@ echo "... done: (cd ${AT} && ./.build-without-test.sh)" ## Build stubparser -"$PLUME_SCRIPTS/git-clone-related" typetools stubparser +"$PLUME_SCRIPTS/git-clone-related" ${DEBUG_FLAG} typetools stubparser echo "Running: (cd ../stubparser/ && ./.build-without-test.sh)" (cd ../stubparser/ && ./.build-without-test.sh) echo "... done: (cd ../stubparser/ && ./.build-without-test.sh)" diff --git a/checker/bin-devel/mvn-settings.xml b/checker/bin-devel/mvn-settings.xml new file mode 100644 index 00000000000..abbf1173deb --- /dev/null +++ b/checker/bin-devel/mvn-settings.xml @@ -0,0 +1,13 @@ + + + + central + + + + 120000 + 120000 + + + + diff --git a/checker/bin-devel/test-guava.sh b/checker/bin-devel/test-guava.sh index 4ede06b6f50..93cab9ff538 100755 --- a/checker/bin-devel/test-guava.sh +++ b/checker/bin-devel/test-guava.sh @@ -10,6 +10,8 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" # shellcheck disable=SC1090 # In newer shellcheck than 0.6.0, pass: "-P SCRIPTDIR" (literally) source "$SCRIPTDIR"/build.sh +# TODO: Maybe I should move this into the CI job, and do it for all CI jobs. +cp "$SCRIPTDIR"/mvn-settings.xml ~/settings.xml "$SCRIPTDIR/.plume-scripts/git-clone-related" typetools guava cd ../guava @@ -25,4 +27,4 @@ fi ## This command works locally, but on Azure it fails with timouts while downloading Maven dependencies. # cd guava && time mvn --debug -B package -P checkerframework-local -Dmaven.test.skip=true -Danimal.sniffer.skip=true -cd guava && time mvn --debug -B compile -P checkerframework-local +cd guava && time mvn -Dhttp.keepAlive=false -Daether.connector.http.connectionMaxTtl=25 --debug -B compile -P checkerframework-local