Skip to content

Commit a8bc16b

Browse files
authored
Add edge content source (#1572)
* Add edge content source * remove named_git_references for shared_configuration * fix test * follow up marking edge env use edge content source later * wait to use *stack variable after merging this PR * update test
1 parent 48cd485 commit a8bc16b

File tree

8 files changed

+60
-29
lines changed

8 files changed

+60
-29
lines changed

config/assembler.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,23 @@ environments:
2020
edge:
2121
uri: https://d34ipnu52o64md.cloudfront.net
2222
path_prefix: docs
23+
# need to follow up in a PR after edge is available on published docker images
24+
# content_source: edge
2325
content_source: current
2426
google_tag_manager:
2527
enabled: false
2628
feature_flags:
2729
LAZY_LOAD_NAVIGATION: true
2830
dev:
2931
uri: http://localhost:4000
30-
content_source: next
32+
content_source: current
3133
path_prefix: docs
3234

33-
named_git_references:
34-
stack: &stack 9.0
35-
cloud-hosted: ms-120
35+
shared_configuration:
36+
stack: &stack
37+
current: 9.0
38+
next: 9.1
39+
edge: main
3640

3741
###
3842
# 'narrative' shares the same keys as keys in 'references' (<repository_config>)
@@ -67,9 +71,6 @@ references:
6771
apm-agent-rum-js:
6872
apm-aws-lambda:
6973
apm-k8s-attacher:
70-
beats:
71-
current: "9.0"
72-
next: main
7374
ecs-dotnet:
7475
ecs-logging-go-logrus:
7576
ecs-logging-go-zap:
@@ -80,9 +81,6 @@ references:
8081
ecs-logging-python:
8182
ecs-logging-ruby:
8283
ecs-logging:
83-
ecs:
84-
current: "9.0"
85-
next: main
8684
elastic-otel-dotnet:
8785
elastic-otel-java:
8886
elastic-otel-node:
@@ -92,11 +90,26 @@ references:
9290
integration-docs:
9391
integrations:
9492
logstash-docs-md:
95-
logstash:
96-
current: "9.0"
97-
next: main
9893
opentelemetry:
99-
94+
95+
# stack aligned gated
96+
# TODO we can use *stack after merging this PR
97+
#beats: *stack
98+
#ecs: *stack
99+
#logstash: *stack
100+
beats:
101+
current: 9.0
102+
next: 9.1
103+
edge: main
104+
ecs:
105+
current: 9.0
106+
next: 9.0
107+
edge: main
108+
logstash:
109+
current: 9.0
110+
next: 9.1
111+
edge: main
112+
100113
# @elastic/admin-docs
101114
cloud-on-k8s:
102115
cloud:

src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using System.Text.RegularExpressions;
66
using Elastic.Documentation.Extensions;
7+
using YamlDotNet.RepresentationModel;
78
using YamlDotNet.Serialization;
89
using YamlStaticContext = Elastic.Documentation.Configuration.Serialization.YamlStaticContext;
910

@@ -55,6 +56,8 @@ private static TRepository RepositoryDefaults<TRepository>(TRepository r, string
5556
repository.GitReferenceCurrent = "main";
5657
if (string.IsNullOrEmpty(repository.GitReferenceNext))
5758
repository.GitReferenceNext = "main";
59+
if (string.IsNullOrEmpty(repository.GitReferenceEdge))
60+
repository.GitReferenceEdge = "main";
5861
if (string.IsNullOrEmpty(repository.Origin))
5962
{
6063
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("GITHUB_ACTIONS")))
@@ -80,8 +83,8 @@ private static TRepository RepositoryDefaults<TRepository>(TRepository r, string
8083
[YamlMember(Alias = "environments")]
8184
public Dictionary<string, PublishEnvironment> Environments { get; set; } = [];
8285

83-
[YamlMember(Alias = "named_git_references")]
84-
public Dictionary<string, string> NamedGitReferences { get; set; } = [];
86+
[YamlMember(Alias = "shared_configuration")]
87+
public Dictionary<string, Repository> SharedConfigurations { get; set; } = [];
8588

8689
/// Returns whether the <paramref name="branchOrTag"/> is configured as an integration branch or tag for the given
8790
/// <paramref name="repository"/>.

src/Elastic.Documentation.Configuration/Assembler/ContentSource.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ public enum ContentSource
1717

1818
[JsonStringEnumMemberName("current")]
1919
[Display(Name = "current")]
20-
Current
20+
Current,
21+
22+
[JsonStringEnumMemberName("edge")]
23+
[Display(Name = "edge")]
24+
Edge
2125
}

src/Elastic.Documentation.Configuration/Assembler/Repository.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,27 @@ public record Repository
2929
[YamlMember(Alias = "repo")]
3030
public string Origin { get; set; } = string.Empty;
3131

32+
[YamlMember(Alias = "checkout_strategy")]
33+
public CheckoutStrategy CheckoutStrategy { get; set; } = CheckoutStrategy.Partial;
34+
35+
[YamlMember(Alias = "skip")]
36+
public bool Skip { get; set; }
37+
3238
[YamlMember(Alias = "current")]
3339
public string GitReferenceCurrent { get; set; } = "main";
3440

3541
[YamlMember(Alias = "next")]
3642
public string GitReferenceNext { get; set; } = "main";
3743

38-
[YamlMember(Alias = "checkout_strategy")]
39-
public CheckoutStrategy CheckoutStrategy { get; set; } = CheckoutStrategy.Partial;
40-
41-
[YamlMember(Alias = "skip")]
42-
public bool Skip { get; set; }
44+
[YamlMember(Alias = "edge")]
45+
public string GitReferenceEdge { get; set; } = "main";
4346

4447
public string GetBranch(ContentSource contentSource) => contentSource switch
4548
{
4649
ContentSource.Current => GitReferenceCurrent,
4750
ContentSource.Next => GitReferenceNext,
51+
ContentSource.Edge => GitReferenceEdge,
4852
_ => throw new ArgumentException($"The content source {contentSource} is not supported.", nameof(contentSource))
4953
};
54+
5055
}

src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
using Elastic.Documentation.Configuration.Assembler;
66
using Elastic.Documentation.Configuration.Versions;
7+
using YamlDotNet.RepresentationModel;
78
using YamlDotNet.Serialization;
89

910
namespace Elastic.Documentation.Configuration.Serialization;

src/tooling/docs-assembler/Building/AssemblerCrossLinkFetcher.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ public override async Task<FetchedCrossLinks> Fetch(Cancel ctx)
2929
if (repository.Skip)
3030
continue;
3131

32-
var branch = publishEnvironment.ContentSource == ContentSource.Current
33-
? repository.GitReferenceCurrent
34-
: repository.GitReferenceNext;
32+
var branch = repository.GetBranch(publishEnvironment.ContentSource);
3533

3634
var linkReference = await Fetch(repositoryName, [branch], ctx);
3735
linkReferences.Add(repositoryName, linkReference);

src/tooling/docs-assembler/Navigation/AssemblerDocumentationSet.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public AssemblerDocumentationSet(
3030
Checkout checkout,
3131
CrossLinkResolver crossLinkResolver,
3232
TableOfContentsTreeCollector treeCollector,
33-
VersionsConfiguration versionsConfiguration)
33+
VersionsConfiguration versionsConfiguration
34+
)
3435
{
3536
AssembleContext = context;
3637
Checkout = checkout;
@@ -47,7 +48,7 @@ public AssemblerDocumentationSet(
4748
RepositoryName = checkout.Repository.Name,
4849
Ref = checkout.HeadReference,
4950
Remote = $"elastic/${checkout.Repository.Name}",
50-
Branch = checkout.Repository.GitReferenceCurrent
51+
Branch = checkout.Repository.GetBranch(env.ContentSource)
5152
};
5253

5354
var buildContext = new BuildContext(

tests/docs-assembler.Tests/src/docs-assembler.Tests/AssemblerConfigurationTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ public void ReadsContentSource()
5555
public void ReadsVersions()
5656
{
5757
var config = Context.Configuration;
58-
config.NamedGitReferences.Should().NotBeEmpty()
58+
config.SharedConfigurations.Should().NotBeEmpty()
5959
.And.ContainKey("stack");
6060

61-
config.NamedGitReferences["stack"].Should().NotBeNullOrEmpty();
61+
config.SharedConfigurations["stack"].GitReferenceEdge.Should().NotBeNullOrEmpty();
6262

6363
//var agent = config.ReferenceRepositories["elasticsearch"];
6464
//agent.GitReferenceCurrent.Should().NotBeNullOrEmpty()
@@ -70,6 +70,12 @@ public void ReadsVersions()
7070
.And.Be("main");
7171
apmServer.GitReferenceCurrent.Should().NotBeNullOrEmpty()
7272
.And.Be("main");
73+
apmServer.GitReferenceEdge.Should().NotBeNullOrEmpty()
74+
.And.Be("main");
75+
76+
var beats = config.ReferenceRepositories["beats"];
77+
beats.GitReferenceCurrent.Should().NotBeNullOrEmpty()
78+
.And.NotBe("main");
7379

7480
}
7581
}

0 commit comments

Comments
 (0)