Skip to content

Use #safe_render! only

Ash McKenzie requested to merge ashmckenzie/use-safe-render-only into main

What does this merge request do and why?

This MR updates the logic that updates config files to only use #safe_render! because it produces a nice message warning when a file is about to be updated (and how to get a copy back if need be).

How to set up and validate locally

Using the main branch

Run the following and you'll see no output:

$ echo "# REMOVE ME" >> gitaly/praefect.config.toml ; touch support/templates/gitaly/praefect.config.toml.erb ; bundle exec rake gitaly/praefect.config.toml

Using this branch, ashmckenzie/use-safe-render-only

Run the following and you should see the following warning output:

$ echo "# REMOVE ME" >> gitaly/praefect.config.toml ; touch support/templates/gitaly/praefect.config.toml.erb ; bundle exec rake gitaly/praefect.config.toml
ℹ️  'gitaly/praefect.config.toml' has incoming changes:
-------------------------------------------------------------------------------------------------------------
@@ -38,4 +38,3 @@ host = "/Users/ash/src/gitlab/gdks/gdk1/postgresql"
 port = 5432
 dbname = "praefect_development"
 sslmode = "disable"
-# REMOVE ME

-------------------------------------------------------------------------------------------------------------
⚠️  WARNING: 'gitaly/praefect.config.toml' has been overwritten. To recover the previous version, run:

Impacted categories

The following categories relate to this merge request:

Merge request checklist

  • This change is backward compatible. If not, please include steps to communicate to our users.
  • Tests added for new functionality. If not, please raise an issue to follow-up.
  • Documentation added/updated, if needed.
  • Announcement added, if change is notable.
  • gdk doctor test added, if needed.
  • Add the ~highlight label if this MR should be included in the CHANGELOG.md.

Merge request reports

Loading