Replace Ruby make_necessary_dirs script with Go

What does this MR do and why?

Contributes to #877 (closed)

Why: make setup still needs Ruby only to run the make_necessary_dirs helper. It is the last Ruby code required to install gitlab-shell.

What: Replaces the Ruby helper with a small Go program run by the same make make_necessary_dirs target. It reads auth_file from config.yml, creates its directory, and sets it to 0700.

Notes:

  • The target name is kept because GitLab's gitlab:shell:install rake task calls it.
  • The helper parses config.yml directly instead of using internal/config, because .gitlab_shell_secret doesn't exist yet at that point.
  • It lives under support/, so no new binary is shipped.
  • Behavior differences from Ruby:
    • An empty GITLAB_SHELL_DIR is treated as unset.
    • An empty-string auth_file falls back to $HOME/.ssh; null or missing auth_file already did so in Ruby.
    • Configuration-loading errors are reported as messages, not Ruby stack traces.

How to set up and validate locally

T=$(mktemp -d)
printf 'auth_file: "%s/home/.ssh/authorized_keys"\n' "$T" > "$T/config.yml"
GITLAB_SHELL_DIR="$T" make make_necessary_dirs
stat -f '%Lp' "$T/home/.ssh"  # Linux: stat -c '%a'

Expect two OK lines and mode 700.

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 Vasilii Iakliushin

Merge request reports

Loading
Loading