Skip to content

Commit 081d4c4

Browse files
authored
Merge branch 'main' into crosslinks-in-toc-take-three
2 parents 134b86d + 259723a commit 081d4c4

File tree

125 files changed

+4669
-1645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+4669
-1645
lines changed

.editorconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ dotnet_diagnostic.IDE0305.severity = none
246246
# CS8509 already warns
247247
dotnet_diagnostic.IDE0072.severity = none
248248

249-
249+
[src/api/Elastic.Documentation.Api.Lambda/**.cs]
250+
dotnet_diagnostic.IL3050.severity = none
251+
dotnet_diagnostic.IL2026.severity = none
250252

251253
[DocumentationWebHost.cs]
252254
dotnet_diagnostic.IL3050.severity = none

.github/actions/bootstrap/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ runs:
1818
run: |
1919
git fetch --prune --unshallow --tags
2020
git tag --list
21+
22+
- name: Git config
23+
shell: bash
24+
run: |
25+
git config --global init.defaultBranch main
26+
2127
- uses: actions/setup-dotnet@v4
2228
with:
2329
global-json-file: global.json
@@ -37,4 +43,3 @@ runs:
3743
cache: npm
3844
cache-dependency-path: src/Elastic.Documentation.Site/package-lock.json
3945
node-version-file: .nvmrc
40-
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
# This workflow is used to build the API lambda
3+
# lambda function bootstrap binary that can be deployed to AWS Lambda.
4+
name: Build API Lambda
5+
6+
on:
7+
workflow_dispatch:
8+
workflow_call:
9+
inputs:
10+
ref:
11+
required: false
12+
type: string
13+
default: ${{ github.ref }}
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
env:
22+
BINARY_PATH: .artifacts/Elastic.Documentation.Api.Lambda/release_linux-x64/bootstrap
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
ref: ${{ inputs.ref }}
27+
- name: Amazon Linux 2023 build
28+
run: |
29+
docker build . -t api-lambda:latest -f src/api/Elastic.Documentation.Api.Lambda/Dockerfile
30+
- name: Get bootstrap binary
31+
run: |
32+
docker cp $(docker create --name tc api-lambda:latest):/app/.artifacts/publish ./.artifacts && docker rm tc
33+
- name: Inspect bootstrap binary
34+
run: |
35+
tree .artifacts
36+
stat "${BINARY_PATH}"
37+
- name: Archive artifact
38+
id: upload-artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: api-lambda-binary
42+
retention-days: 1
43+
if-no-files-found: error
44+
path: ${{ env.BINARY_PATH }}

.github/workflows/ci.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ jobs:
3232
- name: Validate Content Sources
3333
run: dotnet run --project src/tooling/docs-assembler -c release -- content-source validate
3434

35-
build-lambda:
35+
build-link-index-updater-lambda:
3636
uses: ./.github/workflows/build-link-index-updater-lambda.yml
37-
37+
38+
build-api-lambda:
39+
uses: ./.github/workflows/build-api-lambda.yml
40+
3841
npm:
3942
runs-on: ubuntu-latest
4043
defaults:
@@ -81,11 +84,36 @@ jobs:
8184
id: bootstrap
8285
uses: ./.github/actions/bootstrap
8386

87+
- name: Install Aspire workload
88+
run: dotnet workload install aspire
89+
8490
- name: Build
8591
run: dotnet run --project build -c release
8692

8793
- name: Test
88-
run: dotnet run --project build -c release -- test
94+
run: dotnet run --project build -c release -- unit-test
8995

9096
- name: Publish AOT
9197
run: dotnet run --project build -c release -- publishbinaries
98+
99+
integration:
100+
if: false
101+
runs-on: ubuntu-latest
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- name: Free Disk Space
106+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
107+
with:
108+
tool-cache: false
109+
dotnet: true
110+
111+
- name: Bootstrap Action Workspace
112+
id: bootstrap
113+
uses: ./.github/actions/bootstrap
114+
115+
- name: Install Aspire workload
116+
run: dotnet workload install aspire
117+
118+
- name: Integration Tests
119+
run: dotnet run --project build -c release -- integrate
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Deploy API Lambda
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
permissions:
14+
contents: read
15+
uses: ./.github/workflows/build-api-lambda.yml
16+
17+
deploy:
18+
permissions:
19+
contents: read
20+
id-token: write
21+
runs-on: ubuntu-latest
22+
needs: build
23+
environment: docs-api-edge
24+
env:
25+
ZIP_FILE: api-lambda.zip
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Download bootstrap binary
29+
uses: actions/download-artifact@v4
30+
with:
31+
name: api-lambda-binary
32+
33+
- name: Download bootstrap binary
34+
uses: actions/download-artifact@v4
35+
with:
36+
name: api-lambda-binary # Defined in build-api-lambda.yml
37+
38+
- name: Create zip
39+
run: |
40+
zip -j "${ZIP_FILE}" ./bootstrap
41+
42+
- uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
43+
with:
44+
role-to-assume: arn:aws:iam::197730964718:role/elastic-docs-v3-api-deployer-edge
45+
aws-region: us-east-1
46+
47+
- name: Upload Lambda function
48+
run: |
49+
aws lambda update-function-code \
50+
--function-name elastic-docs-v3-edge-api \
51+
--zip-file "fileb://${ZIP_FILE}"

Directory.Packages.props

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,36 @@
22
<PropertyGroup>
33
<!-- Enable central package management, https://learn.microsoft.com/en-us/nuget/consume-packages/Central-Package-Management -->
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5+
<MinVerSkip Condition="'$(Configuration)' == 'Debug'">true</MinVerSkip>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
58
</PropertyGroup>
69
<ItemGroup>
710
<GlobalPackageReference Include="MinVer" Version="6.0.0" PrivateAssets="All" />
811
</ItemGroup>
912
<!-- AWS -->
1013
<ItemGroup>
14+
<PackageVersion Include="Amazon.Lambda.AspNetCoreServer.Hosting" Version="1.9.0" />
1115
<PackageVersion Include="Amazon.Lambda.RuntimeSupport" Version="1.13.0" />
1216
<PackageVersion Include="Amazon.Lambda.Core" Version="2.5.1" />
1317
<PackageVersion Include="Amazon.Lambda.S3Events" Version="3.1.0" />
1418
<PackageVersion Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
1519
<PackageVersion Include="Amazon.Lambda.SQSEvents" Version="2.2.0" />
20+
<PackageVersion Include="Aspire.Hosting" Version="9.4.0" />
21+
<PackageVersion Include="Aspire.Hosting.Testing" Version="9.4.0" />
1622
<PackageVersion Include="AWSSDK.Core" Version="4.0.0.2" />
1723
<PackageVersion Include="AWSSDK.SQS" Version="4.0.0.1" />
1824
<PackageVersion Include="AWSSDK.S3" Version="4.0.0.1" />
25+
<PackageVersion Include="Elastic.Aspire.Hosting.Elasticsearch" Version="9.3.0" />
1926
<PackageVersion Include="FakeItEasy" Version="8.3.0" />
2027
<PackageVersion Include="Elastic.Ingest.Elasticsearch" Version="0.11.3" />
28+
<PackageVersion Include="InMemoryLogger" Version="1.0.66" />
29+
<PackageVersion Include="MartinCostello.Logging.XUnit.v3" Version="0.6.0" />
30+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.4" />
2131
<PackageVersion Include="Microsoft.OpenApi" Version="2.0.0-preview9" />
2232
<PackageVersion Include="System.Text.Json" Version="9.0.5" />
33+
<PackageVersion Include="TUnit" Version="0.25.21" />
34+
<PackageVersion Include="xunit.v3.extensibility.core" Version="2.0.2" />
2335
</ItemGroup>
2436
<!-- Build -->
2537
<ItemGroup>
@@ -37,12 +49,12 @@
3749
<PackageVersion Include="DotNet.Glob" Version="3.1.3" />
3850
<PackageVersion Include="Errata" Version="0.14.0" />
3951
<PackageVersion Include="Github.Actions.Core" Version="9.0.0" />
40-
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.4" />
41-
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.4" />
52+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.7" />
53+
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.7" />
4254
<PackageVersion Include="Markdig" Version="0.41.1" />
4355
<PackageVersion Include="NetEscapades.EnumGenerators" Version="1.0.0-beta12" PrivateAssets="all" ExcludeAssets="runtime" />
4456
<PackageVersion Include="Proc" Version="0.9.1" />
45-
<PackageVersion Include="RazorSlices" Version="0.9.2" />
57+
<PackageVersion Include="RazorSlices" Version="0.9.4" />
4658
<PackageVersion Include="Samboy063.Tomlet" Version="6.0.0" />
4759
<PackageVersion Include="Slugify.Core" Version="4.0.1" />
4860
<PackageVersion Include="SoftCircuits.IniFileParser" Version="2.7.0" />
@@ -55,6 +67,17 @@
5567
</ItemGroup>
5668
<!-- Test packages -->
5769
<ItemGroup>
70+
<PackageVersion Include="Microsoft.Extensions.Http.Resilience" Version="9.7.0" />
71+
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="9.4.0" />
72+
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
73+
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
74+
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
75+
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
76+
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.12.0" />
77+
</ItemGroup>
78+
<!-- Test packages -->
79+
<ItemGroup>
80+
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.4.0" />
5881
<PackageVersion Include="AngleSharp.Diffing" Version="1.0.0" />
5982
<PackageVersion Include="DiffPlex" Version="1.7.2" />
6083
<PackageVersion Include="FluentAssertions" Version="7.2.0" />
@@ -70,4 +93,4 @@
7093
</PackageVersion>
7194
<PackageVersion Include="xunit.v3" Version="2.0.2" />
7295
</ItemGroup>
73-
</Project>
96+
</Project>

build/CommandLine.fs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ open Microsoft.FSharp.Reflection
99
open System
1010
open Bullseye
1111

12+
type TestSuite = All | Unit | Integration
13+
with
14+
member this.SuitName =
15+
match FSharpValue.GetUnionFields(this, typeof<TestSuite>) with
16+
| case, _ -> case.Name.ToLowerInvariant()
17+
1218
type Build =
1319
| [<CliPrefix(CliPrefix.None);SubCommand>] Clean
1420
| [<CliPrefix(CliPrefix.None);SubCommand>] Version
1521
| [<CliPrefix(CliPrefix.None);Hidden;SubCommand>] Compile
1622
| [<CliPrefix(CliPrefix.None);SubCommand>] Build
23+
1724
| [<CliPrefix(CliPrefix.None);SubCommand>] Test
18-
25+
| [<CliPrefix(CliPrefix.None);SubCommand>] Unit_Test
26+
| [<CliPrefix(CliPrefix.None);SubCommand>] Integrate
27+
1928
| [<CliPrefix(CliPrefix.None);SubCommand>] Format
2029
| [<CliPrefix(CliPrefix.None);SubCommand>] Watch
2130

@@ -33,6 +42,7 @@ type Build =
3342
| [<Inherit;AltCommandLine("-s")>] Single_Target
3443
| [<Inherit>] Token of string
3544
| [<Inherit;AltCommandLine("-c")>] Skip_Dirty_Check
45+
| [<Inherit;EqualsAssignment>] Test_Suite of TestSuite
3646
with
3747
interface IArgParserTemplate with
3848
member this.Usage =
@@ -41,8 +51,11 @@ with
4151
| Clean -> "clean known output locations"
4252
| Version -> "print version information"
4353
| Build -> "Run build"
44-
45-
| Test -> "runs a clean build and then runs all the tests "
54+
55+
| Unit_Test -> "alias to providing: test --test-suite=unit"
56+
| Integrate -> "alias to providing: test --test-suite=integration"
57+
| Test -> "runs a clean build and then runs all the tests unless --test-suite is provided"
58+
4659
| Release -> "runs build, tests, and create and validates the packages shy of publishing them"
4760
| Publish -> "Publishes artifacts"
4861
| Format -> "runs dotnet format"
@@ -62,6 +75,7 @@ with
6275
| Single_Target -> "Runs the provided sub command without running their dependencies"
6376
| Token _ -> "Token to be used to authenticate with github"
6477
| Skip_Dirty_Check -> "Skip the clean checkout check that guards the release/publish targets"
78+
| Test_Suite _ -> "Specify the test suite to run, defaults to all"
6579

6680
member this.StepName =
6781
match FSharpValue.GetUnionFields(this, typeof<Build>) with
@@ -87,4 +101,4 @@ with
87101
let dependsOn = if singleTarget then [] else dependsOn
88102

89103
let steps = dependsOn @ composedOf |> List.map _.StepName
90-
Targets.Target(target.StepName, steps, Action(fun _ -> action parsed))
104+
Targets.Target(target.StepName, steps, Action(fun _ -> action parsed))

build/Targets.fs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let private version _ =
3434

3535
let private format _ = exec { run "dotnet" "format" "--verbosity" "quiet" }
3636

37-
let private watch _ = exec { run "dotnet" "watch" "--project" "src/tooling/docs-builder" "--no-hot-reload" "--" "serve" }
37+
let private watch _ = exec { run "dotnet" "watch" "--project" "src/tooling/docs-builder" "--configuration" "debug" "--" "serve" }
3838

3939
let private lint _ =
4040
match exec {
@@ -107,10 +107,17 @@ let private publishContainers _ =
107107
createImage "docs-builder"
108108
createImage "docs-assembler"
109109

110-
let private runTests _ =
110+
let private runTests (testSuite: TestSuite) _ =
111+
let testFilter =
112+
match testSuite with
113+
| All -> []
114+
| Unit -> ["--filter"; "FullyQualifiedName~.Tests"]
115+
| Integration -> ["--filter"; "FullyQualifiedName~.IntegrationTests"]
116+
111117
exec {
112118
run "dotnet" (
113119
["test"; "-c"; "release"; "--no-restore"; "--no-build"; "--logger"; "GitHubActions"]
120+
@ testFilter
114121
@ ["--"; "RunConfiguration.CollectSourceInformation=true"]
115122
)
116123
}
@@ -132,8 +139,10 @@ let Setup (parsed:ParseResults<Build>) =
132139
Build.Cmd
133140
[Clean; Lint; Compile] [] build
134141

135-
| Test -> Build.Cmd [Compile] [] runTests
136-
142+
| Test -> Build.Cmd [Compile] [] <| runTests TestSuite.All
143+
| Unit_Test -> Build.Cmd [Compile] [] <| runTests TestSuite.Unit
144+
| Integrate -> Build.Cmd [Compile] [] <| runTests TestSuite.Integration
145+
137146
| Release ->
138147
Build.Cmd
139148
[PristineCheck; Build]
@@ -159,6 +168,7 @@ let Setup (parsed:ParseResults<Build>) =
159168

160169
// flags
161170
| Single_Target
171+
| Test_Suite _
162172
| Token _
163173
| Skip_Dirty_Check -> Build.Ignore
164174

config/assembler.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ environments:
2525
enabled: false
2626
feature_flags:
2727
LAZY_LOAD_NAVIGATION: true
28+
SEARCH_OR_ASK_AI: true
2829
dev:
2930
uri: http://localhost:4000
3031
content_source: current
@@ -94,6 +95,7 @@ references:
9495
elastic-otel-python:
9596
elastic-serverless-forwarder:
9697
integration-docs:
98+
private: true
9799
integrations:
98100
logstash-docs-md:
99101
opentelemetry:
@@ -104,7 +106,12 @@ references:
104106

105107
# @elastic/admin-docs
106108
cloud-on-k8s:
107-
cloud: *master
109+
cloud:
110+
current: master
111+
next: master
112+
edge: master
113+
private: true
114+
108115
curator: *master
109116
ecctl: *master
110117

0 commit comments

Comments
 (0)