From 2a2d5f5dea69298dd9b7bf104644698073e19854 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 14:04:11 +0000 Subject: [PATCH] Retry CI bundler installs on rubygems blips ruby/setup-ruby's `bundler:` input installs bundler with one bare `gem install`, and RubyGems has no retry of its own. A single failed TCP connect to rubygems.org in hosted-e2e's Setup Ruby step failed the merge_group run for #1813 and evicted it from the queue. Install bundler in hosted-e2e through a new gem-install-retry.sh (the pip-install-retry.sh pattern: 4 attempts, growing pause) instead, with the same `~> 2.6.0` requirement setup-ruby used, and route the e2e job's Bundler 1.x install through it too. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_011f9aeTA3DTuUZTYGYzv6KB --- .github/workflows/ci.yml | 18 ++++++++++++++---- scripts/gem-install-retry.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100755 scripts/gem-install-retry.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9cb780ca..9e0974a71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1610,7 +1610,7 @@ jobs: shell: bash env: BUNDLER_TEST_VERSION: ${{ matrix.bundler }} - run: gem install bundler -v "$BUNDLER_TEST_VERSION" --no-document + run: scripts/gem-install-retry.sh bundler -v "$BUNDLER_TEST_VERSION" --no-document # Installing a bundler does not make `bundle` run it: with no lockfile # to read, RubyGems' binstub activates the HIGHEST installed bundler, @@ -2847,11 +2847,21 @@ jobs: uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1.295.0 with: ruby-version: '3.2.10' - # The gem hosted rewrite pins into the Gemfile.lock CHECKSUMS - # section, which `bundle lock --add-checksums` only emits on >= 2.6. - bundler: '2.6' + # Bundler comes from the next step, which retries rubygems.org + # blips; setup-ruby's own install is a single bare `gem install`. + bundler: 'none' bundler-cache: false + - name: Install Bundler + if: steps.gate.outputs.run == 'true' + # The gem hosted rewrite pins into the Gemfile.lock CHECKSUMS + # section, which `bundle lock --add-checksums` only emits on >= 2.6. + # `~> 2.6.0` is what setup-ruby's `bundler: '2.6'` installed; as the + # highest installed bundler it is the one `bundle` runs. + run: | + scripts/gem-install-retry.sh bundler -v '~> 2.6.0' --no-document + bundle --version + - name: Setup Go if: steps.gate.outputs.run == 'true' uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 diff --git a/scripts/gem-install-retry.sh b/scripts/gem-install-retry.sh new file mode 100755 index 000000000..b119e2c71 --- /dev/null +++ b/scripts/gem-install-retry.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# `gem install` that survives a rubygems.org connection blip. +# +# scripts/gem-install-retry.sh +# +# RubyGems has no retry of its own: one failed TCP connect to rubygems.org +# ("SocketError: Failed to open TCP connection to rubygems.org:443") aborts +# the install at once. ruby/setup-ruby's `bundler:` input runs exactly such +# a bare `gem install bundler`, and one blip there evicted a merge-queue +# entry in hosted-e2e, so the CI bundler installs go through here: up to 4 +# attempts with a growing pause. The args are passed through unchanged, so +# a pinned `-v X.Y.Z` stays pinned. +set -euo pipefail + +if [ "$#" -eq 0 ]; then + echo "usage: $0 " >&2 + exit 2 +fi + +attempts=4 +for attempt in $(seq 1 "$attempts"); do + if gem install "$@"; then + exit 0 + fi + if [ "$attempt" = "$attempts" ]; then + echo "::error::gem install $* failed on all $attempts attempts" + exit 1 + fi + echo "::warning::gem install $* attempt $attempt failed; retrying" + sleep $((attempt * 10)) +done