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

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new d10848bc2 ci: add retry to mamba invocations (#2520)
d10848bc2 is described below

commit d10848bc2f552d501721f8c416ecc1cfd1019c4b
Author: David Li <[email protected]>
AuthorDate: Wed Feb 12 19:42:22 2025 -0500

    ci: add retry to mamba invocations (#2520)
    
    Fixes #2519.
---
 .github/workflows/integration.yml |  8 +++----
 .github/workflows/native-unix.yml | 14 ++++++------
 ci/scripts/remamba.sh             | 48 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/integration.yml 
b/.github/workflows/integration.yml
index 07ecd2e94..407650ffc 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -75,7 +75,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             --file ci/conda_env_cpp.txt
       - name: Work around ASAN issue (GH-1617)
         run: |
@@ -125,7 +125,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             --file ci/conda_env_cpp.txt \
             --file ci/conda_env_python.txt
           pip install pytest-error-for-skips
@@ -194,7 +194,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             --file ci/conda_env_cpp.txt \
             --file ci/conda_env_python.txt
           pip install pytest-error-for-skips
@@ -294,7 +294,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             --file ci/conda_env_cpp.txt \
             --file ci/conda_env_python.txt
       - name: Work around ASAN issue (GH-1617)
diff --git a/.github/workflows/native-unix.yml 
b/.github/workflows/native-unix.yml
index 53bd7905b..2d3e34e75 100644
--- a/.github/workflows/native-unix.yml
+++ b/.github/workflows/native-unix.yml
@@ -102,7 +102,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             --file ci/conda_env_cpp.txt
       - uses: actions/setup-go@v5
         with:
@@ -180,7 +180,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             --file ci/conda_env_cpp.txt
       - name: Work around ASAN issue (GH-1617)
         if: matrix.os == 'ubuntu-latest'
@@ -290,7 +290,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             --file ci/conda_env_cpp.txt \
             --file ci/conda_env_cpp_lint.txt
 
@@ -336,7 +336,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             'arrow-c-glib>=10.0.1' \
             --file ci/conda_env_cpp.txt \
             --file ci/conda_env_glib.txt
@@ -477,7 +477,7 @@ jobs:
 
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             --file ci/conda_env_cpp.txt
       - uses: actions/setup-go@v5
         with:
@@ -556,7 +556,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             python=${{ matrix.python }} \
             --file ci/conda_env_cpp.txt \
             --file ci/conda_env_python.txt
@@ -666,7 +666,7 @@ jobs:
           use-mamba: true
       - name: Install Dependencies
         run: |
-          mamba install -c conda-forge \
+          ./ci/scripts/remamba.sh install -c conda-forge \
             python=${{ matrix.python }} \
             --file ci/conda_env_docs.txt \
             --file ci/conda_env_python.txt
diff --git a/ci/scripts/remamba.sh b/ci/scripts/remamba.sh
new file mode 100755
index 000000000..c397319ca
--- /dev/null
+++ b/ci/scripts/remamba.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env 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.
+
+# Re-run mamba if it flakes.
+
+# set -euxo pipefail
+
+main() {
+    local count=0
+    while [[ $count -lt 5 ]]; do
+        # https://stackoverflow.com/questions/12451278
+        exec 5>&1
+        MAMBA_OUTPUT=$(mamba "$@" 2>&1 | tee /dev/fd/5; exit ${PIPESTATUS[0]})
+        exit_code=$?
+        if [[ $exit_code -eq 0 ]]; then
+            echo "Mamba succeeded!"
+            return 0
+        fi
+
+        count=$((count + 1))
+
+        if echo $MAMBA_OUTPUT | grep "Found incorrect download" >/dev/null; 
then
+            echo "Mamba flaked..."
+            continue
+        fi
+        echo "Mamba failed, aborting"
+        return $exit_code
+    done
+    echo "Mamba flaked too many times, aborting"
+    exit 1
+}
+
+main "$@"

Reply via email to