Skip to content

Conversation

Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Mar 12, 2025

In assembler.yaml:

environments:
  production:
    uri: https://elastic.co
    path_prefix: docs
  staging:
    uri: https://staging-website.elastic.co
    path_prefix: docs
  preview:
    uri: https://docs-v3-preview.elastic.dev
    path_prefix:

Allows --environment <env> to be passed to docs-assembler repo build-all

Based on the environment cross links are written using the configured uri and environment prefix.

Repositories can also set a path_prefix e.g

references:
  apm-agent-android:
    path_prefix: reference/android
  apm-agent-dotnet:
  apm-agent-go:
  apm-agent-ios:
  apm-agent-java:
  apm-agent-nodejs:
    skip: true

All crosslinks to apm-agent-android:// in production would therefor resolve to

https://elastic.co/docs/reference/android/

@Copilot Copilot AI review requested due to automatic review settings March 12, 2025 20:20
@Mpdreamz Mpdreamz self-assigned this Mar 12, 2025
@Mpdreamz Mpdreamz requested a review from a team March 12, 2025 20:20
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for resolving crosslinks based on the deployment environment by adding the IUriEnvironmentResolver interface and new implementations. Key changes include:

  • Adding a new PublishEnvironmentUriResolver class that implements IUriEnvironmentResolver.
  • Updating configuration (AssemblyConfiguration and assembler.yml) to support multiple environments.
  • Modifying command-line commands, crosslink resolution, and tests to pass and use the environment parameter.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/docs-assembler/Building/PublishEnvironmentUriResolver.cs Introduces the resolver class that selects the appropriate URI based on the environment.
src/Elastic.Markdown/CrossLinks/IUriEnvironmentResolver.cs Adds the IUriEnvironmentResolver interface and the PreviewEnvironmentUriResolver implementation.
src/docs-assembler/Configuration/AssemblyConfiguration.cs Adds environment configuration support and YAML serialization for PublishEnvironment.
src/docs-assembler/assembler.yml Defines environment configurations (production, staging, preview).
src/docs-assembler/Cli/RepositoryCommands.cs Adds an environment parameter and integrates it into the build process.
src/Elastic.Markdown/CrossLinks/CrossLinkResolver.cs Updates dependency injection to use the new resolver and removes hardcoded branch logic.
src/docs-assembler/Building/AssemblerBuilder.cs Adjusts BuildAllAsync to accept an environment parameter and passes it to the resolver.
tests/Elastic.Markdown.Tests/TestCrossLinkResolver.cs Updates tests to use the injected resolver.

@Mpdreamz Mpdreamz merged commit 8432558 into main Mar 13, 2025
9 checks passed
@Mpdreamz Mpdreamz deleted the feature/assembler-environment-uri-resolving branch March 13, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants