Skip to content

Commit

Permalink
Avoid long pauses while Maven tries to download resources (#5802)
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Apr 25, 2023
1 parent a32347e commit 863b0cf
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
6 changes: 4 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions checker/bin-devel/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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)"
Expand Down
13 changes: 13 additions & 0 deletions checker/bin-devel/mvn-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- This file goes in your home directory. -->

<server>
<id>central</id>
<configuration>
<httpConfiguration>
<all>
<connectionTimeout>120000</connectionTimeout> <!-- 2 minutes -->
<readTimeout>120000</readTimeout> <!-- 2 minutes -->
</all>
</httpConfiguration>
</configuration>
</server>
4 changes: 3 additions & 1 deletion checker/bin-devel/test-guava.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 863b0cf

Please sign in to comment.