Skip to content

Support EDITOR having arguments in encrypted secrets Rake tasks

Stan Hu requested to merge sh-fix-issue-431339 into master

What does this MR do and why?

Previously if you had EDITOR set to something like emacs -nw, rake gitlab:ldap:secret:edit would quietly fail without launching an editor and write a blank encrypted secrets file to disk. This commit does two things to improve this:

  1. Splits the EDITOR environment variable and passes the arguments with a splat operator to system to handle multiple arguments.
  2. Checks the return value of the system to ensure that the editor returned successfully.

Relates to #431339 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. In your gitlab dir, mkdir -p shared/encrypted_settings.
  2. Run: GITLAB_GENERATE_ENCRYPTED_SETTINGS_KEY_BASE=1 EDITOR='emacs -nw' bundle exec rake gitlab:ldap:secret:edit
  3. Verify the editor comes up.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Stan Hu

Merge request reports

Loading