Add docs Rakefile
What does this MR do?
Adds a docs raketask that automates the creation and update of docs redirects. This is basically the same raketask that was added in GitLab, with some modifications for Omnibus.
Since the Runner repo didn't have any Ruby-related files and a Gemfile was not present, I added that as well. It has only one dependency and it shouldn't bother the development of GitLab Runner.
This is basically the same raketask that was added in GitLab, with some modifications for runner.
It automates the process defined under https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page.
Related MRs:
- gitlab!57475 (merged)
- gitlab!62131 (merged)
- omnibus-gitlab!5275 (merged)
- gitlab-org/charts/gitlab!2018 (closed)
Why was this MR needed?
The technical writing team has to perform some cleanup tasks regularly, and a way to automate some things was needed. This started in the main GitLab project and later added to all 4 projects whose docs are deployed in docs.gitlab.com.
What's the best way to test this MR?
Install all dependencies:
bundle install
For the first task:
bundle exec "rake gitlab:docs:redirect[docs/executors/custom.md,docs/executors/new_page.md]"
The content of docs/executors/custom.md
should be changed to:
---
redirect_to: 'new_page.md'
remove_date: '2021-08-26'
---
This file was moved to [another location](new_page.md).
<!-- This redirect file can be deleted after <2021-08-26>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
For the second task, you'd need some remove_date
entries, which are being added in !2922 (merged). Once you have this and run the clean_redirects
task:
bundle exec rake gitlab:docs:clean_redirects
You should see some files removed and some entries printed in STDOUT. We then use those entries to populate https://gitlab.com/gitlab-org/gitlab-docs/-/blob/master/content/_data/redirects.yaml which is used by GitLab Pages to create redirects for the docs site.