Use #safe_render! only
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:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
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 theCHANGELOG.md
.