Skip to content

Commit 7f9d303

Browse files
authored
Merge branch 'main' into theletterf-add-custom-links-navigation
2 parents 9e8b26b + 259723a commit 7f9d303

File tree

152 files changed

+15707
-5004
lines changed

Some content is hidden

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

152 files changed

+15707
-5004
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/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
* @elastic/docs-engineering
2-
/docs/ @elastic/docs
3-
/config/ @elastic/docs-tech-leads
2+
/docs/ @elastic/docs @elastic/docs-engineering
3+
/config/ @elastic/docs-tech-leads @elastic/docs-engineering

.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: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ 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-
38-
lint:
37+
38+
build-api-lambda:
39+
uses: ./.github/workflows/build-api-lambda.yml
40+
41+
npm:
3942
runs-on: ubuntu-latest
4043
defaults:
4144
run:
@@ -57,6 +60,12 @@ jobs:
5760

5861
- name: Format
5962
run: npm run fmt:check
63+
64+
- name: Build
65+
run: npm run build
66+
67+
- name: Test
68+
run: npm run test
6069

6170

6271
build:
@@ -75,11 +84,36 @@ jobs:
7584
id: bootstrap
7685
uses: ./.github/actions/bootstrap
7786

87+
- name: Install Aspire workload
88+
run: dotnet workload install aspire
89+
7890
- name: Build
7991
run: dotnet run --project build -c release
8092

8193
- name: Test
82-
run: dotnet run --project build -c release -- test
94+
run: dotnet run --project build -c release -- unit-test
8395

8496
- name: Publish AOT
8597
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}"

.github/workflows/updatecli.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: updatecli
3+
4+
on:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: "0 5 * * 1-5"
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
14+
15+
jobs:
16+
bump:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Get token
22+
id: get_token
23+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
24+
with:
25+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
26+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
27+
permissions: >-
28+
{
29+
"contents": "write",
30+
"pull_requests": "write"
31+
}
32+
repositories: >-
33+
["docs-builder"]
34+
35+
- uses: elastic/oblt-actions/updatecli/run@v1
36+
with:
37+
command: apply --config updatecli/updatecli.d/versions.yml --values updatecli/values.d/scm.yml
38+
env:
39+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
40+
41+
- if: ${{ failure() }}
42+
uses: elastic/oblt-actions/slack/send@v1
43+
with:
44+
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
45+
channel-id: "#docs-team"
46+
message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, please look what's going on <${{ env.JOB_URL }}|here>"

Directory.Packages.props

Lines changed: 26 additions & 3 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.0" />
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" />

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))

0 commit comments

Comments
 (0)