From f8b8f5745f1540e01c0b8d6636efdcece09b4a30 Mon Sep 17 00:00:00 2001 From: Sarah German <sgerman@gitlab.com> Date: Mon, 3 Mar 2025 14:20:34 -0600 Subject: [PATCH] Add handling for docs navigation file move --- scripts/lint-docs-redirects.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/lint-docs-redirects.rb b/scripts/lint-docs-redirects.rb index f5e303772e8e6..28bfc15098e2f 100755 --- a/scripts/lint-docs-redirects.rb +++ b/scripts/lint-docs-redirects.rb @@ -55,10 +55,22 @@ def docs_path def navigation_file @navigation_file ||= begin - url = URI('https://gitlab.com/gitlab-org/technical-writing/docs-gitlab-com/-/raw/main/data/navigation.yaml') + # Temporary handling for multiple navigation locations. + # The navigation YAML file will move when this merges: + # https://gitlab.com/gitlab-org/technical-writing/docs-gitlab-com/-/merge_requests/307. + # + # We are not able to control these changes merging at exactly the same time, + # so this temporarily supports both the new and old file location. + url = URI('https://gitlab.com/gitlab-org/technical-writing/docs-gitlab-com/-/raw/main/data/en-us/navigation.yaml') response = Net::HTTP.get_response(url) - raise "Could not download navigation.yaml. Response code: #{response.code}" if response.code != '200' + # If new URL fails, try the old URL + if response.code != '200' + url = URI('https://gitlab.com/gitlab-org/technical-writing/docs-gitlab-com/-/raw/main/data/navigation.yaml') + response = Net::HTTP.get_response(url) + + raise "Could not download navigation.yaml. Response code: #{response.code}" if response.code != '200' + end # response.body should be memoized in a method, so that it doesn't # need to be downloaded multiple times in one CI job. -- GitLab