Skip to content

Commit 27df4cf

Browse files
authored
Add eui-deploy-docs pipeline to build and deploy new documentation website (#8569)
1 parent a39d7dc commit 27df4cf

File tree

4 files changed

+72
-8
lines changed

4 files changed

+72
-8
lines changed

.buildkite/pipelines/deploy_docs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
agents:
2+
provider: gcp
3+
# 4 AMD Rome / Milan vCPUs, 16GB RAM
4+
machineType: 'n2d-standard-4'
5+
# No spot instances to protect against agent losses during file upload
6+
preemptible: false
7+
8+
steps:
9+
- label: ':docusaurus: Build and deploy documentation website'
10+
image: "family/eui-ubuntu-2204"
11+
timeout_in_minutes: 90
12+
command: .buildkite/scripts/pipelines/pipeline_deploy_new_docs.sh

.buildkite/pipelines/pipeline_pull_request_deploy_docs.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,3 @@ steps:
66
agents:
77
provider: "gcp"
88
if: build.branch != "main" # We don't want to deploy docs on main, only on manual release
9-
- command: .buildkite/scripts/pipelines/pipeline_deploy_new_docs.sh
10-
label: ":docusaurus: Build and deploy new documentation website"
11-
agents:
12-
provider: gcp
13-
machineType: "n2-standard-2"
14-
image: "family/eui-ubuntu-2204"
15-
if: build.branch != "main"

.buildkite/scripts/pipelines/pipeline_deploy_new_docs.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ if [[ -n "${BUILDKITE_PULL_REQUEST}" ]] && [[ "${BUILDKITE_PULL_REQUEST}" != "fa
2020
export STORYBOOK_BASE_URL="https://eui.elastic.co/${PR_SLUG}/storybook"
2121
bucket_directory="${PR_SLUG}/new-docs/"
2222
echo "Detected a PR preview environment configuration. The built files will be copied to ${bucket_directory}"
23+
elif [[ -n "${BUILDKITE_BRANCH}" ]] && [[ "${BUILDKITE_BRANCH}" == "main" ]]; then
24+
# TODO: Detect if 'main' branch updated due to a new version being released based on BUILDKITE_TAG
25+
export STORYBOOK_BASE_URL="https://eui.elastic.co/storybook"
26+
bucket_directory="next/"
27+
echo "Detected a 'main' branch environment configuration. The built files will be copied to ${bucket_directory}"
2328
else
24-
echo "The script has been triggered with no pull request or tag information. This is a no-op."
29+
echo "The script has been triggered with no pull request or branch information. This is a no-op."
2530
exit 1
2631
fi
2732

@@ -67,3 +72,5 @@ echo "Beginning to copy built files to /${bucket_directory}"
6772
gcloud storage cp "${GCLOUD_CP_ARGS[@]}" packages/website/build/* "gs://${GCLOUD_BUCKET_FULL}/${bucket_directory}"
6873

6974
echo "New documentation website deployed: https://eui.elastic.co/${bucket_directory}" | buildkite-agent annotate --style "success" --context "deployed"
75+
76+
echo "* [Documentation website](https://eui.elastic.co/${bucket_directory})" | buildkite-agent meta-data set pr_comment:docs_deployment_link:head

catalog-info.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ spec:
125125
# Pull request - deploy docs website PR preview
126126
##
127127

128+
# TODO: Remove when the old documentation site is replaced with EUI+
129+
128130
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
129131
apiVersion: backstage.io/v1alpha1
130132
kind: Resource
@@ -342,6 +344,56 @@ spec:
342344
everyone:
343345
access_level: READ_ONLY
344346

347+
---
348+
##
349+
# buildkite-pipeline-eui-deploy-docs
350+
# Pull request - run tests and deploy docs website PR preview
351+
##
352+
353+
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/e57ee3bed7a6f73077a3f55a38e76e40ec87a7cf/rre.schema.json
354+
apiVersion: backstage.io/v1alpha1
355+
kind: Resource
356+
metadata:
357+
name: buildkite-pipeline-eui-deploy-docs
358+
description: EUI pipeline to deploy the documentation website
359+
links: [
360+
{
361+
title: "EUI - deploy-docs",
362+
url: "https://buildkite.com/elastic/eui-deploy-docs",
363+
}
364+
]
365+
366+
spec:
367+
type: buildkite-pipeline
368+
owner: group:eui-team
369+
system: buildkite
370+
implementation:
371+
apiVersion: buildkite.elastic.dev/v1
372+
kind: Pipeline
373+
metadata:
374+
name: eui-deploy-docs
375+
spec:
376+
repository: elastic/eui
377+
pipeline_file: ".buildkite/pipelines/deploy_docs.yml"
378+
default_branch: main
379+
env:
380+
ELASTIC_PR_COMMENTS_ENABLED: 'true'
381+
cancel_intermediate_builds: true
382+
# Prevent cancelling builds from 'main' to avoid cancellations during file upload
383+
cancel_intermediate_builds_branch_filter: "!main"
384+
provider_settings:
385+
build_branches: true
386+
build_pull_requests: true
387+
build_tags: false
388+
filter_enabled: true
389+
# Allow PRs and 'main' branch updates
390+
filter_condition: (build.pull_request.id != null || build.branch == "main")
391+
teams:
392+
eui-team:
393+
access_level: MANAGE_BUILD_AND_READ
394+
everyone:
395+
access_level: READ_ONLY
396+
345397
---
346398
##
347399
# buildkite-pipeline-eui-usage-analytics

0 commit comments

Comments
 (0)