From 63fd15f5e9107849f212a5bd2bdff20545b2c8c0 Mon Sep 17 00:00:00 2001 From: Yaya Date: Fri, 12 Jul 2024 14:16:32 +0200 Subject: [PATCH] gitlab: Un-vendor sidekiq The sidekiq dependency was vendored to maintain compatibility with Redis 6.0 (as stated in this [comment]) but unfortunately, it seems to cause a crash in the application, as noted in this [upstream issue]. We can safely swap out the dependency, as our Redis release in nixpkgs is >= 7.0. [comment]: https://gitlab.com/gitlab-org/gitlab/-/issues/468435#note_1979750600 [upstream issue]: https://gitlab.com/gitlab-org/gitlab/-/issues/468435 --- .../version-management/gitlab/rubyEnv/Gemfile | 2 +- .../gitlab/rubyEnv/Gemfile.lock | 16 ++++++---------- .../gitlab/rubyEnv/gemset.nix | 5 +++-- .../version-management/gitlab/update.py | 17 ++++++++++++++++- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/pkgs/applications/version-management/gitlab/rubyEnv/Gemfile b/pkgs/applications/version-management/gitlab/rubyEnv/Gemfile index d8f93f9280b1..8c0d4817df19 100644 --- a/pkgs/applications/version-management/gitlab/rubyEnv/Gemfile +++ b/pkgs/applications/version-management/gitlab/rubyEnv/Gemfile @@ -255,7 +255,7 @@ gem 'state_machines-activerecord', '~> 0.8.0' # rubocop:todo Gemfile/MissingFeat gem 'acts-as-taggable-on', '~> 10.0' # rubocop:todo Gemfile/MissingFeatureCategory # Background jobs -gem 'sidekiq', path: 'vendor/gems/sidekiq-7.1.6', require: 'sidekiq', feature_category: :scalability +gem 'sidekiq', '~> 7.1.6', feature_category: :scalability gem 'sidekiq-cron', '~> 1.12.0', feature_category: :scalability gem 'gitlab-sidekiq-fetcher', path: 'vendor/gems/sidekiq-reliable-fetch', diff --git a/pkgs/applications/version-management/gitlab/rubyEnv/Gemfile.lock b/pkgs/applications/version-management/gitlab/rubyEnv/Gemfile.lock index b3b360bd7e07..505810671d0a 100644 --- a/pkgs/applications/version-management/gitlab/rubyEnv/Gemfile.lock +++ b/pkgs/applications/version-management/gitlab/rubyEnv/Gemfile.lock @@ -173,15 +173,6 @@ PATH nokogiri (>= 1.4.4) omniauth (~> 2.0) -PATH - remote: vendor/gems/sidekiq-7.1.6 - specs: - sidekiq (7.1.6) - concurrent-ruby (< 2) - connection_pool (>= 2.3.0) - rack (>= 2.2.4) - redis-client (>= 0.14.0) - PATH remote: vendor/gems/sidekiq-reliable-fetch specs: @@ -1668,6 +1659,11 @@ GEM shellany (0.0.1) shoulda-matchers (5.1.0) activesupport (>= 5.2.0) + sidekiq (7.1.6) + concurrent-ruby (< 2) + connection_pool (>= 2.3.0) + rack (>= 2.2.4) + redis-client (>= 0.14.0) sidekiq-cron (1.12.0) fugit (~> 1.8) globalid (>= 1.0.1) @@ -2213,7 +2209,7 @@ DEPENDENCIES sentry-ruby (~> 5.17.3) sentry-sidekiq (~> 5.17.3) shoulda-matchers (~> 5.1.0) - sidekiq! + sidekiq (~> 7.1.6) sidekiq-cron (~> 1.12.0) sigdump (~> 0.2.4) simple_po_parser (~> 1.1.6) diff --git a/pkgs/applications/version-management/gitlab/rubyEnv/gemset.nix b/pkgs/applications/version-management/gitlab/rubyEnv/gemset.nix index a6c14183a2c0..db70f0c50830 100644 --- a/pkgs/applications/version-management/gitlab/rubyEnv/gemset.nix +++ b/pkgs/applications/version-management/gitlab/rubyEnv/gemset.nix @@ -6175,8 +6175,9 @@ src: groups = ["default"]; platforms = []; source = { - path = "${src}/vendor/gems/sidekiq-7.1.6"; - type = "path"; + remotes = ["https://rubygems.org"]; + sha256 = "18j3g31ps6ga9nzza0z0d00qjrn810fhkhx2pqi3rvxwsmkdlnbq"; + type = "gem"; }; version = "7.1.6"; }; diff --git a/pkgs/applications/version-management/gitlab/update.py b/pkgs/applications/version-management/gitlab/update.py index bb46af27c690..5c5aacda3d92 100755 --- a/pkgs/applications/version-management/gitlab/update.py +++ b/pkgs/applications/version-management/gitlab/update.py @@ -180,6 +180,21 @@ def update_rubyenv(): cwd=rubyenv_dir, ) + # Un-vendor sidekiq + # + # The sidekiq dependency was vendored to maintain compatibility with Redis 6.0 (as + # stated in this [comment]) but unfortunately, it seems to cause a crash in the + # application, as noted in this [upstream issue]. + # + # We can safely swap out the dependency, as our Redis release in nixpkgs is >= 7.0. + # + # [comment]: https://gitlab.com/gitlab-org/gitlab/-/issues/468435#note_1979750600 + # [upstream issue]: https://gitlab.com/gitlab-org/gitlab/-/issues/468435 + subprocess.check_output( + ["sed", "-i", "s|gem 'sidekiq', path: 'vendor/gems/sidekiq-7.1.6', require: 'sidekiq'|gem 'sidekiq', '~> 7.1.6'|g", "Gemfile"], + cwd=rubyenv_dir, + ) + # Fetch vendored dependencies temporarily in order to build the gemset.nix subprocess.check_output(["mkdir", "-p", "vendor/gems", "gems"], cwd=rubyenv_dir) subprocess.check_output( @@ -194,7 +209,7 @@ def update_rubyenv(): [ "sh", "-c", - f"curl -L https://gitlab.com/gitlab-org/gitlab/-/archive/v{version}-ee/gitlab-v{version}-ee.tar.bz2?path=gems | tar -xj --strip-components=3", + f"curl -L https://gitlab.com/gitlab-org/gitlab/-/archive/v{version}-ee/gitlab-v{version}-ee.tar.bz2?path=gems | tar -xj --strip-components=2", ], cwd=f"{rubyenv_dir}/gems", )