Skip to content

Fix CI, test through Ruby 4.0, and pin actions by SHA - #605

Open
tas50 wants to merge 3 commits into
upserve:masterfrom
tas50:fix-ci-install-steps
Open

Fix CI, test through Ruby 4.0, and pin actions by SHA#605
tas50 wants to merge 3 commits into
upserve:masterfrom
tas50:fix-ci-install-steps

Conversation

@tas50

@tas50 tas50 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Every job on the Unit Tests workflow was failing before running a single spec (before). This gets the whole matrix green and extends it through Ruby 4.0.

1. Both install steps were broken

docker-rspec — the ubuntu-24.04 runner image now preinstalls a docker-ce newer than the 26.x/27.x versions pinned in the matrix, so installing the pin is a downgrade:

The following packages will be DOWNGRADED: docker-ce
E: Packages were downgraded and -y was used without --allow-downgrades.

Fixed by passing --allow-downgrades.

The existing Could not install diagnostic was also unreachable — the step runs under bash -e, so it exited at the failing apt-get before the if [ $? -ne 0 ] was evaluated, which is why runs showed the raw apt error and never the intended message. Replaced with a check that apt-cache madison actually matched a version.

podman-rspecscript/install_podman.sh pulled podman from the openSUSE Build Service repo devel:kubic:libcontainers:stable. That project was retired and Release.key now serves an HTML error page instead of a signing key:

<title>Resource is no longer available!</title>
gpg: no valid OpenPGP data found.

Ubuntu ships podman in universe (4.9.3+ds1-1ubuntu0.1 on 24.04), so the third-party repo is dropped entirely.

2. Spec failures the install fixes exposed

All twelve Ruby 3.x jobs failed on its(:resource) with private method 'resource' called. #resource is deliberately private, and rspec-its dispatches with public_send on Ruby 3.0+. Every 2.x job passed and every 3.x job failed, so this was the single systematic cause. Now called with send from a plain example.

A race in the Container#stop spec. POST /containers/{id}/stop returns once the daemon has signalled the container, which can land just before it leaves the running list, so listing running containers immediately afterwards is a race. It now waits on the not-running condition first — Container#wait is already the synchronisation primitive used elsewhere in that file, and the wait endpoint defaults to exactly the condition the assertion checks.

3. Ruby 3.4 and 4.0

base64 stopped being a default gem in Ruby 3.4, so require 'base64' in lib/docker.rb raises LoadError under Bundler. The gem is currently unusable on Ruby 3.4+ — this is a real user-facing bug, not just a CI one:

cannot load such file -- base64 (LoadError)
  from lib/docker.rb:7:in '<top (required)>'

Declared base64 as a runtime dependency. On older rubies it resolves to the default gem, so nothing changes there. Ruby 3.4 and 4.0 are added to both matrices and pass.

4. Supply chain

  • actions/checkout and ruby/setup-ruby are pinned to commit SHAs rather than mutable tags, updated to their latest releases (v4v7.0.1, v1v1.321.0). The checkout bump also clears the Node 20 deprecation warning.
  • apt-key replaced with a signed-by keyring for the Docker repo. apt-key is deprecated, warned on every run, and is slated for removal — it would have broken this workflow a second time. This also clears the Key is stored in legacy trusted.gpg keyring warning.
  • Added .github/dependabot.yml so the pinned SHAs still get updated, with a 7 day cooldown so a compromised release is not picked up the moment it is published.

Result

All 30 jobs green — Ruby 2.4 through 4.0, against Docker 26 and 27, plus podman.

tas50 added 3 commits August 23, 2026 11:06
Every job on the Unit Tests workflow currently fails before running a
single spec. Two independent causes, one per job.

docker-rspec: the ubuntu-24.04 runner image now preinstalls a docker-ce
newer than the 26.x/27.x versions pinned in the matrix, so installing the
pin is a downgrade and apt refuses it:

    The following packages will be DOWNGRADED: docker-ce
    E: Packages were downgraded and -y was used without --allow-downgrades.

Pass --allow-downgrades. The existing "Could not install" diagnostic was
unreachable, since the step runs under `bash -e` and exits at the failing
apt-get before the `if` is evaluated; check that madison actually matched
a version instead, so an unmatched pin reports the available versions.

podman-rspec: script/install_podman.sh pulled podman from the openSUSE
Build Service repo devel:kubic:libcontainers:stable. That project was
retired and Release.key now serves an HTML "Resource is no longer
available!" page, so apt-key fails:

    gpg: no valid OpenPGP data found.

Ubuntu ships podman in universe (4.9.3 on 24.04), so drop the
third-party repo and install from Ubuntu directly.

Also replace apt-key with a signed-by keyring for the Docker repo.
apt-key is deprecated, emits a warning on every run, and is slated for
removal, which would break this workflow a second time.
With the install steps fixed the specs actually run again, which exposed
the remaining failures and let the matrix be extended.

Ruby 3.x spec failure: `its(:resource)` fails on every Ruby 3.x job with
"private method 'resource' called". #resource is deliberately private and
rspec-its dispatches with public_send on Ruby 3.0+. Call it with send
from a plain example instead. This was the only spec failure; all twelve
Ruby 3.x jobs failed on it and every 2.x job passed.

Ruby 3.4 / 4.0 support: base64 stopped being a default gem in Ruby 3.4,
so `require 'base64'` in lib/docker.rb raises LoadError under Bundler.
The gem is simply unusable on 3.4+ right now. Declare base64 as a
runtime dependency. On older rubies it resolves to the default gem, so
nothing changes there.

Add 3.4 and 4.0 to both job matrices.

Supply chain: pin actions/checkout and ruby/setup-ruby to commit SHAs
rather than mutable tags, updated to their latest releases (checkout
v4 -> v7.0.1, setup-ruby v1 -> v1.321.0). The checkout bump also clears
the Node 20 deprecation warning. Add .github/dependabot.yml so the
pinned SHAs still get updated, with a 7 day cooldown so a compromised
release is not picked up the moment it is published.
docker-rspec (2.5, :26.) failed on this while the other 29 jobs passed,
including Ruby 2.5 against Docker 27:

  1) Docker::Container#stop stops the container
     expected `[...].none?` to be truthy, got false

POST /containers/{id}/stop returns once the daemon has signalled the
container, which can land just before it leaves the running list, so
listing running containers immediately afterwards is a race.

Wait on the not-running condition before asserting. Container#wait is
already the synchronisation primitive used elsewhere in this file, and
POST /containers/{id}/wait defaults to exactly the not-running condition
the assertion checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant