diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index f68e85400..bd7409cdb 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -3,8 +3,7 @@ **ALWAYS reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.** Elastic's distributed documentation tooling system built on .NET 9, consisting of: -- **docs-builder**: CLI tool for building single documentation sets -- **docs-assembler**: CLI tool for assembling multiple doc sets +- **docs-builder**: CLI tool for building single documentation sets or assembling or assembling multiple documentation sets - Written in C# and F# with extensive Markdown processing capabilities ## Working Effectively @@ -77,10 +76,10 @@ dotnet run --project src/tooling/docs-builder -- serve dotnet run --project src/tooling/docs-builder -- --help # Get help for docs-assembler -dotnet run --project src/tooling/docs-assembler -- --help +dotnet run --project src/tooling/docs-builder -- assemble --help # Validate assembler configuration - takes 15 seconds -dotnet run --project src/tooling/docs-assembler -c release -- navigation validate +dotnet run --project src/tooling/docs-builder -c release -- assembler navigation validate ``` ### Local Development Orchestration @@ -126,7 +125,6 @@ src/ ├── Elastic.Markdown/ # Core Markdown processing engine ├── tooling/ │ ├── docs-builder/ # Main CLI application - │ └── docs-assembler/ # Assembly tool ├── Elastic.Documentation.Site/ # Web rendering components (TypeScript/CSS) └── Elastic.Documentation.Configuration/ # Configuration handling @@ -142,7 +140,7 @@ config/ # YAML configuration files ### Adding New Features - **Markdown Extensions**: Add to `src/Elastic.Markdown/Myst/` -- **CLI Commands**: Extend `src/tooling/docs-builder/Cli/` or `docs-assembler/Cli/` +- **CLI Commands**: Extend `src/tooling/docs-builder/Commands/` - **Web Components**: Add to `src/Elastic.Documentation.Site/` - **Configuration**: Modify `src/Elastic.Documentation.Configuration/` diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a887bc0c..72bbd2ef5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,10 +27,10 @@ jobs: uses: ./.github/actions/bootstrap - name: Validate Navigation - run: dotnet run --project src/tooling/docs-assembler -c release -- navigation validate + run: dotnet run --project src/tooling/docs-builder -c release -- assembler navigation validate - name: Validate Content Sources - run: dotnet run --project src/tooling/docs-assembler -c release -- content-source validate + run: dotnet run --project src/tooling/docs-builder -c release -- assembler content-source validate build-link-index-updater-lambda: uses: ./.github/workflows/build-link-index-updater-lambda.yml diff --git a/.github/workflows/preview-build.yml b/.github/workflows/preview-build.yml index d5e5ba446..40a72ccb5 100644 --- a/.github/workflows/preview-build.yml +++ b/.github/workflows/preview-build.yml @@ -456,7 +456,7 @@ jobs: ) ) run: | - dotnet run --project src/tooling/docs-assembler -- navigation validate-link-reference + dotnet run --project src/tooling/docs-builder -- assembler navigation validate-link-reference - uses: elastic/docs-builder/.github/actions/aws-auth@main if: > diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index acb4b74ca..78e9ba7e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -167,14 +167,12 @@ jobs: with: subject-path: | .artifacts/publish/docs-builder/release/*.zip - .artifacts/publish/docs-assembler/release/*.zip - name: Attach Distribution to release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release upload ${{ needs.release-drafter.outputs.tag_name }} .artifacts/publish/docs-builder/release/*.zip - gh release upload ${{ needs.release-drafter.outputs.tag_name }} .artifacts/publish/docs-assembler/release/*.zip shell: bash publish-release: diff --git a/AGENTS.md b/AGENTS.md index ace157f4e..607d02db6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,8 +6,7 @@ This file contains instructions and guidance for AIs when working with the docs- This is Elastic's distributed documentation tooling system built on .NET 9, consisting of: -- **docs-builder**: CLI tool for building single documentation sets -- **docs-assembler**: CLI tool for assembling multiple doc sets +- **docs-builder**: CLI tool for building documentation sets (either individual or assembled) - Written in C# and F# with extensive Markdown processing capabilities ## Essential commands @@ -50,7 +49,6 @@ dotnet test --logger "console;verbosity=detailed" - `src/Elastic.Markdown/` - Core Markdown processing engine - `src/tooling/docs-builder/` - Main CLI application -- `src/tooling/docs-assembler/` - Assembly tool - `src/Elastic.Documentation.Site/` - Web rendering components ### Testing Structure @@ -70,7 +68,7 @@ dotnet test --logger "console;verbosity=detailed" ### Adding New Features 1. **Markdown Extensions**: Add to `src/Elastic.Markdown/Myst/` -2. **CLI Commands**: Extend `src/tooling/docs-builder/Cli/` or `docs-assembler/Cli/` +2. **CLI Commands**: Extend `src/tooling/docs-builder/Commands/` 3. **Web Components**: Add to `src/Elastic.Documentation.Site/` 4. **Configuration**: Modify `src/Elastic.Documentation.Configuration/` @@ -99,7 +97,7 @@ You MUST update the documentation when there are changes in the markdown syntax ## Useful file locations -- Entry points: `src/tooling/docs-builder/Program.cs`, `src/tooling/docs-assembler/Program.cs` +- Entry points: `src/tooling/docs-builder/Program.cs` - Markdown processing: `src/Elastic.Markdown/Myst/` - Web assets: `src/Elastic.Documentation.Site/Assets/` - Configuration schemas: `src/Elastic.Documentation.Configuration/` diff --git a/README.md b/README.md index da9397bdf..e883e2dac 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,9 @@ Distributed documentation tooling for a distributed company. -This repository is host to: - * *`docs-builder`* command line tool to generate single doc-sets -* *`docs-assembler`* command line tool to assemble all the doc sets. -Both get distributed [as native OSX, Linux and Windows binaries for several CPU architectures.](#installation) +Distributed [as native OSX, Linux and Windows binaries for several CPU architectures.](#installation) The documentation files: * are written in common Markdown with [Additional syntax extensions](https://docs-v3-preview.elastic.dev/elastic/docs-builder/tree/main/syntax/) to produce a richer writing and reading experience. @@ -23,7 +20,7 @@ This tool builds each repository in isolation and in addition produces a full ma Each time a repository successfully builds on its respective main integration branch, our automation will publish its links.json file. For example, [Elasticsearch's links.json](https://elastic-docs-link-index.s3.us-east-2.amazonaws.com/elastic/elasticsearch/main/links.json) representing all linkable resources in the Elasticsearch repository. -The `docs-assembler` tool then assembles all the repositories in the [link-registry](https://elastic-docs-link-index.s3.us-east-2.amazonaws.com/link-index.json) using their last known good commit. +The `docs-builder assemble` command then assembles all the repositories in the [link-registry](https://elastic-docs-link-index.s3.us-east-2.amazonaws.com/link-index.json) using their last known good commit. This allows us to: @@ -58,8 +55,7 @@ Install [.NET 9.0](https://dotnet.microsoft.com/en-us/download/dotnet/9.0), then After which the locally built binaries will be available at: * **docs-builder**: `./.artifacts/publish/docs-builder/release/docs-builder` -* **docs-assembler**: `./.artifacts/publish/docs-assembler/release/docs-assembler` - + ## Getting Started Our [Documentation](https://docs-v3-preview.elastic.dev/elastic/docs-builder/tree/main/contribute/locally) is the best place to learn how to start using the tool locally. diff --git a/actions/assembler/action.yml b/actions/assembler/action.yml deleted file mode 100644 index ae213591d..000000000 --- a/actions/assembler/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: 'Documentation Assembler' -description: 'Run the documenation assembler commands' - -branding: - icon: 'filter' - color: 'red' - -inputs: - command: - description: 'The assembler command to run' - required: true - -runs: - using: 'docker' - image: "docker://ghcr.io/elastic/docs-assembler:edge" diff --git a/aspire/README.md b/aspire/README.md index b6fb4b92a..1d1ac620f 100644 --- a/aspire/README.md +++ b/aspire/README.md @@ -27,8 +27,8 @@ dotnet run --project aspire This will automatically: -* clone all repositories according to `config/assembler.yml` using `docs-assembler repo clone-all` -* do a full site build of all repositories using `docs-assembler repo build-all` +* clone all repositories according to `config/assembler.yml` using `docs-builder assembler clone` +* do a full site build of all repositories using `docs-builder assembler build` * Serve a copy of the fully assembled documentation using `docs-builder serve-static`. This should start a management UI over at: https://localhost:17166. This UI exposes all logs, traces, and metrics for each service diff --git a/aspire/aspire.csproj b/aspire/aspire.csproj index 07d40fb5e..40600a7ff 100644 --- a/aspire/aspire.csproj +++ b/aspire/aspire.csproj @@ -21,7 +21,6 @@ - diff --git a/build/Targets.fs b/build/Targets.fs index b5a1a69cb..5e447a61d 100644 --- a/build/Targets.fs +++ b/build/Targets.fs @@ -19,7 +19,6 @@ let private clean _ = removeArtifacts "release-notes" removeArtifacts "tests" removeArtifacts "docs-builder" - removeArtifacts "docs-assembler" let private compile _ = exec { run "dotnet" "build" "-c" "release" } @@ -57,7 +56,6 @@ let private pristineCheck (arguments:ParseResults) = let private publishBinaries _ = exec { run "dotnet" "publish" "src/tooling/docs-builder/docs-builder.csproj" } - exec { run "dotnet" "publish" "src/tooling/docs-assembler/docs-assembler.csproj" } let private publishZip _ = let zip tool = @@ -128,7 +126,6 @@ let private publishContainers _ = | _ -> [] exec { run "dotnet" (args @ registry) } createImage "docs-builder" - createImage "docs-assembler" let private runTests (testSuite: TestSuite) _ = let testFilter = diff --git a/docs-builder.sln b/docs-builder.sln index 9bce0329e..f0b81ed9b 100644 --- a/docs-builder.sln +++ b/docs-builder.sln @@ -47,17 +47,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "publish-vercel", "publish-v EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "build", "build\build.fsproj", "{10857974-6CF1-42B5-B793-AAA988BD7348}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "docs-assembler", "src\tooling\docs-assembler\docs-assembler.csproj", "{28350800-B44B-479B-86E2-1D39E321C0B4}" -EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "authoring", "tests\authoring\authoring.fsproj", "{018F959E-824B-4664-B345-066784478D24}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Documentation.Refactor", "src\authoring\Elastic.Documentation.Refactor\Elastic.Documentation.Refactor.csproj", "{7D36DDDA-9E0B-4D2C-8033-5D62FF8B6166}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assembler", "assembler", "{CFEE9FAD-9E0C-4C0E-A0C2-B97D594C14B5}" - ProjectSection(SolutionItems) = preProject - actions\assembler\action.yml = actions\assembler\action.yml - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elastic.Documentation.Tooling", "src\tooling\Elastic.Documentation.Tooling\Elastic.Documentation.Tooling.csproj", "{4CCE599A-B9FE-4DF2-8763-34CF0A99D4AA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "validate-inbound-local", "validate-inbound-local", "{6E2ED6CC-AFC1-4E58-965D-6AEC500EBB46}" @@ -73,8 +66,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "update-link-index", "update EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "docs-lambda-index-publisher", "src\infra\docs-lambda-index-publisher\docs-lambda-index-publisher.csproj", "{C559D52D-100B-4B2B-BE87-2344D835761D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "docs-assembler.Tests", "tests\docs-assembler.Tests\src\docs-assembler.Tests\docs-assembler.Tests.csproj", "{CDC0ECF4-6597-4FBA-8D25-5C244F0877E3}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "infra", "infra", "{4894063D-0DEF-4B7E-97D0-0D0A5B85C608}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "validate-path-prefixes-local", "validate-path-prefixes-local", "{BB789671-B262-43DD-91DB-39F9186B8257}" @@ -188,10 +179,6 @@ Global {10857974-6CF1-42B5-B793-AAA988BD7348}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {10857974-6CF1-42B5-B793-AAA988BD7348}.Debug|Any CPU.Build.0 = Debug|Any CPU {10857974-6CF1-42B5-B793-AAA988BD7348}.Release|Any CPU.ActiveCfg = Release|Any CPU - {28350800-B44B-479B-86E2-1D39E321C0B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {28350800-B44B-479B-86E2-1D39E321C0B4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {28350800-B44B-479B-86E2-1D39E321C0B4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {28350800-B44B-479B-86E2-1D39E321C0B4}.Release|Any CPU.Build.0 = Release|Any CPU {018F959E-824B-4664-B345-066784478D24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {018F959E-824B-4664-B345-066784478D24}.Debug|Any CPU.Build.0 = Debug|Any CPU {018F959E-824B-4664-B345-066784478D24}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -208,10 +195,6 @@ Global {C559D52D-100B-4B2B-BE87-2344D835761D}.Debug|Any CPU.Build.0 = Debug|Any CPU {C559D52D-100B-4B2B-BE87-2344D835761D}.Release|Any CPU.ActiveCfg = Release|Any CPU {C559D52D-100B-4B2B-BE87-2344D835761D}.Release|Any CPU.Build.0 = Release|Any CPU - {CDC0ECF4-6597-4FBA-8D25-5C244F0877E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CDC0ECF4-6597-4FBA-8D25-5C244F0877E3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CDC0ECF4-6597-4FBA-8D25-5C244F0877E3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CDC0ECF4-6597-4FBA-8D25-5C244F0877E3}.Release|Any CPU.Build.0 = Release|Any CPU {09CE30F6-013A-49ED-B3D6-60AFA84682AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {09CE30F6-013A-49ED-B3D6-60AFA84682AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {09CE30F6-013A-49ED-B3D6-60AFA84682AC}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -291,17 +274,14 @@ Global {CD2887E3-BDA9-434B-A5BF-9ED38DE20332} = {245023D2-D3CA-47B9-831D-DAB91A2FFDC7} {A2A34BBC-CB5E-4100-9529-A12B6ECB769C} = {245023D2-D3CA-47B9-831D-DAB91A2FFDC7} {018F959E-824B-4664-B345-066784478D24} = {67B576EE-02FA-4F9B-94BC-3630BC09ECE5} - {CFEE9FAD-9E0C-4C0E-A0C2-B97D594C14B5} = {245023D2-D3CA-47B9-831D-DAB91A2FFDC7} {6E2ED6CC-AFC1-4E58-965D-6AEC500EBB46} = {245023D2-D3CA-47B9-831D-DAB91A2FFDC7} {6554F917-73CE-4B3D-9101-F28EAA762C6B} = {245023D2-D3CA-47B9-831D-DAB91A2FFDC7} - {CDC0ECF4-6597-4FBA-8D25-5C244F0877E3} = {67B576EE-02FA-4F9B-94BC-3630BC09ECE5} {4894063D-0DEF-4B7E-97D0-0D0A5B85C608} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A} {C559D52D-100B-4B2B-BE87-2344D835761D} = {4894063D-0DEF-4B7E-97D0-0D0A5B85C608} {BB789671-B262-43DD-91DB-39F9186B8257} = {245023D2-D3CA-47B9-831D-DAB91A2FFDC7} {09CE30F6-013A-49ED-B3D6-60AFA84682AC} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A} {CD94F9E4-7FCD-4152-81F1-4288C6B75367} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A} {73ABAE37-118F-4A53-BC2C-F19333555C90} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A} - {28350800-B44B-479B-86E2-1D39E321C0B4} = {73ABAE37-118F-4A53-BC2C-F19333555C90} {01F05AD0-E0E0-401F-A7EC-905928E1E9F0} = {73ABAE37-118F-4A53-BC2C-F19333555C90} {4CCE599A-B9FE-4DF2-8763-34CF0A99D4AA} = {73ABAE37-118F-4A53-BC2C-F19333555C90} {059E787F-85C1-43BE-9DD6-CE319E106383} = {BE6011CC-1200-4957-B01F-FCCA10C5CF5A} diff --git a/docs/cli/assembler/assembler-deploy-update-redirects.md b/docs/cli/assembler/assembler-deploy-update-redirects.md index ec0255d5d..5a811df77 100644 --- a/docs/cli/assembler/assembler-deploy-update-redirects.md +++ b/docs/cli/assembler/assembler-deploy-update-redirects.md @@ -18,4 +18,4 @@ docs-builder assembler deploy update-redirects [options...] [-h|--help] [--versi : The environment to build (Required) `--redirects-file` `` -: Path to the redirects mapping pre-generated by docs-assembler (optional) \ No newline at end of file +: Path to the redirects mapping pre-generated by docs-builder assemble (optional) \ No newline at end of file diff --git a/docs/contribute/add-repo.md b/docs/contribute/add-repo.md index 255862acd..2290ef0db 100644 --- a/docs/contribute/add-repo.md +++ b/docs/contribute/add-repo.md @@ -1,6 +1,6 @@ # Add a new repository to the docs -Elastic documentation is built from many assembled repositories using `docs-assembler`. Adding a new repository requires making the assembly process aware of its existence. +Elastic documentation is built from many assembled repositories using `docs-builder assemble`. Adding a new repository requires making the assembly process aware of its existence. Follow these instructions to add a new docs repository. diff --git a/src/Elastic.Documentation.LegacyDocs/README.md b/src/Elastic.Documentation.LegacyDocs/README.md index 28f0f2403..b52f295ba 100644 --- a/src/Elastic.Documentation.LegacyDocs/README.md +++ b/src/Elastic.Documentation.LegacyDocs/README.md @@ -10,7 +10,7 @@ It uses a checked-in bloom filter file loaded into memory to check if an URL exi The bloom filter file is created by running the following command: ``` -dotnet run --project src/tooling/docs-assembler -- legacy-docs create-bloom-bin --built-docs-dir /path/to/elastic/built-docs +dotnet run --project src/tooling/docs-builder -- assembler bloom-filter create --built-docs-dir /path/to/elastic/built-docs ``` 1. The `--built-docs-dir` option is the path to the locally checked-out [elastic/built-docs](https://github.com/elastic/built-docs) repository. diff --git a/src/tooling/docs-assembler/Cli/ContentSourceCommands.cs b/src/tooling/docs-assembler/Cli/ContentSourceCommands.cs deleted file mode 100644 index 29fae97df..000000000 --- a/src/tooling/docs-assembler/Cli/ContentSourceCommands.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.IO.Abstractions; -using Actions.Core.Services; -using ConsoleAppFramework; -using Elastic.Documentation.Assembler.ContentSources; -using Elastic.Documentation.Configuration; -using Elastic.Documentation.Configuration.Assembler; -using Elastic.Documentation.Diagnostics; -using Elastic.Documentation.Services; -using Microsoft.Extensions.Logging; - -namespace Documentation.Assembler.Cli; - -// TODO This copy is scheduled for deletion soon -internal sealed class ContentSourceCommands( - ILoggerFactory logFactory, - IDiagnosticsCollector collector, - AssemblyConfiguration configuration, - IConfigurationContext configurationContext, - ICoreService githubActionsService -) -{ - [Command("validate")] - public async Task Validate(Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var fs = new FileSystem(); - var service = new RepositoryPublishValidationService(logFactory, configuration, configurationContext, fs); - serviceInvoker.AddCommand(service, static async (s, collector, ctx) => await s.ValidatePublishStatus(collector, ctx)); - - return await serviceInvoker.InvokeAsync(ctx); - } - - /// - /// - /// - /// - [Command("match")] - public async Task Match([Argument] string? repository = null, [Argument] string? branchOrTag = null, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var fs = new FileSystem(); - var service = new RepositoryBuildMatchingService(logFactory, configuration, configurationContext, githubActionsService, fs); - serviceInvoker.AddCommand(service, (repository, branchOrTag), - static async (s, collector, state, ctx) => - { - _ = await s.ShouldBuild(collector, state.repository, state.branchOrTag); - // ShouldBuild throws an exception on bad args and will return false if it has no matches - // We return true to the service invoker to continue - return true; - }); - - return await serviceInvoker.InvokeAsync(ctx); - } - -} diff --git a/src/tooling/docs-assembler/Cli/DeployCommands.cs b/src/tooling/docs-assembler/Cli/DeployCommands.cs deleted file mode 100644 index 6ea9369d1..000000000 --- a/src/tooling/docs-assembler/Cli/DeployCommands.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.IO.Abstractions; -using Actions.Core.Services; -using ConsoleAppFramework; -using Elastic.Documentation.Assembler.Deploying; -using Elastic.Documentation.Configuration; -using Elastic.Documentation.Configuration.Assembler; -using Elastic.Documentation.Diagnostics; -using Elastic.Documentation.Services; -using Microsoft.Extensions.Logging; - -namespace Documentation.Assembler.Cli; - -// TODO This copy is scheduled for deletion soon -internal sealed class DeployCommands( - AssemblyConfiguration assemblyConfiguration, - IDiagnosticsCollector collector, - IConfigurationContext configurationContext, - ILoggerFactory logFactory, - ICoreService githubActionsService -) -{ - /// Creates a sync plan - /// The environment to build - /// The S3 bucket name to deploy to - /// The file to write the plan to - /// The percentage of deletions allowed in the plan as float - /// - [Command("plan")] - public async Task Plan(string environment, string s3BucketName, string @out = "", float? deleteThreshold = null, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var fs = new FileSystem(); - var service = new IncrementalDeployService(logFactory, assemblyConfiguration, configurationContext, githubActionsService, fs); - serviceInvoker.AddCommand(service, (environment, s3BucketName, @out, deleteThreshold), - static async (s, collector, state, ctx) => await s.Plan(collector, state.environment, state.s3BucketName, state.@out, state.deleteThreshold, ctx) - ); - return await serviceInvoker.InvokeAsync(ctx); - } - - /// Applies a sync plan - /// The environment to build - /// The S3 bucket name to deploy to - /// The file path to the plan file to apply - /// - [Command("apply")] - public async Task Apply(string environment, string s3BucketName, string planFile, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var fs = new FileSystem(); - var service = new IncrementalDeployService(logFactory, assemblyConfiguration, configurationContext, githubActionsService, fs); - serviceInvoker.AddCommand(service, (environment, s3BucketName, planFile), - static async (s, collector, state, ctx) => await s.Apply(collector, state.environment, state.s3BucketName, state.planFile, ctx) - ); - return await serviceInvoker.InvokeAsync(ctx); - } - - /// Refreshes the redirects mapping in Cloudfront's KeyValueStore - /// The environment to build - /// Path to the redirects mapping pre-generated by docs-assembler - /// - [Command("update-redirects")] - public async Task UpdateRedirects(string environment, string? redirectsFile = null, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var fs = new FileSystem(); - var service = new DeployUpdateRedirectsService(logFactory, fs); - serviceInvoker.AddCommand(service, (environment, redirectsFile), - static async (s, collector, state, ctx) => await s.UpdateRedirects(collector, state.environment, state.redirectsFile, ctx) - ); - return await serviceInvoker.InvokeAsync(ctx); - } - -} diff --git a/src/tooling/docs-assembler/Cli/InboundLinkCommands.cs b/src/tooling/docs-assembler/Cli/InboundLinkCommands.cs deleted file mode 100644 index 6d3298667..000000000 --- a/src/tooling/docs-assembler/Cli/InboundLinkCommands.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.IO.Abstractions; -using ConsoleAppFramework; -using Elastic.Documentation.Diagnostics; -using Elastic.Documentation.Links.InboundLinks; -using Elastic.Documentation.Services; -using Microsoft.Extensions.Logging; - -namespace Documentation.Assembler.Cli; - -// TODO This copy is scheduled for deletion soon -internal sealed class InboundLinkCommands(ILoggerFactory logFactory, IDiagnosticsCollector collector) -{ - private readonly LinkIndexService _linkIndexService = new(logFactory, new FileSystem()); - - /// Validate all published cross_links in all published links.json files. - /// - [Command("validate-all")] - public async Task ValidateAllInboundLinks(Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - serviceInvoker.AddCommand(_linkIndexService, static async (s, collector, ctx) => await s.CheckAll(collector, ctx)); - return await serviceInvoker.InvokeAsync(ctx); - } - - /// Validate all published cross_links in all published links.json files. - /// - /// - /// - [Command("validate")] - public async Task ValidateRepoInboundLinks(string? from = null, string? to = null, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - serviceInvoker.AddCommand(_linkIndexService, (to, from), - static async (s, collector, state, ctx) => await s.CheckRepository(collector, state.to, state.from, ctx) - ); - return await serviceInvoker.InvokeAsync(ctx); - } - - /// - /// Validate a locally published links.json file against all published links.json files in the registry - /// - /// Path to `links.json` defaults to '.artifacts/docs/html/links.json' - /// -p, Defaults to the `{pwd}` folder - /// - [Command("validate-link-reference")] - public async Task ValidateLocalLinkReference(string? file = null, string? path = null, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - serviceInvoker.AddCommand(_linkIndexService, (file, path), - static async (s, collector, state, ctx) => await s.CheckWithLocalLinksJson(collector, state.file, state.path, ctx) - ); - return await serviceInvoker.InvokeAsync(ctx); - } -} diff --git a/src/tooling/docs-assembler/Cli/LegacyDocsCommands.cs b/src/tooling/docs-assembler/Cli/LegacyDocsCommands.cs deleted file mode 100644 index 57d19d1ae..000000000 --- a/src/tooling/docs-assembler/Cli/LegacyDocsCommands.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using Elastic.Documentation.Diagnostics; -using Elastic.Documentation.LegacyDocs; -using Elastic.Documentation.Services; -using Microsoft.Extensions.Logging; - -namespace Documentation.Assembler.Cli; - -// TODO This copy is scheduled for deletion soon -internal sealed class LegacyDocsCommands(ILoggerFactory logFactory, IDiagnosticsCollector collector) -{ - /// Generate the bloom filter binary file - /// The local dir of local elastic/built-docs repository - /// - public async Task CreateBloomBin(string builtDocsDir, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var pagesProvider = new LocalPagesProvider(builtDocsDir); - var legacyPageService = new LegacyPageService(logFactory); - - serviceInvoker.AddCommand(legacyPageService, pagesProvider, static (s, _, pagesProvider, _) => - { - var result = s.GenerateBloomFilterBinary(pagesProvider); - return Task.FromResult(result); - }); - return await serviceInvoker.InvokeAsync(ctx); - } - - /// Checks whether exists in the bloomfilter - /// The local dir of local elastic/built-docs repository - /// - public async Task PageExists(string path, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var legacyPageService = new LegacyPageService(logFactory); - serviceInvoker.AddCommand(legacyPageService, path, static (s, _, path, _) => - { - var result = s.PathExists(path); - return Task.FromResult(result); - }); - return await serviceInvoker.InvokeAsync(ctx); - } -} diff --git a/src/tooling/docs-assembler/Cli/NavigationCommands.cs b/src/tooling/docs-assembler/Cli/NavigationCommands.cs deleted file mode 100644 index 9c28290a5..000000000 --- a/src/tooling/docs-assembler/Cli/NavigationCommands.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.IO.Abstractions; -using ConsoleAppFramework; -using Elastic.Documentation.Assembler.Navigation; -using Elastic.Documentation.Configuration; -using Elastic.Documentation.Configuration.Assembler; -using Elastic.Documentation.Diagnostics; -using Elastic.Documentation.Services; -using Microsoft.Extensions.Logging; - -namespace Documentation.Assembler.Cli; - -// TODO This copy is scheduled for deletion soon -internal sealed class NavigationCommands( - ILoggerFactory logFactory, - IDiagnosticsCollector collector, - AssemblyConfiguration configuration, - IConfigurationContext configurationContext -) -{ - /// Validates navigation.yml does not contain colliding path prefixes - /// - [Command("validate")] - public async Task Validate(Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - var service = new GlobalNavigationService(logFactory, configuration, configurationContext, new FileSystem()); - serviceInvoker.AddCommand(service, static async (s, collector, ctx) => await s.Validate(collector, ctx)); - return await serviceInvoker.InvokeAsync(ctx); - } - - - /// Validate all published links in links.json do not collide with navigation path_prefixes. - /// Path to `links.json` defaults to '.artifacts/docs/html/links.json' - /// - [Command("validate-link-reference")] - public async Task ValidateLocalLinkReference([Argument] string? file = null, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - var service = new GlobalNavigationService(logFactory, configuration, configurationContext, new FileSystem()); - serviceInvoker.AddCommand(service, file, static async (s, collector, file, ctx) => await s.ValidateLocalLinkReference(collector, file, ctx)); - return await serviceInvoker.InvokeAsync(ctx); - } - -} diff --git a/src/tooling/docs-assembler/Cli/RepositoryCommands.cs b/src/tooling/docs-assembler/Cli/RepositoryCommands.cs deleted file mode 100644 index 5d129862e..000000000 --- a/src/tooling/docs-assembler/Cli/RepositoryCommands.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.IO.Abstractions; -using Actions.Core.Services; -using ConsoleAppFramework; -using Elastic.Documentation; -using Elastic.Documentation.Assembler.Building; -using Elastic.Documentation.Assembler.Configuration; -using Elastic.Documentation.Assembler.Sourcing; -using Elastic.Documentation.Configuration; -using Elastic.Documentation.Configuration.Assembler; -using Elastic.Documentation.Diagnostics; -using Elastic.Documentation.Services; -using Elastic.Documentation.Tooling.Arguments; -using Microsoft.Extensions.Logging; - -namespace Documentation.Assembler.Cli; - -// TODO This copy is scheduled for deletion soon -internal sealed class RepositoryCommands( - ILoggerFactory logFactory, - IDiagnosticsCollector collector, - AssemblyConfiguration assemblyConfiguration, - IConfigurationContext configurationContext, - ICoreService githubActionsService -) -{ - /// Clone the configuration folder - /// The git reference of the config, defaults to 'main' - /// Save the remote configuration locally in the pwd so later commands can pick it up as local - /// - [Command("init-config")] - public async Task CloneConfigurationFolder(string? gitRef = null, bool local = false, Cancel ctx = default) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var fs = new FileSystem(); - var service = new ConfigurationCloneService(logFactory, assemblyConfiguration, fs); - serviceInvoker.AddCommand(service, (gitRef, local), static async (s, collector, state, ctx) => - await s.InitConfigurationToApplicationData(collector, state.gitRef, state.local, ctx)); - return await serviceInvoker.InvokeAsync(ctx); - } - - /// Clones all repositories - /// Treat warnings as errors and fail the build on warnings - /// The environment to build - /// If true, fetch the latest commit of the branch instead of the link registry entry ref - /// If true, assume the repository folder already exists on disk assume it's cloned already, primarily used for testing - /// - [Command("clone-all")] - public async Task CloneAll( - bool? strict = null, - string? environment = null, - bool? fetchLatest = null, - bool? assumeCloned = null, - Cancel ctx = default - ) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var service = new AssemblerCloneService(logFactory, assemblyConfiguration, configurationContext, githubActionsService); - serviceInvoker.AddCommand(service, (strict, environment, fetchLatest, assumeCloned, ctx), strict ?? false, - static async (s, collector, state, ctx) => await s.CloneAll(collector, state.strict, state.environment, state.fetchLatest, state.assumeCloned, ctx) - ); - - return await serviceInvoker.InvokeAsync(ctx); - } - - - /// Builds all repositories - /// Treat warnings as errors and fail the build on warnings - /// The environment to build - /// Only emit documentation metadata to output, ignored if 'exporters' is also set - /// Set available exporters: - /// html, es, config, links, state, llm, redirect, metadata, none. - /// Defaults to (html, config, links, state, redirect) or 'default'. - /// - /// - [Command("build-all")] - public async Task BuildAll( - bool? strict = null, - string? environment = null, - bool? metadataOnly = null, - [ExporterParser] IReadOnlySet? exporters = null, - Cancel ctx = default - ) - { - await using var serviceInvoker = new ServiceInvoker(collector); - - var fs = new FileSystem(); - var service = new AssemblerBuildService(logFactory, assemblyConfiguration, configurationContext, githubActionsService); - serviceInvoker.AddCommand(service, (strict, environment, metadataOnly, exporters, fs), strict ?? false, - static async (s, collector, state, ctx) => - await s.BuildAll(collector, state.strict, state.environment, state.metadataOnly, false, state.exporters, state.fs, ctx) - ); - - return await serviceInvoker.InvokeAsync(ctx); - } -} diff --git a/src/tooling/docs-assembler/Program.cs b/src/tooling/docs-assembler/Program.cs deleted file mode 100644 index 5d6cb8719..000000000 --- a/src/tooling/docs-assembler/Program.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to Elasticsearch B.V under one or more agreements. -// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information - -using System.Diagnostics.CodeAnalysis; -using Actions.Core.Services; -using ConsoleAppFramework; -using Documentation.Assembler.Cli; -using Elastic.Documentation; -using Elastic.Documentation.Configuration.Assembler; -using Elastic.Documentation.ServiceDefaults; -using Elastic.Documentation.Tooling; -using Elastic.Documentation.Tooling.Filters; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - -var builder = Host.CreateApplicationBuilder() - .AddDocumentationServiceDefaults(ref args, (s, p) => - { - _ = s.AddSingleton(AssemblyConfiguration.Create(p)); - }) - .AddDocumentationToolingDefaults(); - -var app = builder.ToConsoleAppBuilder((s) => -{ - ConsoleApp.ServiceProvider = s; - return ConsoleApp.Create(); -}); - -app.UseFilter(); -app.UseFilter(); -app.UseFilter(); -app.UseFilter(); - -app.Add("inbound-links"); -app.Add("repo"); -app.Add("navigation"); -app.Add("content-source"); -app.Add("deploy"); -app.Add("legacy-docs"); - -var githubActions = ConsoleApp.ServiceProvider!.GetService(); -var command = githubActions?.GetInput("COMMAND"); -if (!string.IsNullOrEmpty(command)) - args = command.Split(' '); - -await app.RunAsync(args); - -internal sealed class ReplaceLogFilter(ConsoleAppFilter next, ILogger logger, GlobalCliArgs cli) - : ConsoleAppFilter(next) -{ - [SuppressMessage("Usage", "CA2254:Template should be a static expression")] - public override Task InvokeAsync(ConsoleAppContext context, Cancel cancellationToken) - { - if (!cli.IsHelpOrVersion) - { - ConsoleApp.Log = msg => logger.LogInformation(msg); - ConsoleApp.LogError = msg => logger.LogError(msg); - } - - return Next.InvokeAsync(context, cancellationToken); - } -} diff --git a/src/tooling/docs-assembler/docs-assembler.csproj b/src/tooling/docs-assembler/docs-assembler.csproj deleted file mode 100644 index 45c4178f8..000000000 --- a/src/tooling/docs-assembler/docs-assembler.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - - net9.0 - Exe - docs-assembler - Documentation.Assembler - true - - true - true - true - false - - true - true - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/tooling/docs-builder/Commands/Assembler/DeployCommands.cs b/src/tooling/docs-builder/Commands/Assembler/DeployCommands.cs index 353f639c3..5184e2dad 100644 --- a/src/tooling/docs-builder/Commands/Assembler/DeployCommands.cs +++ b/src/tooling/docs-builder/Commands/Assembler/DeployCommands.cs @@ -61,7 +61,7 @@ static async (s, collector, state, ctx) => await s.Apply(collector, state.enviro /// Refreshes the redirects mapping in Cloudfront's KeyValueStore /// The environment to build - /// Path to the redirects mapping pre-generated by docs-assembler + /// Path to the redirects mapping pre-generated by docs-builder assemble /// [Command("update-redirects")] public async Task UpdateRedirects(string environment, string? redirectsFile = null, Cancel ctx = default) diff --git a/tests-integration/Directory.Build.props b/tests-integration/Directory.Build.props index 009f14389..7f8cf2d64 100644 --- a/tests-integration/Directory.Build.props +++ b/tests-integration/Directory.Build.props @@ -6,7 +6,7 @@ false false true - CA1822 + CA1822;IDE0058 false true diff --git a/tests/docs-assembler.Tests/src/docs-assembler.Tests/AssemblerConfigurationTests.cs b/tests-integration/Elastic.Assembler.IntegrationTests/AssemblerConfigurationTests.cs similarity index 84% rename from tests/docs-assembler.Tests/src/docs-assembler.Tests/AssemblerConfigurationTests.cs rename to tests-integration/Elastic.Assembler.IntegrationTests/AssemblerConfigurationTests.cs index 12b30a74b..6788da322 100644 --- a/tests/docs-assembler.Tests/src/docs-assembler.Tests/AssemblerConfigurationTests.cs +++ b/tests-integration/Elastic.Assembler.IntegrationTests/AssemblerConfigurationTests.cs @@ -10,7 +10,7 @@ using FluentAssertions; using Microsoft.Extensions.Logging.Abstractions; -namespace Documentation.Assembler.Tests; +namespace Elastic.Assembler.IntegrationTests; public class PublicOnlyAssemblerConfigurationTests { @@ -45,14 +45,18 @@ public void ReadsPrivateRepositories() } -public class AssemblerConfigurationTests +public class AssemblerConfigurationTests : IAsyncLifetime { + private readonly DocumentationFixture _fixture; + private readonly ITestOutputHelper _output; private DiagnosticsCollector Collector { get; } private AssembleContext Context { get; } private FileSystem FileSystem { get; } private IDirectoryInfo CheckoutDirectory { get; set; } - public AssemblerConfigurationTests() + public AssemblerConfigurationTests(DocumentationFixture fixture, ITestOutputHelper output) { + _fixture = fixture; + _output = output; FileSystem = new FileSystem(); CheckoutDirectory = FileSystem.DirectoryInfo.New( FileSystem.Path.Combine(Paths.GetSolutionDirectory()!.FullName, ".artifacts", "checkouts") @@ -114,8 +118,22 @@ public void ReadsVersions() beats.GitReferenceCurrent.Should().NotBeNullOrEmpty() .And.NotBe("main"); - var cloud = config.ReferenceRepositories["cloud"]; - cloud.GitReferenceCurrent.Should().NotBeNullOrEmpty() + var curator = config.ReferenceRepositories["curator"]; + curator.GitReferenceCurrent.Should().NotBeNullOrEmpty() .And.Be("master"); } + + /// + public ValueTask DisposeAsync() + { + GC.SuppressFinalize(this); + if (TestContext.Current.TestState?.Result is TestResult.Passed) + return default; + foreach (var resource in _fixture.InMemoryLogger.RecordedLogs) + _output.WriteLine(resource.Message); + return default; + } + + /// + public ValueTask InitializeAsync() => default; } diff --git a/tests/docs-assembler.Tests/src/docs-assembler.Tests/DocsSyncTests.cs b/tests-integration/Elastic.Assembler.IntegrationTests/DocsSyncTests.cs similarity index 99% rename from tests/docs-assembler.Tests/src/docs-assembler.Tests/DocsSyncTests.cs rename to tests-integration/Elastic.Assembler.IntegrationTests/DocsSyncTests.cs index b00aea7af..e4af40b8a 100644 --- a/tests/docs-assembler.Tests/src/docs-assembler.Tests/DocsSyncTests.cs +++ b/tests-integration/Elastic.Assembler.IntegrationTests/DocsSyncTests.cs @@ -15,7 +15,7 @@ using FluentAssertions; using Microsoft.Extensions.Logging; -namespace Documentation.Assembler.Tests; +namespace Elastic.Assembler.IntegrationTests; public class DocsSyncTests { diff --git a/tests-integration/Elastic.Assembler.IntegrationTests/Elastic.Assembler.IntegrationTests.csproj b/tests-integration/Elastic.Assembler.IntegrationTests/Elastic.Assembler.IntegrationTests.csproj index fead12ee0..dabf034b7 100644 --- a/tests-integration/Elastic.Assembler.IntegrationTests/Elastic.Assembler.IntegrationTests.csproj +++ b/tests-integration/Elastic.Assembler.IntegrationTests/Elastic.Assembler.IntegrationTests.csproj @@ -8,12 +8,11 @@ - - + diff --git a/tests/docs-assembler.Tests/src/docs-assembler.Tests/GlobalNavigationTests.cs b/tests-integration/Elastic.Assembler.IntegrationTests/GlobalNavigationTests.cs similarity index 90% rename from tests/docs-assembler.Tests/src/docs-assembler.Tests/GlobalNavigationTests.cs rename to tests-integration/Elastic.Assembler.IntegrationTests/GlobalNavigationTests.cs index 64acb2c3b..b7e117a4f 100644 --- a/tests/docs-assembler.Tests/src/docs-assembler.Tests/GlobalNavigationTests.cs +++ b/tests-integration/Elastic.Assembler.IntegrationTests/GlobalNavigationTests.cs @@ -17,19 +17,23 @@ using FluentAssertions; using Microsoft.Extensions.Logging.Abstractions; -namespace Documentation.Assembler.Tests; +namespace Elastic.Assembler.IntegrationTests; -public class GlobalNavigationPathProviderTests +public class GlobalNavigationPathProviderTests : IAsyncLifetime { + private readonly DocumentationFixture _fixture; + private readonly ITestOutputHelper _output; private DiagnosticsCollector Collector { get; } private AssembleContext Context { get; } private FileSystem FileSystem { get; } - private IDirectoryInfo CheckoutDirectory { get; set; } + private IDirectoryInfo CheckoutDirectory { get; } private bool HasCheckouts() => CheckoutDirectory.Exists; - public GlobalNavigationPathProviderTests() + public GlobalNavigationPathProviderTests(DocumentationFixture fixture, ITestOutputHelper output) { + _fixture = fixture; + _output = output; FileSystem = new FileSystem(); var checkoutDirectory = FileSystem.DirectoryInfo.New( FileSystem.Path.Combine(Paths.GetSolutionDirectory()!.FullName, ".artifacts", "checkouts") @@ -43,8 +47,13 @@ public GlobalNavigationPathProviderTests() Context = new AssembleContext(config, configurationContext, "dev", Collector, FileSystem, FileSystem, CheckoutDirectory.FullName, null); } - private Checkout CreateCheckout(IFileSystem fs, string name) => - new() + private Checkout CreateCheckout(IFileSystem fs, Repository repository) + { + var name = repository.Name; + var path = repository.Path is { } p + ? fs.DirectoryInfo.New(p) + : fs.DirectoryInfo.New(fs.Path.Combine(Path.Combine(CheckoutDirectory.FullName, name))); + return new Checkout { Repository = new Repository { @@ -52,18 +61,17 @@ private Checkout CreateCheckout(IFileSystem fs, string name) => Origin = $"elastic/{name}" }, HeadReference = Guid.NewGuid().ToString(), - Directory = fs.DirectoryInfo.New(fs.Path.Combine(Path.Combine(CheckoutDirectory.FullName, name))) + Directory = path }; + } private async Task Setup() { _ = Collector.StartAsync(TestContext.Current.CancellationToken); - string[] nar = [NarrativeRepository.RepositoryName]; - var repos = nar.Concat(Context.Configuration.ReferenceRepositories - .Where(kv => !kv.Value.Skip) - .Select(kv => kv.Value.Name) - ) + var repos = Context.Configuration.AvailableRepositories + .Where(kv => !kv.Value.Skip) + .Select(kv => kv.Value) .ToArray(); var checkouts = repos.Select(r => CreateCheckout(FileSystem, r)).ToArray(); var configurationContext = TestHelpers.CreateConfigurationContext(new FileSystem()); @@ -193,7 +201,7 @@ public async Task ParsesGlobalNavigation() assembleSources.NavigationTocMappings[kibanaExtendMoniker].TopLevelSource.Should().Be(expectedRoot); assembleSources.NavigationTocMappings.Should().NotBeEmpty().And.ContainKey(new Uri("docs-content://reference/apm/")); - var uri = new Uri("integration-docs://reference/"); + var uri = new Uri("integrations://extend"); assembleSources.TreeCollector.Should().NotBeNull(); _ = assembleSources.TreeCollector.TryGetTableOfContentsTree(uri, out var tree); tree.Should().NotBeNull(); @@ -272,10 +280,9 @@ public async Task UriResolving() var configurationContext = TestHelpers.CreateConfigurationContext(fs); var config = AssemblyConfiguration.Create(configurationContext.ConfigurationFileProvider); var assembleContext = new AssembleContext(config, configurationContext, "prod", collector, fs, fs, null, null); - var repos = assembleContext.Configuration.ReferenceRepositories + var repos = assembleContext.Configuration.AvailableRepositories .Where(kv => !kv.Value.Skip) - .Select(kv => kv.Value.Name) - .Concat([NarrativeRepository.RepositoryName]) + .Select(kv => kv.Value) .ToArray(); var checkouts = repos.Select(r => CreateCheckout(fs, r)).ToArray(); var assembleSources = await AssembleSources.AssembleAsync( @@ -303,4 +310,18 @@ public async Task UriResolving() resolvedUri = uriResolver.Resolve(new Uri("elasticsearch://extend/c/file.md"), "/extend/c/file"); resolvedUri.Should().Be("https://www.elastic.co/docs/extend/elasticsearch/c/file"); } + + /// + public ValueTask DisposeAsync() + { + GC.SuppressFinalize(this); + if (TestContext.Current.TestState?.Result is TestResult.Passed) + return default; + foreach (var resource in _fixture.InMemoryLogger.RecordedLogs) + _output.WriteLine(resource.Message); + return default; + } + + /// + public ValueTask InitializeAsync() => default; } diff --git a/tests/docs-assembler.Tests/src/docs-assembler.Tests/TestHelpers.cs b/tests-integration/Elastic.Assembler.IntegrationTests/TestHelpers.cs similarity index 94% rename from tests/docs-assembler.Tests/src/docs-assembler.Tests/TestHelpers.cs rename to tests-integration/Elastic.Assembler.IntegrationTests/TestHelpers.cs index 1bc2a19a8..27c55a686 100644 --- a/tests/docs-assembler.Tests/src/docs-assembler.Tests/TestHelpers.cs +++ b/tests-integration/Elastic.Assembler.IntegrationTests/TestHelpers.cs @@ -12,7 +12,7 @@ using Elastic.Documentation.Configuration.Versions; using Microsoft.Extensions.Logging.Abstractions; -namespace Documentation.Assembler.Tests; +namespace Elastic.Assembler.IntegrationTests; public static class TestHelpers { @@ -23,7 +23,7 @@ public static IConfigurationContext CreateConfigurationContext( ProductsConfiguration? productsConfiguration = null ) { - configurationFileProvider ??= new ConfigurationFileProvider(NullLoggerFactory.Instance, fileSystem); + configurationFileProvider ??= new ConfigurationFileProvider(NullLoggerFactory.Instance, fileSystem, skipPrivateRepositories: true); versionsConfiguration ??= new VersionsConfiguration { VersioningSystems = new Dictionary diff --git a/tests/docs-assembler.Tests/src/docs-assembler.Tests/docs-assembler.Tests.csproj b/tests/docs-assembler.Tests/src/docs-assembler.Tests/docs-assembler.Tests.csproj deleted file mode 100644 index 0fe87c358..000000000 --- a/tests/docs-assembler.Tests/src/docs-assembler.Tests/docs-assembler.Tests.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - net9.0 - - false - true - Exe - - false - true - Documentation.Assembler.Tests - - - - - - - - - -