Skip to content

Commit 26daca1

Browse files
committed
Merge branch 'main' into feature/applies-to-popover
2 parents 4234b98 + 91c0ddc commit 26daca1

File tree

11 files changed

+952
-43
lines changed

11 files changed

+952
-43
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Auto-add triage label
3+
4+
on:
5+
issues:
6+
types:
7+
- opened
8+
9+
permissions:
10+
contents: read
11+
issues: write
12+
13+
jobs:
14+
add-triage-label:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Add needs triage label
18+
uses: actions/github-script@v7
19+
with:
20+
script: |
21+
github.rest.issues.addLabels({
22+
owner: context.repo.owner,
23+
repo: context.repo.repo,
24+
issue_number: context.issue.number,
25+
labels: ['needs triage']
26+
})

.github/workflows/preview-build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ jobs:
367367
env.MATCH == 'true'
368368
&& (
369369
!cancelled()
370+
&& github.repository != 'elastic/docs-builder'
370371
&& steps.docs-build.outputs.skip != 'true'
371372
&& (
372373
steps.deployment.outputs.result
@@ -377,12 +378,31 @@ jobs:
377378
)
378379
)
379380
uses: elastic/docs-builder/actions/validate-inbound-local@main
381+
382+
- name: 'Validate inbound links'
383+
if: >
384+
env.MATCH == 'true'
385+
&& (
386+
!cancelled()
387+
&& github.repository == 'elastic/docs-builder'
388+
&& steps.docs-build.outputs.skip != 'true'
389+
&& (
390+
steps.deployment.outputs.result
391+
|| (
392+
needs.check.outputs.any_modified == 'true'
393+
&& github.event_name == 'merge_group'
394+
)
395+
)
396+
)
397+
run: |
398+
dotnet run --project src/tooling/docs-builder -- inbound-links validate-link-reference
380399
381400
- name: 'Validate local path prefixes against those claimed by global navigation.yml'
382401
if: >
383402
env.MATCH == 'true'
384403
&& (
385404
!cancelled()
405+
&& github.repository != 'elastic/docs-builder'
386406
&& steps.docs-build.outputs.skip != 'true'
387407
&& (
388408
steps.deployment.outputs.result
@@ -393,6 +413,24 @@ jobs:
393413
)
394414
)
395415
uses: elastic/docs-builder/actions/validate-path-prefixes-local@main
416+
417+
- name: 'Validate local path prefixes against those claimed by global navigation.yml'
418+
if: >
419+
env.MATCH == 'true'
420+
&& (
421+
!cancelled()
422+
&& github.repository == 'elastic/docs-builder'
423+
&& steps.docs-build.outputs.skip != 'true'
424+
&& (
425+
steps.deployment.outputs.result
426+
|| (
427+
needs.check.outputs.any_modified == 'true'
428+
&& github.event_name == 'merge_group'
429+
)
430+
)
431+
)
432+
run: |
433+
dotnet run --project src/tooling/docs-assembler -- navigation validate-link-reference
396434
397435
- uses: elastic/docs-builder/.github/actions/aws-auth@main
398436
if: >

config/assembler.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ environments:
2121
cookies_win: x
2222
feature_flags:
2323
SEARCH_OR_ASK_AI: true
24-
edge:
24+
edge:
2525
uri: https://d34ipnu52o64md.cloudfront.net
2626
path_prefix: docs
2727
content_source: edge
@@ -94,12 +94,14 @@ references:
9494
ecs-logging-python:
9595
ecs-logging-ruby:
9696
ecs-logging:
97+
elastic-agent:
9798
elastic-otel-dotnet:
9899
elastic-otel-java:
99100
elastic-otel-node:
100101
elastic-otel-php:
101102
elastic-otel-python:
102103
elastic-serverless-forwarder:
104+
fleet-server:
103105
integration-docs:
104106
private: true
105107
integrations:

config/navigation.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,13 @@ toc:
8080
- toc: kibana://release-notes
8181
path_prefix: release-notes/kibana
8282

83-
# Fleet and Elastic Agent
84-
# https://github.com/elastic/docs-content/blob/main/release-notes/fleet-elastic-agent/toc.yml
85-
- toc: docs-content://release-notes/fleet-elastic-agent
86-
path_prefix: release-notes/fleet
83+
# Elastic Agent
84+
- toc: elastic-agent://release-notes
85+
path_prefix: release-notes/elastic-agent
86+
87+
# Fleet Server
88+
- toc: fleet-server://release-notes
89+
path_prefix: release-notes/fleet-server
8790

8891
# Logstash
8992
# https://github.com/elastic/logstash/blob/main/docs/release-notes/toc.yml
@@ -107,7 +110,7 @@ toc:
107110
# https://github.com/elastic/cloud/blob/master/docs/docset.yml
108111
- toc: cloud://release-notes/cloud-hosted
109112
path_prefix: release-notes/cloud-hosted
110-
113+
111114
# Cloud Enterprise
112115
# https://github.com/elastic/cloud/blob/master/docs/release-notes/cloud-enterprise/toc.yml
113116
- toc: cloud://release-notes/cloud-enterprise
@@ -131,7 +134,7 @@ toc:
131134
# EDOT iOS / Swift
132135
# https://github.com/elastic/apm-agent-ios/blob/main/docs/release-notes/toc.yml
133136
- toc: apm-agent-ios://release-notes
134-
path_prefix: release-notes/edot/sdks/ios
137+
path_prefix: release-notes/edot/sdks/ios
135138
# EDOT Java
136139
# https://github.com/elastic/elastic-otel-java/blob/main/docs/release-notes/toc.yml
137140
- toc: elastic-otel-java://release-notes
@@ -308,7 +311,7 @@ toc:
308311
# https://github.com/elastic/elasticsearch/blob/main/docs/reference/elasticsearch-plugins/toc.yml
309312
- toc: elasticsearch://reference/elasticsearch-plugins
310313
path_prefix: reference/elasticsearch/plugins
311-
314+
312315
# Security
313316
# https://github.com/elastic/docs-content/blob/main/reference/security/toc.yml
314317
- toc: docs-content://reference/security

docs/_redirects.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,3 @@ redirects:
2222
'testing/redirects/third-page.md':
2323
anchors:
2424
'removed-anchor':
25-
# Related to https://github.com/elastic/docs-builder/pull/1614
26-
'docs/contribute/cumulative-docs.md': 'contribute/cumulative-docs/index.md'
27-
'docs/versions/content-patterns.md': 'contribute/cumulative-docs/example-scenarios.md'
28-
'docs/versions/index.md': 'contribute/cumulative-docs/index.md'
29-
# I shouldn't need to do this should I?
30-
# I'm just going to do it to get the preview to build...
31-
'docs/versions/_snippets/content-patterns-list.md': 'contribute/cumulative-docs/index.md'
32-
'docs/contribute/cumulative-docs/images/example-not-one-section.png': 'contribute/cumulative-docs/example-scenarios.md'
33-
'docs/contribute/cumulative-docs/images/example-one-section.png': 'contribute/cumulative-docs/example-scenarios.md'

src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/SearchOrAskAiModal.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
EuiText,
1010
EuiHorizontalRule,
1111
useEuiOverflowScroll,
12+
EuiLink,
1213
} from '@elastic/eui'
1314
import { css } from '@emotion/react'
1415
import * as React from 'react'
@@ -83,13 +84,20 @@ export const SearchOrAskAiModal = () => {
8384
block-size: 2em;
8485
display: flex;
8586
`}
86-
label="Beta"
87+
label="Alpha"
8788
color="accent"
88-
tooltipContent="This feature is in beta. Got feedback? We'd love to hear it!"
89+
tooltipContent="This feature is in private preview and is only enabled if you are in Elastic's Global VPN."
8990
/>
9091

9192
<EuiText color="subdued" size="xs">
92-
This feature is in beta. Got feedback? We'd love to hear it!
93+
This feature is in private preview (alpha).{' '}
94+
<EuiLink
95+
target="_blank"
96+
rel="noopener noreferrer"
97+
href="https://github.com/elastic/docs-eng-team/issues/new?template=search-or-ask-ai-feedback.yml"
98+
>
99+
Got feedback? We'd love to hear it!
100+
</EuiLink>
93101
</EuiText>
94102
</div>
95103
</div>

src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
44

5-
using System.Collections.Immutable;
65
using System.Diagnostics.CodeAnalysis;
76
using System.IO.Abstractions;
87
using System.Runtime.InteropServices;
@@ -248,9 +247,23 @@ private static void ValidateInternalUrl(InlineProcessor processor, string url, s
248247
if (string.IsNullOrWhiteSpace(url))
249248
return;
250249

250+
251251
var pathOnDisk = Path.GetFullPath(Path.Combine(includeFrom, url.TrimStart('/')));
252252
if (!context.Build.ReadFileSystem.File.Exists(pathOnDisk))
253-
processor.EmitError(link, $"`{url}` does not exist. resolved to `{pathOnDisk}");
253+
{
254+
if (context.Configuration.Redirects is not null && context.Configuration.Redirects.TryGetValue(url.TrimStart('/'), out var redirect))
255+
{
256+
var name = redirect.To ??
257+
(redirect.Many is not null
258+
? $"one of: {string.Join(", ", redirect.Many.Select(m => m.To))}"
259+
: "unknown"
260+
);
261+
processor.EmitWarning(link, $"Local file `{url}` has a redirect, please update this reference to: {name}");
262+
}
263+
else
264+
processor.EmitError(link, $"`{url}` does not exist. If it was recently removed add a redirect. resolved to `{pathOnDisk}");
265+
266+
}
254267
}
255268

256269
private static void ProcessLinkText(InlineProcessor processor, LinkInline link, MarkdownFile? markdown, string? anchor, string url, IFileInfo file)

src/tooling/docs-builder/Cli/DiffCommands.cs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,31 +77,33 @@ public async Task<int> ValidateRedirects(string? path = null, Cancel ctx = defau
7777
if (changed.Length != 0)
7878
_log.LogInformation("Found {Count} changes to files related to documentation in the current branch.", changed.Length);
7979

80-
var missingRedirects = changed
81-
.Where(c =>
82-
c.ChangeType is GitChangeType.Deleted or GitChangeType.Renamed
83-
&& !redirects.ContainsKey(c is RenamedGitChange renamed ? renamed.OldFilePath : c.FilePath)
84-
)
85-
.ToArray();
86-
87-
if (missingRedirects.Length != 0)
88-
{
89-
var relativeRedirectFile = Path.GetRelativePath(root.FullName, redirectFile.Source.FullName);
90-
_log.LogInformation("Found {Count} changes that still require updates to: {RedirectFile}", missingRedirects.Length, relativeRedirectFile);
91-
}
92-
93-
foreach (var notFound in missingRedirects)
80+
var deletedAndRenamed = changed.Where(c => c.ChangeType is GitChangeType.Deleted or GitChangeType.Renamed).ToArray();
81+
var missingCount = 0;
82+
foreach (var change in deletedAndRenamed)
9483
{
95-
if (notFound is RenamedGitChange renamed)
84+
var lookupPath = change is RenamedGitChange renamed ? renamed.OldFilePath : change.FilePath;
85+
var docSetRelativePath = Path.GetRelativePath(buildContext.DocumentationSourceDirectory.FullName, Path.Combine(root.FullName, lookupPath));
86+
var rootRelativePath = Path.GetRelativePath(root.FullName, Path.Combine(root.FullName, lookupPath));
87+
if (redirects.ContainsKey(docSetRelativePath))
88+
continue;
89+
if (redirects.ContainsKey(rootRelativePath))
9690
{
9791
collector.EmitError(redirectFile.Source,
98-
$"File '{renamed.OldFilePath}' was renamed to '{renamed.NewFilePath}' but it has no redirect configuration set.");
99-
}
100-
else if (notFound.ChangeType is GitChangeType.Deleted)
101-
{
102-
collector.EmitError(redirectFile.Source,
103-
$"File '{notFound.FilePath}' was deleted but it has no redirect targets. This will lead to broken links.");
92+
$"Redirect contains path relative to root '{rootRelativePath}' but should be relative to the documentation set '{docSetRelativePath}'");
93+
continue;
10494
}
95+
missingCount++;
96+
97+
if (change is RenamedGitChange rename)
98+
collector.EmitError(redirectFile.Source, $"Missing '{docSetRelativePath}' in redirects.yml. '{rename.OldFilePath}' was renamed to '{rename.NewFilePath}' but it has no redirect configuration set.");
99+
else if (change.ChangeType is GitChangeType.Deleted)
100+
collector.EmitError(redirectFile.Source, $"Missing '{docSetRelativePath}' in redirects.yml. '{change.FilePath}' was deleted but it has no redirect targets. This will lead to broken links.");
101+
}
102+
103+
if (missingCount != 0)
104+
{
105+
var relativeRedirectFile = Path.GetRelativePath(root.FullName, redirectFile.Source.FullName);
106+
_log.LogInformation("Found {Count} changes that still require updates to: {RedirectFile}", missingCount, relativeRedirectFile);
105107
}
106108

107109
await collector.StopAsync(ctx);

0 commit comments

Comments
 (0)