gdk reconfigure was removing protected files
Overview
As part of the refactor introduced in !2519 (merged) we started calling rake reconfigure
as part of gdk reconfigure
. This introduced an old code that was never being called before (rake clobber
).
While when this was introduced the goal was to remove configurations files to force a regeneration, later on a better way of doing that was introduced as well as a way to prevent configuration files from being updated.
That old code was not taking it in consideration and therefore, forcefully removing files listed in the CONFIGS
section of the config.rake
file.
If for any reason a file listed there was also a protected file, it would remove it and never re-generate it, because it was protected
--------------------------------------------------------------------------------
Installing gitlab-org/gitaly Ruby gems
--------------------------------------------------------------------------------
WARNING: Changes to 'Procfile' not applied because it's protected in gdk.yml.
fatal: need Procfile to continue, make it with `make Procfile`?
make[1]: *** [postgresql-seed-praefect] Error 1
make: *** [gitaly-update-timed] Error 2
❌️ ERROR: Failed to reconfigure.
-------------------------------------------------------
You can try the following that may be of assistance:
- Run 'gdk doctor'.
- Visit the troubleshooting documentation:
https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/troubleshooting/index.md.
- Visit https://gitlab.com/gitlab-org/gitlab-development-kit/-/issues to
see if there are known issues.
- Run 'gdk reset-data' if appropriate.
- Run 'gdk pristine' which will restore your GDK to a pristine state.
-------------------------------------------------------
$ rake --trace gitlab/config/gitlab.yml
** Invoke gitlab/config/gitlab.yml (first_time)
** Invoke support/templates/gitlab/config/gitlab.yml.erb (first_time, not_needed)
** Invoke /Users/jason/code/gdk/gdk.yml (first_time, not_needed)
** Execute gitlab/config/gitlab.yml
⚠️ WARNING: Changes to 'gitlab/config/gitlab.yml' not applied because it's protected in gdk.yml.
Steps to replicate (optional)
- Add Procfile as a protected file
- run
rake reconfigure
Proposal (optional)
I think we should not call clobber
as part of reconfigure, as we were not calling it before.
Regeneration is already taking into account by using file
targets with a condition on timestamp for the template itself and gdk.yml
.
That means that if either is newer then target file, it will trigger a regeneration for that target.
By relying only on that, we can have "protected files" work as expected.
Additionally we should ignore "protected files" flag if the file does not exist, so we always re-generate them in case they are missing
Environment (optional)
- Operating system name:
21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000 arm64
- Architecture:
arm64
- The contents of your
gdk.yml
(if any) - Ruby version:
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [arm64-darwin21]
- GDK version:
GitLab Development Kit 0.2.14 (a802596f)