diff --git a/config/assembler.yml b/config/assembler.yml index 72a189631..ade025056 100644 --- a/config/assembler.yml +++ b/config/assembler.yml @@ -20,6 +20,8 @@ environments: edge: uri: https://d34ipnu52o64md.cloudfront.net path_prefix: docs + # need to follow up in a PR after edge is available on published docker images + # content_source: edge content_source: current google_tag_manager: enabled: false @@ -27,12 +29,14 @@ environments: LAZY_LOAD_NAVIGATION: true dev: uri: http://localhost:4000 - content_source: next + content_source: current path_prefix: docs -named_git_references: - stack: &stack 9.0 - cloud-hosted: ms-120 +shared_configuration: + stack: &stack + current: 9.0 + next: 9.1 + edge: main ### # 'narrative' shares the same keys as keys in 'references' () @@ -67,9 +71,6 @@ references: apm-agent-rum-js: apm-aws-lambda: apm-k8s-attacher: - beats: - current: "9.0" - next: main ecs-dotnet: ecs-logging-go-logrus: ecs-logging-go-zap: @@ -80,9 +81,6 @@ references: ecs-logging-python: ecs-logging-ruby: ecs-logging: - ecs: - current: "9.0" - next: main elastic-otel-dotnet: elastic-otel-java: elastic-otel-node: @@ -92,11 +90,26 @@ references: integration-docs: integrations: logstash-docs-md: - logstash: - current: "9.0" - next: main opentelemetry: - + + # stack aligned gated + # TODO we can use *stack after merging this PR + #beats: *stack + #ecs: *stack + #logstash: *stack + beats: + current: 9.0 + next: 9.1 + edge: main + ecs: + current: 9.0 + next: 9.0 + edge: main + logstash: + current: 9.0 + next: 9.1 + edge: main + # @elastic/admin-docs cloud-on-k8s: cloud: diff --git a/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs b/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs index ae102d87c..bddde6e2e 100644 --- a/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs +++ b/src/Elastic.Documentation.Configuration/Assembler/AssemblyConfiguration.cs @@ -4,6 +4,7 @@ using System.Text.RegularExpressions; using Elastic.Documentation.Extensions; +using YamlDotNet.RepresentationModel; using YamlDotNet.Serialization; using YamlStaticContext = Elastic.Documentation.Configuration.Serialization.YamlStaticContext; @@ -55,6 +56,8 @@ private static TRepository RepositoryDefaults(TRepository r, string repository.GitReferenceCurrent = "main"; if (string.IsNullOrEmpty(repository.GitReferenceNext)) repository.GitReferenceNext = "main"; + if (string.IsNullOrEmpty(repository.GitReferenceEdge)) + repository.GitReferenceEdge = "main"; if (string.IsNullOrEmpty(repository.Origin)) { if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("GITHUB_ACTIONS"))) @@ -80,8 +83,8 @@ private static TRepository RepositoryDefaults(TRepository r, string [YamlMember(Alias = "environments")] public Dictionary Environments { get; set; } = []; - [YamlMember(Alias = "named_git_references")] - public Dictionary NamedGitReferences { get; set; } = []; + [YamlMember(Alias = "shared_configuration")] + public Dictionary SharedConfigurations { get; set; } = []; /// Returns whether the is configured as an integration branch or tag for the given /// . diff --git a/src/Elastic.Documentation.Configuration/Assembler/ContentSource.cs b/src/Elastic.Documentation.Configuration/Assembler/ContentSource.cs index 59282eba2..692dbe389 100644 --- a/src/Elastic.Documentation.Configuration/Assembler/ContentSource.cs +++ b/src/Elastic.Documentation.Configuration/Assembler/ContentSource.cs @@ -17,5 +17,9 @@ public enum ContentSource [JsonStringEnumMemberName("current")] [Display(Name = "current")] - Current + Current, + + [JsonStringEnumMemberName("edge")] + [Display(Name = "edge")] + Edge } diff --git a/src/Elastic.Documentation.Configuration/Assembler/Repository.cs b/src/Elastic.Documentation.Configuration/Assembler/Repository.cs index 44f050af4..a4150131c 100644 --- a/src/Elastic.Documentation.Configuration/Assembler/Repository.cs +++ b/src/Elastic.Documentation.Configuration/Assembler/Repository.cs @@ -29,22 +29,27 @@ public record Repository [YamlMember(Alias = "repo")] public string Origin { get; set; } = string.Empty; + [YamlMember(Alias = "checkout_strategy")] + public CheckoutStrategy CheckoutStrategy { get; set; } = CheckoutStrategy.Partial; + + [YamlMember(Alias = "skip")] + public bool Skip { get; set; } + [YamlMember(Alias = "current")] public string GitReferenceCurrent { get; set; } = "main"; [YamlMember(Alias = "next")] public string GitReferenceNext { get; set; } = "main"; - [YamlMember(Alias = "checkout_strategy")] - public CheckoutStrategy CheckoutStrategy { get; set; } = CheckoutStrategy.Partial; - - [YamlMember(Alias = "skip")] - public bool Skip { get; set; } + [YamlMember(Alias = "edge")] + public string GitReferenceEdge { get; set; } = "main"; public string GetBranch(ContentSource contentSource) => contentSource switch { ContentSource.Current => GitReferenceCurrent, ContentSource.Next => GitReferenceNext, + ContentSource.Edge => GitReferenceEdge, _ => throw new ArgumentException($"The content source {contentSource} is not supported.", nameof(contentSource)) }; + } diff --git a/src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs b/src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs index 3bc8769c0..e0586055b 100644 --- a/src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs +++ b/src/Elastic.Documentation.Configuration/Serialization/YamlStaticContext.cs @@ -4,6 +4,7 @@ using Elastic.Documentation.Configuration.Assembler; using Elastic.Documentation.Configuration.Versions; +using YamlDotNet.RepresentationModel; using YamlDotNet.Serialization; namespace Elastic.Documentation.Configuration.Serialization; diff --git a/src/tooling/docs-assembler/Building/AssemblerCrossLinkFetcher.cs b/src/tooling/docs-assembler/Building/AssemblerCrossLinkFetcher.cs index e89d91dda..c6d9f74ca 100644 --- a/src/tooling/docs-assembler/Building/AssemblerCrossLinkFetcher.cs +++ b/src/tooling/docs-assembler/Building/AssemblerCrossLinkFetcher.cs @@ -29,9 +29,7 @@ public override async Task Fetch(Cancel ctx) if (repository.Skip) continue; - var branch = publishEnvironment.ContentSource == ContentSource.Current - ? repository.GitReferenceCurrent - : repository.GitReferenceNext; + var branch = repository.GetBranch(publishEnvironment.ContentSource); var linkReference = await Fetch(repositoryName, [branch], ctx); linkReferences.Add(repositoryName, linkReference); diff --git a/src/tooling/docs-assembler/Navigation/AssemblerDocumentationSet.cs b/src/tooling/docs-assembler/Navigation/AssemblerDocumentationSet.cs index a68073a31..2e275ccf8 100644 --- a/src/tooling/docs-assembler/Navigation/AssemblerDocumentationSet.cs +++ b/src/tooling/docs-assembler/Navigation/AssemblerDocumentationSet.cs @@ -30,7 +30,8 @@ public AssemblerDocumentationSet( Checkout checkout, CrossLinkResolver crossLinkResolver, TableOfContentsTreeCollector treeCollector, - VersionsConfiguration versionsConfiguration) + VersionsConfiguration versionsConfiguration + ) { AssembleContext = context; Checkout = checkout; @@ -47,7 +48,7 @@ public AssemblerDocumentationSet( RepositoryName = checkout.Repository.Name, Ref = checkout.HeadReference, Remote = $"elastic/${checkout.Repository.Name}", - Branch = checkout.Repository.GitReferenceCurrent + Branch = checkout.Repository.GetBranch(env.ContentSource) }; var buildContext = new BuildContext( diff --git a/tests/docs-assembler.Tests/src/docs-assembler.Tests/AssemblerConfigurationTests.cs b/tests/docs-assembler.Tests/src/docs-assembler.Tests/AssemblerConfigurationTests.cs index e343e3f79..acee38523 100644 --- a/tests/docs-assembler.Tests/src/docs-assembler.Tests/AssemblerConfigurationTests.cs +++ b/tests/docs-assembler.Tests/src/docs-assembler.Tests/AssemblerConfigurationTests.cs @@ -55,10 +55,10 @@ public void ReadsContentSource() public void ReadsVersions() { var config = Context.Configuration; - config.NamedGitReferences.Should().NotBeEmpty() + config.SharedConfigurations.Should().NotBeEmpty() .And.ContainKey("stack"); - config.NamedGitReferences["stack"].Should().NotBeNullOrEmpty(); + config.SharedConfigurations["stack"].GitReferenceEdge.Should().NotBeNullOrEmpty(); //var agent = config.ReferenceRepositories["elasticsearch"]; //agent.GitReferenceCurrent.Should().NotBeNullOrEmpty() @@ -70,6 +70,12 @@ public void ReadsVersions() .And.Be("main"); apmServer.GitReferenceCurrent.Should().NotBeNullOrEmpty() .And.Be("main"); + apmServer.GitReferenceEdge.Should().NotBeNullOrEmpty() + .And.Be("main"); + + var beats = config.ReferenceRepositories["beats"]; + beats.GitReferenceCurrent.Should().NotBeNullOrEmpty() + .And.NotBe("main"); } }