diff --git a/build_docs.pl b/build_docs.pl index 8dc787723f67e..1c0a5f25f97db 100755 --- a/build_docs.pl +++ b/build_docs.pl @@ -356,11 +356,12 @@ sub check_kibana_links { # ${KIBANA_DOCS}canvas.html # ${PLUGIN_DOCS}repository-s3.html # ${FLEET_DOCS}fleet-overview.html +# ${APM_DOCS}overview.html my $extractor = sub { my $contents = shift; return sub { - while ( $contents =~ m!`(\$\{(?:baseUrl|ELASTIC.+|KIBANA_DOCS|PLUGIN_DOCS|FLEET_DOCS)\}[^`]+)`!g ) { + while ( $contents =~ m!`(\$\{(?:baseUrl|ELASTIC.+|KIBANA_DOCS|PLUGIN_DOCS|FLEET_DOCS|APM_DOCS)\}[^`]+)`!g ) { my $path = $1; $path =~ s/\$\{(?:DOC_LINK_VERSION|urlVersion)\}/$branch/; # In older versions, the variable `${ELASTIC_DOCS}` referred to @@ -371,6 +372,7 @@ sub check_kibana_links { $path =~ s!\$\{KIBANA_DOCS\}!en/kibana/$branch/!; $path =~ s!\$\{PLUGIN_DOCS\}!en/elasticsearch/plugins/$branch/!; $path =~ s!\$\{FLEET_DOCS\}!en/fleet/$branch/!; + $path =~ s!\$\{APM_DOCS\}!en/apm/!; # Replace the "https://www.elastic.co/guide/" URL prefix so that # it becomes a file path in the built docs. $path =~ s!\$\{(?:baseUrl|ELASTIC_WEBSITE_URL)\}guide/!!; diff --git a/integtest/spec/all_books_broken_link_detection_spec.rb b/integtest/spec/all_books_broken_link_detection_spec.rb index 37a367b322cf0..552c1430061fe 100644 --- a/integtest/spec/all_books_broken_link_detection_spec.rb +++ b/integtest/spec/all_books_broken_link_detection_spec.rb @@ -156,6 +156,12 @@ include_examples 'there are broken links in kibana', 'en/fleet/master/not-a-fleet-page.html' end + describe 'when there is a broken APM link' do + include_context 'there is a kibana link', true, + '${APM_DOCS}not-an-apm-page.html', true + include_examples 'there are broken links in kibana', + 'en/apm/not-an-apm-page.html' + end describe 'when using --keep_hash and --sub_dir together like a PR test' do describe 'when there is a broken link in one of the books being built' do convert_before do |src, dest|