Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions config/assembler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,23 @@ 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
feature_flags:
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' (<repository_config>)
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -55,6 +56,8 @@ private static TRepository RepositoryDefaults<TRepository>(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")))
Expand All @@ -80,8 +83,8 @@ private static TRepository RepositoryDefaults<TRepository>(TRepository r, string
[YamlMember(Alias = "environments")]
public Dictionary<string, PublishEnvironment> Environments { get; set; } = [];

[YamlMember(Alias = "named_git_references")]
public Dictionary<string, string> NamedGitReferences { get; set; } = [];
[YamlMember(Alias = "shared_configuration")]
public Dictionary<string, Repository> SharedConfigurations { get; set; } = [];

/// Returns whether the <paramref name="branchOrTag"/> is configured as an integration branch or tag for the given
/// <paramref name="repository"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ public enum ContentSource

[JsonStringEnumMemberName("current")]
[Display(Name = "current")]
Current
Current,

[JsonStringEnumMemberName("edge")]
[Display(Name = "edge")]
Edge
}
15 changes: 10 additions & 5 deletions src/Elastic.Documentation.Configuration/Assembler/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ public override async Task<FetchedCrossLinks> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public AssemblerDocumentationSet(
Checkout checkout,
CrossLinkResolver crossLinkResolver,
TableOfContentsTreeCollector treeCollector,
VersionsConfiguration versionsConfiguration)
VersionsConfiguration versionsConfiguration
)
{
AssembleContext = context;
Checkout = checkout;
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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");

}
}
Loading