You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2023/04/30 22:04:55 UTC

[camel-quarkus] 03/03: Patch mvnw with maven-resolver-1.9.8 artifacts so that it honors aether.connector.http.connectionMaxTtl to avoid Connect timeouts on GH actions

This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit a89132ab6feb28c0750f9f8b2ce280f57f2059d8
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Sun Apr 30 21:39:07 2023 +0200

    Patch mvnw with maven-resolver-1.9.8 artifacts so that it honors aether.connector.http.connectionMaxTtl to avoid Connect timeouts on GH actions
---
 .github/workflows/camel-master-cron.yaml   | 35 +++++++++++++++++++++++
 .github/workflows/ci-build.yaml            | 43 ++++++++++++++++++++++++++++
 .github/workflows/pr-validate.yml          |  7 +++++
 .github/workflows/quarkus-master-cron.yaml | 35 +++++++++++++++++++++++
 patch-mvnw.sh                              | 46 ++++++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)

diff --git a/.github/workflows/camel-master-cron.yaml b/.github/workflows/camel-master-cron.yaml
index f39d7d3b10..40b8261c74 100644
--- a/.github/workflows/camel-master-cron.yaml
+++ b/.github/workflows/camel-master-cron.yaml
@@ -63,6 +63,13 @@ jobs:
           git fetch origin main
           git rebase origin/main
           git rev-parse origin/main > ~/build-data/main-sha.txt
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: mvn clean install -DskipTests
         run: |
           eval ./mvnw ${CQ_MAVEN_ARGS} ${BRANCH_OPTIONS} clean install -DskipTests -Dquarkus.build.skip
@@ -135,6 +142,13 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: '17'
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: Integration Tests
         run: |
           for MODULE in $(yq -M -N e ".${{ matrix.category }}" tooling/scripts/test-categories.yaml | cut -f2 -d' '); do
@@ -213,6 +227,13 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: '17'
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: cd extensions-core && mvn test
         run: |
           cd extensions-core
@@ -292,6 +313,13 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: ${{ matrix.java }}
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: cd integration-tests-jvm && mvn clean test
         run: |
           cd integration-tests-jvm
@@ -339,6 +367,13 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: '17'
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: cd integration-tests && mvn clean verify
         shell: bash
         run: |
diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml
index cdae7f887a..67a21499b3 100644
--- a/.github/workflows/ci-build.yaml
+++ b/.github/workflows/ci-build.yaml
@@ -85,6 +85,14 @@ jobs:
         with:
           ref: ${{ env.CHECKOUT_REF }}
           fetch-depth: 0
+      - name: Patch mvnw
+        if: steps.init.outputs.run-checks == 'true'
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: Pre build checks
         id: pre-build-checks
         run: |
@@ -151,6 +159,13 @@ jobs:
         with:
           ref: ${{ env.CHECKOUT_REF }}
           fetch-depth: 0
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: mvn clean install -DskipTests
         run: |
           eval ./mvnw ${CQ_MAVEN_ARGS} ${BRANCH_OPTIONS} clean install -DskipTests -Dquarkus.build.skip
@@ -217,6 +232,13 @@ jobs:
           df -h /
           tar -xzf ../maven-repo.tgz -C ~
           df -h /
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: Integration Tests
         run: |
           for MODULE in $(yq -M -N e ".${{ matrix.category }}" tooling/scripts/test-categories.yaml | cut -f2 -d' '); do
@@ -294,6 +316,13 @@ jobs:
           df -h /
           tar -xzf ../maven-repo.tgz -C ~
           df -h /
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: cd extensions-core && mvn test
         run: |
           cd extensions-core
@@ -371,6 +400,13 @@ jobs:
           echo "HOSTS_LINE=$HOSTS_LINE"
           echo "${HOSTS_LINE}" | sudo tee -a /etc/hosts
           cat /etc/hosts
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: cd integration-tests-jvm && mvn clean test
         run: |
           cd integration-tests-jvm
@@ -419,6 +455,13 @@ jobs:
         shell: bash
         run: |
           tar -xzf ../maven-repo.tgz -C ~
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: cd integration-tests && mvn clean verify
         shell: bash
         run: |
diff --git a/.github/workflows/pr-validate.yml b/.github/workflows/pr-validate.yml
index 5a38be0ffa..fb73949808 100644
--- a/.github/workflows/pr-validate.yml
+++ b/.github/workflows/pr-validate.yml
@@ -59,6 +59,13 @@ jobs:
       with:
         distribution: 'temurin'
         java-version: '17'
+    - name: Patch mvnw
+      run: |
+        # This can be removed after upgrading to Maven 3.9.2
+        # make sure mvnw is installed
+        ./mvnw -v
+        # upgrade maven-resolver artifacts
+        ./patch-mvnw.sh
     - name: mvn validate
       run: |
         ./mvnw ${CQ_MAVEN_ARGS} ${BRANCH_OPTIONS} -fae \
diff --git a/.github/workflows/quarkus-master-cron.yaml b/.github/workflows/quarkus-master-cron.yaml
index ed16c129cf..74a5789c0d 100644
--- a/.github/workflows/quarkus-master-cron.yaml
+++ b/.github/workflows/quarkus-master-cron.yaml
@@ -69,6 +69,13 @@ jobs:
             && cd quarkus \
             && echo "Current Quarkus commit:" $(git rev-parse HEAD) \
             && ./mvnw ${CQ_MAVEN_ARGS} clean install -Dquickly
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: mvn clean install -DskipTests
         run: |
           eval ./mvnw ${CQ_MAVEN_ARGS} ${BRANCH_OPTIONS} clean install -DskipTests -Dquarkus.build.skip
@@ -141,6 +148,13 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: '17'
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: Integration Tests
         run: |
           for MODULE in $(yq -M -N e ".${{ matrix.category }}" tooling/scripts/test-categories.yaml | cut -f2 -d' '); do
@@ -219,6 +233,13 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: '17'
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: cd extensions-core && mvn test
         run: |
           cd extensions-core
@@ -298,6 +319,13 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: ${{ matrix.java }}
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: cd integration-tests-jvm && mvn clean test
         run: |
           cd integration-tests-jvm
@@ -345,6 +373,13 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: '17'
+      - name: Patch mvnw
+        run: |
+          # This can be removed after upgrading to Maven 3.9.2
+          # make sure mvnw is installed
+          ./mvnw -v
+          # upgrade maven-resolver artifacts
+          ./patch-mvnw.sh
       - name: cd integration-tests && mvn clean verify
         shell: bash
         run: |
diff --git a/patch-mvnw.sh b/patch-mvnw.sh
new file mode 100755
index 0000000000..7a914cb1ac
--- /dev/null
+++ b/patch-mvnw.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+# A script to replace maven-resolver 1.9.7 artifacts with 1.9.8 ones
+# This is to be able to set aether.connector.http.connectionMaxTtl
+# which is supported only since 1.9.8
+# This is motivated by https://github.com/apache/camel-quarkus/issues/4842
+# This workaround can be removed after the upgrade to Maven 3.9.2
+
+#set -x
+set -e
+
+cd ~/.m2/wrapper/dists/apache-maven-3.9.1-bin/*/apache-maven-3.9.1/lib
+for oldJar in maven-resolver-*-1.9.7.jar; do
+    if [ "$oldJar" != 'maven-resolver-*-1.9.7.jar' ]; then
+        base="${oldJar/%-1.9.7.jar}"
+        echo $base
+        newJar="$base-1.9.8.jar"
+        if [[ ! -f "$newJar" ]]
+        then
+            echo "Downloading $newJar"
+            curl -s -O "https://repo1.maven.org/maven2/org/apache/maven/resolver/$base/1.9.8/$newJar"
+        fi
+        if [[ -f "$oldJar" ]]
+        then
+            echo "Deleting $oldJar"
+            rm "$oldJar"
+        fi
+    fi
+done