Skip to content

Commit

Permalink
ci: add retry to mamba invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Feb 12, 2025
1 parent 3034496 commit fab885e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/native-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
48 changes: 48 additions & 0 deletions ci/scripts/remamba.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"

0 comments on commit fab885e

Please sign in to comment.