Skip to content

Add docs raketask to find the files to be deleted

What does this MR do?

Part of the Technical Writing team monthly tasks (https://about.gitlab.com/handbook/engineering/ux/technical-writing/#regularly-scheduled-tasks) is to find and delete the old redirect files (older than 3 months).

Doing this by hand was a tedious task, so this new raketask aims to automate this. It goes like this:

  1. Search the doc files that contain remove_date:.
  2. For the dates that are before today (the date the script is run):
    1. Remove those files.
    2. Print the text that needs to be copied/pasted in redirects.yaml. This YAML file then creates the needed Pages redirects when the docs site is deployed.
  3. If no files are found, the output is empty.

Testing locally

bundle exec rake gitlab:docs:clean_redirects

If there are files to be deleted, the following would be the output (as of 2021-05-21):

  - from: /ee/security/cicd_environment_variables.html
    to: /ee/security/cicd_variables.html
    remove_date: 2022-02-15
  - from: /ee/raketasks/README.html
    to: /ee/raketasks/index.html
    remove_date: 2022-02-11
  - from: /ee/legal/README.html
    to: /ee/legal/index.html
    remove_date: 2022-02-11
  - from: /ee/ci/chatops/README.html
    to: /ee/ci/chatops/index.html
    remove_date: 2022-02-01
  - from: /ee/ci/ssh_keys/README.html
    to: /ee/ci/ssh_keys/index.html
    remove_date: 2022-02-01
  - from: /ee/ci/services/README.html
    to: /ee/ci/services/index.html
    remove_date: 2022-02-01
  - from: /ee/ci/quick_start/README.html
    to: /ee/ci/quick_start/index.html
    remove_date: 2022-02-01
  - from: /ee/ci/docker/README.html
    to: /ee/ci/docker/index.html
    remove_date: 2022-02-01
  - from: /ee/gitlab-basics/fork-project.html
    to: /ee/user/project/working_with_projects.html
    remove_date: 2022-02-04
  - from: /ee/gitlab-basics/create-project.html
    to: /ee/user/project/working_with_projects.html
    remove_date: 2022-02-05
  - from: /ee/gitlab-basics/README.html
    to: /ee/gitlab-basics/index.html
    remove_date: 2022-02-11
  - from: /ee/operations/incident_management/alert_integrations.html
    to: /ee/operations/incident_management/integrations.html
    remove_date: 2022-02-03
  - from: /ee/user/project/merge_requests/work_in_progress_merge_requests.html
    to: /ee/user/project/merge_requests/drafts.html
    remove_date: 2022-02-19
  - from: /ee/update/README.html
    to: /ee/update/index.html
    remove_date: 2022-02-11
  - from: /ee/install/README.html
    to: /ee/install/index.html
    remove_date: 2022-02-11
  - from: /ee/downgrade_ee_to_ce/README.html
    to: /ee/downgrade_ee_to_ce/index.html
    remove_date: 2022-02-11
  - from: /ee/development/new_fe_guide/dependencies.html
    to: /ee/development/fe_guide/dependencies.html
    remove_date: 2022-02-14
  - from: /ee/intro/README.html
    to: /ee/intro/index.html
    remove_date: 2022-02-11
  - from: /ee/university/training/gitlab_flow.html
    to: /ee/topics/gitlab_flow.html
    remove_date: 2022-02-16
  - from: /ee/university/README.html
    to: /ee/topics/index.html
    remove_date: 2022-02-11

Related issues

Conformity

Merge request reports

Loading