Skip to content

Fix patches not applied to Ruby 3 build image

Matthias Käppler requested to merge mk-fix-ruby3-patchdir into master

Since RUBY_VERSION expands to 3.0.2 currently, and since we look for patches in a directory of the same name, no patches were applied from the 3.0.0 directory. This currently fails CI builds that use Ruby 3: https://gitlab.com/gitlab-org/gitlab/-/jobs/1480481661 (on dev machines these tests disable themselves since e.g. the GDK has no VM patch support yet)

I renamed the patches/ruby/3.0.0 dir to patches/ruby/3.0.2 to fix the immediate issue.

Is there a good way we can make this more future proof? We could match merely on minor version level, however, we don't know if patches would apply cleanly across those. Though I suppose CI would catch that?

I also tested that the current patch files apply cleanly to 3.0.2, and it works in CI:

+ [[ -d /patches/ruby/3.0.2 ]]
+ for i in "/patches/ruby/$RUBY_VERSION"/*.patch
+ echo /patches/ruby/3.0.2/thread-memory-allocations-3.0.patch...
/patches/ruby/3.0.2/thread-memory-allocations-3.0.patch...
+ patch -p1 -i /patches/ruby/3.0.2/thread-memory-allocations-3.0.patch
patching file gc.c
Hunk #1 succeeded at 2129 (offset 6 lines).
Hunk #2 succeeded at 10467 (offset -27 lines).
patching file test/ruby/test_thread_trace_memory_allocations.rb
patching file thread.c
Hunk #1 succeeded at 5416 (offset 4 lines).
Hunk #2 succeeded at 5550 (offset 4 lines).
patching file vm_core.h
Hunk #3 succeeded at 994 (offset 5 lines).
Hunk #4 succeeded at 1922 (offset 5 lines).

https://gitlab.com/gitlab-org/gitlab-build-images/-/jobs/1483211059

Edited by Matthias Käppler

Merge request reports