Fix CI, test through Ruby 4.0, and pin actions by SHA - #605
Open
tas50 wants to merge 3 commits into
Open
Conversation
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.
This was referenced Aug 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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— theubuntu-24.04runner image now preinstalls adocker-cenewer than the 26.x/27.x versions pinned in the matrix, so installing the pin is a downgrade:Fixed by passing
--allow-downgrades.The existing
Could not installdiagnostic was also unreachable — the step runs underbash -e, so it exited at the failingapt-getbefore theif [ $? -ne 0 ]was evaluated, which is why runs showed the raw apt error and never the intended message. Replaced with a check thatapt-cache madisonactually matched a version.podman-rspec—script/install_podman.shpulled podman from the openSUSE Build Service repodevel:kubic:libcontainers:stable. That project was retired andRelease.keynow serves an HTML error page instead of a signing key:Ubuntu ships podman in universe (
4.9.3+ds1-1ubuntu0.1on 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)withprivate method 'resource' called.#resourceis deliberately private, and rspec-its dispatches withpublic_sendon Ruby 3.0+. Every 2.x job passed and every 3.x job failed, so this was the single systematic cause. Now called withsendfrom a plain example.A race in the
Container#stopspec.POST /containers/{id}/stopreturns 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#waitis 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
base64stopped being a default gem in Ruby 3.4, sorequire 'base64'inlib/docker.rbraisesLoadErrorunder Bundler. The gem is currently unusable on Ruby 3.4+ — this is a real user-facing bug, not just a CI one:Declared
base64as 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/checkoutandruby/setup-rubyare pinned to commit SHAs rather than mutable tags, updated to their latest releases (v4→v7.0.1,v1→v1.321.0). The checkout bump also clears the Node 20 deprecation warning.apt-keyreplaced with asigned-bykeyring for the Docker repo.apt-keyis deprecated, warned on every run, and is slated for removal — it would have broken this workflow a second time. This also clears theKey is stored in legacy trusted.gpg keyringwarning..github/dependabot.ymlso 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.