Skip to content

Commit 662b04a

Browse files
authored
CI - Additional retries for Maven central download errors (#3479)
1 parent 2ca3ca1 commit 662b04a

File tree

5 files changed

+77
-16
lines changed

5 files changed

+77
-16
lines changed

.github/workflows/assembly.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,23 @@ jobs:
3838
path: ~/.m2/repository/
3939
- name: Set Scala version
4040
run: ./build/scripts/change-scala-version.sh ${{ matrix.scala-version }}
41-
- name: Build with Maven
42-
run: mvn $MAVEN_COMPILE_NO_OP_ARGS $MAVEN_CLI_OPTS
41+
- name: Compile
42+
id: compile
43+
continue-on-error: true
44+
run: |
45+
set -o pipefail
46+
mvn $MAVEN_COMPILE_NO_OP_ARGS $MAVEN_CLI_OPTS | tee -a build.log
47+
- name: Compile (retry)
48+
if: steps.compile.outcome=='failure'
49+
run: |
50+
set -o pipefail
51+
# retry if the failure was due to transient download errors from maven central
52+
if [[ grep -q -e 'Could not transfer artifact' -e 'Failed to read artifact descriptor' build.log ]]; then
53+
RESUME_FROM="$({ grep --text 'mvn <args> -rf ' build.log || test $? = 1; } | tail -n1 | sed 's/.*-rf/-rf/')"
54+
mvn $MAVEN_COMPILE_NO_OP_ARGS $MAVEN_CLI_OPTS $RESUME_FROM | tee -a build.log
55+
else
56+
exit 1
57+
fi
4358
- name: Build assemblies
4459
run: mvn $MAVEN_ASSEMBLY_ARGS $MAVEN_CLI_OPTS
4560
- name: Remove geomesa artifacts

.github/workflows/build-and-test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,30 +85,30 @@ jobs:
8585
path: ~/.m2/repository/
8686
- name: Set Scala version
8787
run: ./build/scripts/change-scala-version.sh ${{ matrix.scala-version }}
88-
- name: Build with Maven
88+
- name: Compile
8989
id: compile
9090
continue-on-error: true
9191
run: |
9292
set -o pipefail
9393
mvn $MAVEN_COMPILE_ARGS $MAVEN_CLI_OPTS -am -pl ${{ matrix.projects.list }} | tee -a build.log
94-
- name: Build with Maven (retry)
94+
- name: Compile (retry)
9595
if: steps.compile.outcome=='failure'
9696
run: |
9797
set -o pipefail
9898
# retry if the failure was due to transient download errors from maven central
99-
if [[ grep -q 'Could not transfer artifact .* from/to central' build.log ]]; then
99+
if [[ grep -q -e 'Could not transfer artifact' -e 'Failed to read artifact descriptor' build.log ]]; then
100100
RESUME_FROM="$({ grep --text 'mvn <args> -rf ' build.log || test $? = 1; } | tail -n1 | sed 's/.*-rf/-rf/')"
101101
mvn $MAVEN_COMPILE_ARGS $MAVEN_CLI_OPTS -am -pl ${{ matrix.projects.list }} $RESUME_FROM | tee -a build.log
102102
else
103103
exit 1
104104
fi
105-
- name: Unit tests
105+
- name: Run unit tests
106106
id: test
107107
continue-on-error: true
108108
run: |
109109
set -o pipefail
110110
mvn $MAVEN_TEST_ARGS $MAVEN_CLI_OPTS -pl ${{ matrix.projects.list }} | tee -a test.log
111-
- name: Unit tests (retry)
111+
- name: Run unit tests (retry)
112112
id: test-retry
113113
if: steps.test.outcome=='failure'
114114
continue-on-error: true

.github/workflows/dash.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,27 @@ jobs:
6868
changed="true"
6969
fi
7070
echo "changed=$changed" >> "$GITHUB_OUTPUT"
71-
- name: License check
71+
- name: Compile
7272
if: steps.dependency_changes.outputs.changed == 'true'
73+
id: compile
74+
continue-on-error: true
75+
run: |
76+
set -o pipefail
77+
mvn $MAVEN_COMPILE_NO_OP_ARGS $MAVEN_CLI_OPTS | tee -a build.log
78+
- name: Compile (retry)
79+
if: steps.compile.outcome=='failure'
7380
run: |
74-
mvn $MAVEN_COMPILE_NO_OP_ARGS $MAVEN_CLI_OPTS
75-
mvn $MAVEN_DASH_ARGS $MAVEN_CLI_OPTS
81+
set -o pipefail
82+
# retry if the failure was due to transient download errors from maven central
83+
if [[ grep -q -e 'Could not transfer artifact' -e 'Failed to read artifact descriptor' build.log ]]; then
84+
RESUME_FROM="$({ grep --text 'mvn <args> -rf ' build.log || test $? = 1; } | tail -n1 | sed 's/.*-rf/-rf/')"
85+
mvn $MAVEN_COMPILE_NO_OP_ARGS $MAVEN_CLI_OPTS $RESUME_FROM | tee -a build.log
86+
else
87+
exit 1
88+
fi
89+
- name: License check
90+
if: steps.dependency_changes.outputs.changed == 'true'
91+
run: mvn $MAVEN_DASH_ARGS $MAVEN_CLI_OPTS
7692
- name: Show license
7793
if: success() || failure()
7894
run: |

.github/workflows/integration-tests.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,26 @@ jobs:
4242
path: ~/.m2/repository/
4343
- name: Set Scala version
4444
run: ./build/scripts/change-scala-version.sh ${{ matrix.scala-version }}
45-
- name: Build with Maven
45+
- name: Compile
46+
id: compile
47+
continue-on-error: true
4648
run: |
47-
mvn $MAVEN_COMPILE_ARGS $MAVEN_CLI_OPTS -am -pl ${{ matrix.projects.list }}
48-
mvn $MAVEN_IT_COMPILE_ARGS $MAVEN_CLI_OPTS -pl ${{ matrix.projects.list }}
49-
- name: Integration tests
49+
set -o pipefail
50+
mvn $MAVEN_COMPILE_ARGS $MAVEN_CLI_OPTS -am -pl ${{ matrix.projects.list }} | tee -a build.log
51+
- name: Compile (retry)
52+
if: steps.compile.outcome=='failure'
53+
run: |
54+
set -o pipefail
55+
# retry if the failure was due to transient download errors from maven central
56+
if [[ grep -q -e 'Could not transfer artifact' -e 'Failed to read artifact descriptor' build.log ]]; then
57+
RESUME_FROM="$({ grep --text 'mvn <args> -rf ' build.log || test $? = 1; } | tail -n1 | sed 's/.*-rf/-rf/')"
58+
mvn $MAVEN_COMPILE_ARGS $MAVEN_CLI_OPTS -am -pl ${{ matrix.projects.list }} $RESUME_FROM | tee -a build.log
59+
else
60+
exit 1
61+
fi
62+
- name: Compile integration tests
63+
run: mvn $MAVEN_IT_COMPILE_ARGS $MAVEN_CLI_OPTS -pl ${{ matrix.projects.list }}
64+
- name: Run integration tests
5065
run: mvn $MAVEN_IT_TEST_ARGS $MAVEN_CLI_OPTS -pl ${{ matrix.projects.list }}
5166
- name: Remove geomesa artifacts
5267
if: success() || failure()

.github/workflows/spark.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,23 @@ jobs:
4848
path: ~/.m2/repository/
4949
- name: Set Scala version
5050
run: ./build/scripts/change-scala-version.sh ${{ matrix.scala-version }}
51-
- name: Build with Maven
52-
run: mvn $MAVEN_COMPILE_SPARK_ARGS $MAVEN_CLI_OPTS -am -pl ${{ matrix.projects.list }}
51+
- name: Compile
52+
id: compile
53+
continue-on-error: true
54+
run: |
55+
set -o pipefail
56+
mvn $MAVEN_COMPILE_SPARK_ARGS $MAVEN_CLI_OPTS -am -pl ${{ matrix.projects.list }} | tee -a build.log
57+
- name: Compile (retry)
58+
if: steps.compile.outcome=='failure'
59+
run: |
60+
set -o pipefail
61+
# retry if the failure was due to transient download errors from maven central
62+
if [[ grep -q -e 'Could not transfer artifact' -e 'Failed to read artifact descriptor' build.log ]]; then
63+
RESUME_FROM="$({ grep --text 'mvn <args> -rf ' build.log || test $? = 1; } | tail -n1 | sed 's/.*-rf/-rf/')"
64+
mvn $MAVEN_COMPILE_SPARK_ARGS $MAVEN_CLI_OPTS -am -pl ${{ matrix.projects.list }} $RESUME_FROM | tee -a build.log
65+
else
66+
exit 1
67+
fi
5368
- name: Run Spark tests
5469
run: mvn $MAVEN_TEST_SPARK_ARGS $MAVEN_CLI_OPTS -pl ${{ matrix.projects.list }}
5570
- name: Remove geomesa artifacts

0 commit comments

Comments
 (0)