GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Retry CI bundler installs on rubygems blips · SocketDev/socket-patch@2a2d5f5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • ci.yml
  • scripts
    • gem-install-retry.sh
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/ci.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+14-4Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ jobs:
16101610
shell: bash
16111611
env:
16121612
BUNDLER_TEST_VERSION: ${{ matrix.bundler }}
1613-
run: gem install bundler -v "$BUNDLER_TEST_VERSION" --no-document
1613+
run: scripts/gem-install-retry.sh bundler -v "$BUNDLER_TEST_VERSION" --no-document
16141614

16151615
# Installing a bundler does not make `bundle` run it: with no lockfile
16161616
# to read, RubyGems' binstub activates the HIGHEST installed bundler,
@@ -2847,11 +2847,21 @@ jobs:
28472847
uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1.295.0
28482848
with:
28492849
ruby-version: '3.2.10'
2850-
# The gem hosted rewrite pins into the Gemfile.lock CHECKSUMS
2851-
# section, which `bundle lock --add-checksums` only emits on >= 2.6.
2852-
bundler: '2.6'
2850+
# Bundler comes from the next step, which retries rubygems.org
2851+
# blips; setup-ruby's own install is a single bare `gem install`.
2852+
bundler: 'none'
28532853
bundler-cache: false
28542854

2855+
- name: Install Bundler
2856+
if: steps.gate.outputs.run == 'true'
2857+
# The gem hosted rewrite pins into the Gemfile.lock CHECKSUMS
2858+
# section, which `bundle lock --add-checksums` only emits on >= 2.6.
2859+
# `~> 2.6.0` is what setup-ruby's `bundler: '2.6'` installed; as the
2860+
# highest installed bundler it is the one `bundle` runs.
2861+
run: |
2862+
scripts/gem-install-retry.sh bundler -v '~> 2.6.0' --no-document
2863+
bundle --version
2864+
28552865
- name: Setup Go
28562866
if: steps.gate.outputs.run == 'true'
28572867
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
Collapse file

‎scripts/gem-install-retry.sh‎

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
# `gem install` that survives a rubygems.org connection blip.
3+
#
4+
# scripts/gem-install-retry.sh <gem install args...>
5+
#
6+
# RubyGems has no retry of its own: one failed TCP connect to rubygems.org
7+
# ("SocketError: Failed to open TCP connection to rubygems.org:443") aborts
8+
# the install at once. ruby/setup-ruby's `bundler:` input runs exactly such
9+
# a bare `gem install bundler`, and one blip there evicted a merge-queue
10+
# entry in hosted-e2e, so the CI bundler installs go through here: up to 4
11+
# attempts with a growing pause. The args are passed through unchanged, so
12+
# a pinned `-v X.Y.Z` stays pinned.
13+
set -euo pipefail
14+
15+
if [ "$#" -eq 0 ]; then
16+
echo "usage: $0 <gem install args...>" >&2
17+
exit 2
18+
fi
19+
20+
attempts=4
21+
for attempt in $(seq 1 "$attempts"); do
22+
if gem install "$@"; then
23+
exit 0
24+
fi
25+
if [ "$attempt" = "$attempts" ]; then
26+
echo "::error::gem install $* failed on all $attempts attempts"
27+
exit 1
28+
fi
29+
echo "::warning::gem install $* attempt $attempt failed; retrying"
30+
sleep $((attempt * 10))
31+
done

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.