Copy Sidekiq Web assets into Webpack output

What does this MR do and why?

The Sidekiq Web interface ships with CSS, images, and JavaScript files. These files were previously only available on a container that installed the Sidekiq gem, but the Workhorse container does not have any gems installed. Copy these files into the public/assets/sidekiq directory and point Sidekiq to use them.

This requires some changes to the Sidekiq gem to allow for assets to be stored in a location outside of the gem.

We can then revert !213239 (merged) and confirm that Workhorse is sending the assets file directly.

References

Relates to https://gitlab.com/gitlab-com/gl-infra/production/-/issues/20862

How to set up and validate locally

Omnibus

  1. Install a package from the e2e:test-on-omnibus-ee pipeline: https://gitlab.com/gitlab-org/build/omnibus-gitlab-mirror/-/pipelines/2168675042
  2. Go to /admin/background_jobs and ensure the assets are loaded.
  3. Disable the middleware in !213239 (merged) by applying this change in /opt/gitlab/embedded/service/gitlab-rails:
diff --git a/config/initializers/static_files.rb b/config/initializers/static_files.rb
index a26d78f102bb..be7d74d62daf 100644
--- a/config/initializers/static_files.rb
+++ b/config/initializers/static_files.rb
@@ -2,10 +2,6 @@
 
 app = Rails.application
 
-# Disable Sendfile for Sidekiq Web assets since Workhorse won't
-# always have access to these files.
-app.config.middleware.insert_before(Rack::Sendfile, Gitlab::Middleware::SidekiqWebStatic)
-
 if app.config.public_file_server.enabled
   # The `ActionDispatch::Static` middleware intercepts requests for static files
   # by checking if they exist in the `/public` directory.

4. `gitlab-ctl restart puma`
5. Repeat step 2. In the Workhorse logs (`/var/log/gitlab/gitlab-workhorse/current`), you should see `Send file` entries such as:

```json
{"correlation_id":"01KAF42PY29Y7K2REMGSV2VBVJ","file":"/opt/gitlab/embedded/service/gitlab-rails/public/assets/sidekiq/7.1.9/stylesheets/application.css","level":"info","method":"GET","msg":"Send file","time":"2025-11-19T22:34:34Z","uri":"/admin/sidekiq/stylesheets/application.css"}

CNG

I used the following extra values.yml:

gitlab:
  webservice:
    deployments:
    workhorse:
      extraArgs: "-apiCiLongPollingDuration 50s"
      healthcheckListener:
        enabled: true
      image: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-workhorse-ee
      tag: 5d0c2a852a2060adf6106ee7242afe242cf6bad2
    image:
      pullPolicy: Always
      repository: registry.gitlab.com/gitlab-org/build/cng-mirror/gitlab-webservice-ee
      tag: 552bc6ba9ab588c4dd8ffe1538670e88dc106ac3

Navigate to /admin/background_jobs and ensure assets show up. You may have to refresh all webservice pods for the new assets to load.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports

Loading