UNCLASSIFIED - NO CUI

Skip to content

Draft: Proposal: adds .gitlab.toolbox.customScripts for preloading `rails runner` scripts to use on demand

General MR

Summary

Gitlab admins occasionally need to run custom Ruby scripts via gitlab-rails console or gitlab-rails runner. We could make this easier for them by allowing operators to preload scripts into a configmap that mounts into the gitlab-toolbox container.

Sample input:

gitlab:
  toolbox:
    customScripts:
      # this will be mounted into the toolbox container at `/scripts/custom/hello_world.rb`
      # execute it in the toolbox with `gitlab-rails runner /scripts/custom/hello_world.rb`
      hello_world.rb: |
        puts "hello world, I'm a custom ruby script!"

TODO:

  • hash out a solid design with the gitlab package maintainers
  • update DEVELOPMENT_MAINTENANCE.md to match

Relevant logs/screenshots

Sample invocation:

❯ kubectl -n gitlab exec -ti deploy/gitlab-toolbox -- /bin/bash -c "gitlab-rails runner /scripts/custom/hello_world.rb"
Defaulted container "toolbox" out of: toolbox, certificates (init), configure (init)
WARNING: Active Record does not support composite primary key.

security_findings has composite primary key. Composite primary key is ignored.
hello world, I'm a custom ruby script!

(Include any relevant logs/screenshots)

Linked Issue

issue

Upgrade Notices

(Include any relevant notes about upgrades here or write "N/A" if there are none)

Edited by Daniel Pritchett

Merge request reports