Skip to content

Kibana link checking is broken #1805

Closed
Closed
@bmorelli25

Description

@bmorelli25

The Kibana link checker doesn't seem to be catching broken links.

docs/build_docs.pl

Lines 334 to 399 in 0cee4e4

sub check_kibana_links {
#===================================
my $build_dir = shift;
my $link_checker = shift;
my $branch;
say "Checking Kibana links";
# ${baseUrl}guide/en/elasticsearch/reference/${urlVersion}/modules-scripting-expression.html
# ${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}
# ${ELASTIC_DOCS}search-aggregations-bucket-datehistogram-aggregation.html
my $extractor = sub {
my $contents = shift;
return sub {
while ( $contents =~ m!`(\$\{(?:baseUrl|ELASTIC_.+)\}[^`]+)`!g ) {
my $path = $1;
$path =~ s/\$\{(?:DOC_LINK_VERSION|urlVersion)\}/$branch/;
$path
=~ s!\$\{ELASTIC_DOCS\}!en/elasticsearch/reference/$branch/!
|| $path =~ s!\$\{(?:baseUrl|ELASTIC_WEBSITE_URL)\}guide/!!;
return ( split /#/, $path );
}
return;
};
};
my $src_path = 'src/ui/public/documentation_links/documentation_links';
my $legacy_path = 'src/legacy/ui/public/documentation_links/documentation_links';
my $repo = ES::Repo->get_repo('kibana');
my @branches = sort map { $_->basename }
grep { $_->is_dir } $build_dir->subdir('en/kibana')->children;
my $link_check_name = 'link-check-kibana';
for (@branches) {
$branch = $_;
next if $branch eq 'current' || $branch =~ /^\d/ && $branch lt 5;
say " Branch $branch";
my $links_file;
my $source = eval {
$links_file = $src_path . ".js";
$repo->show_file( $link_check_name, $branch, $links_file );
} || eval {
$links_file = $src_path . ".ts";
$repo->show_file( $link_check_name, $branch, $links_file );
} || eval {
$links_file = $legacy_path . ".js";
$repo->show_file( $link_check_name, $branch, $links_file );
} || eval {
$links_file = $legacy_path . ".ts";
$repo->show_file( $link_check_name, $branch, $links_file );
};
die "failed to find kibana links file;\n$@" unless $source;
$link_checker->check_source( $source, $extractor,
"Kibana [$branch]: $links_file" );
# Mark the file that we need for the link check done so we can use
# --keep_hash with it during some other build.
$repo->mark_done( $link_check_name, $branch, $links_file, 0 );
}
}

Here's an example of a broken link: elastic/kibana#63295.

Metadata

Metadata

Assignees

Labels

bugSomething that does not look or behave correctlylink-checkingLink Checking & Redirects

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions