Skip to content
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

[OAS] Publish OAS bundles to bump.sh #197482

Merged
merged 42 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2c10eaa
first iteration: wip
jloleysens Oct 23, 2024
0d7653c
updated sh
jloleysens Oct 23, 2024
7646b79
comment
jloleysens Oct 24, 2024
3b01ee4
a fix and more logging
jloleysens Oct 24, 2024
58b6c9c
update copy
jloleysens Oct 24, 2024
1799a0e
variable
jloleysens Oct 24, 2024
93c7d9b
use vault!
jloleysens Oct 24, 2024
f9bea42
updated script after tests
jloleysens Oct 24, 2024
0f3034d
update package lock
jloleysens Oct 24, 2024
78237aa
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Oct 25, 2024
5bbfd9a
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Oct 28, 2024
f921f70
install bump sh in step only and remove from package.json
jloleysens Oct 28, 2024
2a4a86f
Revert "install bump sh in step only and remove from package.json"
jloleysens Oct 28, 2024
b861b28
install deps
jloleysens Oct 28, 2024
342067c
echo
jloleysens Oct 28, 2024
97ae62f
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Oct 29, 2024
c09a7bb
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Oct 30, 2024
d72bdc4
push to 8x-unreleased and add some more logs
jloleysens Oct 31, 2024
512d13e
use npx
jloleysens Oct 31, 2024
7d3e03a
do not break on-merge pipeline
jloleysens Oct 31, 2024
99a9191
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 1, 2024
a2bdc89
new bump-cli version
jloleysens Nov 4, 2024
a766a61
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 4, 2024
84b42aa
package-lock.json
jloleysens Nov 4, 2024
6538002
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 4, 2024
4107c59
do overlays when capturing OAS in final merge
jloleysens Nov 5, 2024
20d93ff
fix comment
jloleysens Nov 5, 2024
58bc49d
vuln link
jloleysens Nov 5, 2024
7c0b56e
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 5, 2024
6b1518d
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine Nov 5, 2024
07d7808
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 6, 2024
6e6aff1
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine Nov 6, 2024
9eb56c1
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 8, 2024
34f2fdb
move to other folder
jloleysens Nov 8, 2024
b5d9bc5
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine Nov 8, 2024
2aec5a3
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 11, 2024
f3f0c15
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 12, 2024
0f73589
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 12, 2024
d07f158
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine Nov 12, 2024
1e2389a
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 13, 2024
3161661
[CI] Auto-commit changed files from 'make api-docs'
kibanamachine Nov 13, 2024
4de95f7
Merge branch 'main' into oas/ci-to-publish-oas
jloleysens Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .buildkite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .buildkite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
"#pipeline-utils": "./pipeline-utils/index.ts",
"#pipeline-utils/*": "./pipeline-utils/*"
}
}
}
14 changes: 14 additions & 0 deletions .buildkite/pipelines/on_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,20 @@ steps:
- exit_status: '-1'
limit: 3

- command: .buildkite/scripts/steps/publish_oas_docs.sh
label: 'Publish OAS docs to bump.sh'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
preemptible: true
timeout_in_minutes: 60
retry:
automatic:
- exit_status: '-1'
limit: 3

- command: .buildkite/scripts/steps/storybooks/build_and_upload.sh
label: 'Build Storybooks'
agents:
Expand Down
47 changes: 47 additions & 0 deletions .buildkite/scripts/steps/publish_oas_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

set -euo pipefail

source .buildkite/scripts/common/util.sh

## Install the bump CLI for just this step
npm install -g bump-cli@^2.8.2
jloleysens marked this conversation as resolved.
Show resolved Hide resolved
jloleysens marked this conversation as resolved.
Show resolved Hide resolved

echo "--- Publish OAS docs"

deploy_to_bump() {
local file_path="${1:-}"
local doc_name="${2:-}"
local doc_token="${3:-}"
local branch="${4:-}"

echo "Checking diff for doc '$doc_name' against file '$file_path'..."
local result=$(bump diff $file_path --doc $doc_name --token $doc_token --branch $branch --format=json)
## Bump.sh does not respond with JSON when the diff is empty so we need to handle possibly not JSON :'(
jloleysens marked this conversation as resolved.
Show resolved Hide resolved
local change_count=$(tr '\n' ' '<<<$result | jq -R 'fromjson? | length')
if [[ ! -z $change_count && $change_count -gt 0 ]]; then
echo "Found $change_count changes..."
echo "About to deploy file '$file_path' to doc '$doc_name' on bump.sh..."
bump deploy $file_path \
--branch $branch \
--doc $doc_name \
--token $doc_token ;
echo ""
echo "Note: if there is a warning of unchanged docs we probably have unpublished deployments waiting."
echo "Go to https://bump.sh/elastic/dashboard to see all the docs in the hub."
else
echo "Did not detect changes for '$file_path'; not deploying. Got response: $result"
fi
}

if [[ "$BUILDKITE_BRANCH" == "main" ]]; then
BUMP_KIBANA_DOC_NAME="$(vault_get kibana-bump-sh kibana-doc-name)"
BUMP_KIBANA_DOC_TOKEN="$(vault_get kibana-bump-sh kibana-token)"
deploy_to_bump oas_docs/output/kibana.yaml $BUMP_KIBANA_DOC_NAME $BUMP_KIBANA_DOC_TOKEN main;
fi

if [[ "$BUILDKITE_BRANCH" == "8.x" ]]; then
lcawl marked this conversation as resolved.
Show resolved Hide resolved
BUMP_KIBANA_DOC_NAME="$(vault_get kibana-bump-sh kibana-doc-name)"
BUMP_KIBANA_DOC_TOKEN="$(vault_get kibana-bump-sh kibana-token)"
deploy_to_bump oas_docs/output/kibana.yaml $BUMP_KIBANA_DOC_NAME $BUMP_KIBANA_DOC_TOKEN v8;
fi