Replace SKIP_MR option with DRY_RUN mode on redirects Rake task
What does this MR do and why?
While trying to resolve: gitlab!112520 (merged), I really needed a full "dry run" mode that made no local changes to my checkouts. I just needed to see what the script analyzed and be able to run bundle exec rake docs:clean_redirects
repeatedly.
This MR:
- Replaces
SKIP_MR
mode (which just avoided pushes) withDRY_MODE
(which won't made any local changes at all). - Makes the
docs:clean_redirects
more robust by error handlingnil
inredirect_to
frontmatter. - Resolves
Lint/NonAtomicFileOperation
: https://docs.rubocop.org/rubocop/cops_lint.html#lintnonatomicfileoperation
CC @jglassman1 @ashrafkhamis @marcel.amirault
How to set up and validate locally
-
Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/doc/setup.md. -
Check out this branch. -
Run DRY_RUN=true bundle exec rake docs:clean_redirects
. If:-
gitlab!112520 (merged) is already merged, the script will complete with no error but make no local changes.
-
gitlab!112520 (merged) isn't merged, the script will abort with this error message:
INFO: (ee): In ../gitlab/doc/development/integrations/codesandbox.md, remove date: 2023-02-01 is less than today (2023-02-21). INFO: (ee): Not deleting ../gitlab/doc/development/integrations/codesandbox.md because running in dry run mode... ERROR: No redirect_to found in ../gitlab/doc/development/integrations/codesandbox.md!
-
Merge request acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this merge request.