Add test to check for deleted documentation files without redirects
Problem to solve
If we accidentally remove/rename a doc page instead of redirecting it (keeping the old file), then there might be failures in the gitlab-docs projects in case the the renamed/deleted doc was present in the navbar.
Proposal
Add a test that prevents the case above.
Option one: run a review app
Force the pipeline to run a review app, which should fail the pipeline if it would break the global nav.
We once had this implemented, but ended up removing it gitlab-docs!3366 (merged).
Option two: shell script to check navigation.yml
Take a look at changes in an MR for a given docs project, and check they are still ok based on the current navigation.yml.
- If file deleted, check if in https://gitlab.com/gitlab-org/gitlab-docs/-/blob/main/content/_data/navigation.yaml
- If in that file, fail. Else, succeed.
Option three: have Danger throw a warning if a doc file is deleted
We can add more checks in https://gitlab.com/gitlab-org/gitlab/-/blob/master/danger/documentation/Dangerfile, by using some of the defined methods in https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles. Specifically:
- https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/-/blob/master/lib/danger/plugins/internal/helper.rb
- https://gitlab.com/gitlab-org/ruby/gems/gitlab-dangerfiles/-/blob/master/lib/gitlab/dangerfiles/changes.rb
Caveat: there are legitimate cases where we delete a file, for example when we clean up the redirects.