-
Notifications
You must be signed in to change notification settings - Fork 33
Allow limited public assembler builds on docs-builder #2379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cotti
wants to merge
24
commits into
main
Choose a base branch
from
feature/db-assembler-previews
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
15e6ee5
Allow limited public assembler builds on docs-builder
cotti fc05e7e
Use path prefix for llms.txt when available
cotti 3b228a0
Adjust link-index.snapshot generation with path prefixes
cotti 4ca1805
Adjust sitemap.xml generation to use path prefixes when available.
cotti ed133bf
Remove extra slash
cotti 71dbdaf
Create assembler deployment process
cotti ebf0abb
Apply automated fix to 'Call to System.IO.Path.Combine'
cotti 31f208e
Apply remaining updates
cotti f46f699
Move the assembler preview to a separate workflow
cotti 76643cb
Merge branch 'main' into feature/db-assembler-previews
cotti 9fed4a8
Revert "Move the assembler preview to a separate workflow"
cotti 2fd9d4f
Revert "Create assembler deployment process"
cotti baf4c87
Revert "Remove extra slash"
cotti 1b3dcaf
Revert "Allow limited public assembler builds on docs-builder"
cotti 7d6b125
Merge remote-tracking branch 'origin/feature/db-assembler-previews' i…
cotti 38a1160
Add workflow
cotti 11a183a
Remove label execution
cotti 70d1290
Merge branch 'main' into feature/db-assembler-previews
cotti eb54ed8
Add labeled clause
cotti 13479f0
Merge remote-tracking branch 'origin/feature/db-assembler-previews' i…
cotti d43f146
Fix SHA evalutation on PRs
cotti 929efdd
Un-revert assembler preview config
cotti a81cde5
Simplify usage of path-prefixed output
cotti c82d89c
Add suggested change to 'Call to System.IO.Path.Combine'
cotti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| name: assembler-preview | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - reopened | ||
| - labeled | ||
| workflow_dispatch: | ||
| inputs: | ||
| pr_number: | ||
| description: 'Pull Request number to build the assembler preview for' | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
| deployments: write | ||
| id-token: write | ||
| pull-requests: read | ||
|
|
||
| concurrency: | ||
| group: assembler-preview-${{ github.event.pull_request.number || inputs.pr_number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }} | ||
| steps: | ||
| - name: Get PR details | ||
| if: github.event_name == 'workflow_dispatch' | ||
| id: pr-details | ||
| uses: actions/github-script@v8 | ||
| env: | ||
| PR_NUMBER: ${{ inputs.pr_number }} | ||
| with: | ||
| result-encoding: json | ||
| script: | | ||
| const { owner, repo } = context.repo; | ||
| const prNumber = parseInt(process.env.PR_NUMBER, 10); | ||
|
|
||
| if (isNaN(prNumber) || prNumber <= 0) { | ||
| core.setFailed(`Invalid PR number: ${process.env.PR_NUMBER}`); | ||
| return; | ||
| } | ||
|
|
||
| try { | ||
| const { data: pr } = await github.rest.pulls.get({ | ||
| owner, | ||
| repo, | ||
| pull_number: prNumber, | ||
| }); | ||
|
|
||
| return { | ||
| sha: pr.head.sha, | ||
| ref: pr.head.ref, | ||
| base_ref: pr.base.ref, | ||
| }; | ||
| } catch (error) { | ||
| core.setFailed(`Failed to get PR #${prNumber}: ${error.message}`); | ||
| } | ||
|
|
||
| - name: Set PR SHA (workflow_dispatch) | ||
| id: pr-sha-dispatch | ||
| if: github.event_name == 'workflow_dispatch' | ||
| run: echo "sha=${{ fromJSON(steps.pr-details.outputs.result).sha }}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Set PR SHA (pull_request) | ||
| id: pr-sha-pr | ||
| if: github.event_name == 'pull_request' | ||
| run: echo "sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Resolve PR SHA | ||
| id: pr-sha | ||
| run: echo "sha=${{ steps.pr-sha-dispatch.outputs.sha || steps.pr-sha-pr.outputs.sha }}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ steps.pr-sha.outputs.sha }} | ||
| persist-credentials: false | ||
|
|
||
| - name: Create Deployment | ||
| uses: actions/github-script@v8 | ||
| id: deployment | ||
| env: | ||
| PR_SHA: ${{ steps.pr-sha.outputs.sha }} | ||
| with: | ||
| result-encoding: string | ||
| script: | | ||
| const { owner, repo } = context.repo; | ||
| const prNumber = process.env.PR_NUMBER; | ||
| const environment = 'assembler-preview'; | ||
| const task = `assembler-preview-${prNumber}`; | ||
| const deployment = await github.rest.repos.createDeployment({ | ||
| owner, | ||
| repo, | ||
| environment, | ||
| task, | ||
| ref: process.env.PR_SHA, | ||
| auto_merge: false, | ||
| transient_environment: true, | ||
| required_contexts: [], | ||
| }) | ||
| await github.rest.repos.createDeploymentStatus({ | ||
| deployment_id: deployment.data.id, | ||
| owner, | ||
| repo, | ||
| state: "in_progress", | ||
| log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | ||
| }) | ||
| return deployment.data.id | ||
|
|
||
| - name: Bootstrap Action Workspace | ||
| uses: elastic/docs-builder/.github/actions/bootstrap@main | ||
|
|
||
| - name: Build assembled documentation | ||
| id: assembler-build | ||
| env: | ||
| ASSEMBLER_PREVIEW_PATH_PREFIX: ${{ github.repository }}/docs/${{ env.PR_NUMBER }} | ||
| run: | | ||
| echo "ASSEMBLER_PREVIEW_PATH_PREFIX=${ASSEMBLER_PREVIEW_PATH_PREFIX}" >> $GITHUB_ENV | ||
| yq -i ".environments.preview.path_prefix = \"${ASSEMBLER_PREVIEW_PATH_PREFIX}\"" config/assembler.yml | ||
| dotnet run --project src/tooling/docs-builder -- assemble --skip-private-repositories --environment preview | ||
|
|
||
| - uses: elastic/docs-builder/.github/actions/aws-auth@main | ||
|
|
||
| - name: Upload assembled docs to S3 | ||
| id: s3-upload | ||
| env: | ||
| AWS_RETRY_MODE: standard | ||
| AWS_MAX_ATTEMPTS: 6 | ||
| run: | | ||
| aws s3 sync .artifacts/assembly/${ASSEMBLER_PREVIEW_PATH_PREFIX} "s3://elastic-docs-v3-website-preview/${ASSEMBLER_PREVIEW_PATH_PREFIX}" --delete --no-follow-symlinks | ||
| aws cloudfront create-invalidation \ | ||
| --distribution-id EKT7LT5PM8RKS \ | ||
| --paths "/${ASSEMBLER_PREVIEW_PATH_PREFIX}" "/${ASSEMBLER_PREVIEW_PATH_PREFIX}/*" | ||
|
|
||
| - name: Update Deployment Status | ||
| if: always() && steps.deployment.outputs.result | ||
| uses: actions/github-script@v8 | ||
| with: | ||
| script: | | ||
| await github.rest.repos.createDeploymentStatus({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| deployment_id: ${{ steps.deployment.outputs.result }}, | ||
| state: "${{ steps.s3-upload.outcome == 'success' && 'success' || 'failure' }}", | ||
| environment_url: `https://docs-v3-preview.elastic.dev/${process.env.ASSEMBLER_PREVIEW_PATH_PREFIX}`, | ||
| log_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ public class LlmMarkdownExporter : IMarkdownExporter | |
|
|
||
| public async ValueTask<bool> FinishExportAsync(IDirectoryInfo outputFolder, Cancel ctx) | ||
| { | ||
| var outputDirectory = Path.Combine(outputFolder.FullName, "docs"); | ||
| var outputDirectory = outputFolder.FullName; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We expose llm.zip on elastic.co so I think this needs to be put under docs again. |
||
| var zipPath = Path.Combine(outputDirectory, "llm.zip"); | ||
|
|
||
| // Create the llms.txt file with boilerplate content | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.