Skip to content

Commit 057d3d7

Browse files
Merge branch 'elastic:main' into main
2 parents 2d45ac9 + b02ce61 commit 057d3d7

150 files changed

Lines changed: 4325 additions & 2958 deletions

File tree

Some content is hidden

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

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,32 @@ on:
2727
description: "[Custom releases only] npm tag to use"
2828
required: false
2929
type: string
30+
workflow_call:
31+
inputs:
32+
release_ref:
33+
description: Upstream git ref to create the release from
34+
required: true
35+
type: string
36+
type:
37+
description: Release type - snapshot or official
38+
required: true
39+
type: string
40+
workspaces:
41+
description: A comma-separated list of workspaces to release
42+
required: false
43+
type: string
44+
dry_run:
45+
description: Dry run (do not publish the packages)
46+
required: true
47+
type: boolean
48+
npm_tag:
49+
description: "[Custom releases only] npm tag to use"
50+
required: false
51+
type: string
52+
outputs:
53+
published_packages_json:
54+
description: A JSON-formatted list of published packages and their versions
55+
value: ${{ jobs.resolver.outputs.published_packages_json }}
3056

3157
permissions:
3258
id-token: write # Required for OIDC
@@ -76,6 +102,8 @@ jobs:
76102
runs-on: ubuntu-latest
77103
if: ${{ inputs.type == 'snapshot' }}
78104
needs: [ lint_and_unit_tests, cypress_tests ]
105+
outputs:
106+
published_packages_json: ${{ steps.published_packages_info.outputs.json }}
79107
steps:
80108
- uses: actions/checkout@v4
81109
with:
@@ -131,11 +159,20 @@ jobs:
131159
result-encoding: string
132160
- name: Release
133161
run: yarn release run snapshot --skip-prompts --skip-auth-check --use-auth-token --allow-custom ${{ inputs.dry_run && '--dry-run' || ''}} ${{ steps.prepare_npm_tag_arg.outputs.result }} ${{ steps.prepare_workspaces_arg.outputs.result }}
162+
- name: Output published packages info
163+
id: published_packages_info
164+
# language=bash
165+
run: |
166+
# minify JSON content for easier handling
167+
file_content=$(jq -c . .release/published_packages.json)
168+
echo "json=$file_content" >> "$GITHUB_OUTPUT"
134169
release_official:
135170
name: Create an official release
136171
runs-on: ubuntu-latest
137172
if: ${{ inputs.type == 'official' }}
138173
needs: [ lint_and_unit_tests, cypress_tests ]
174+
outputs:
175+
published_packages_json: ${{ steps.published_packages_info.outputs.json }}
139176
steps:
140177
- uses: actions/checkout@v4
141178
with:
@@ -195,3 +232,27 @@ jobs:
195232
result-encoding: string
196233
- name: Release
197234
run: yarn release run official --skip-prompts --skip-auth-check --use-auth-token --allow-custom --skip-update-versions ${{ inputs.dry_run && '--dry-run' || ''}} ${{ steps.prepare_npm_tag_arg.outputs.result }} ${{ steps.prepare_workspaces_arg.outputs.result }}
235+
- name: Output published packages info
236+
id: published_packages_info
237+
# language=bash
238+
run: |
239+
# minify JSON content for easier handling
240+
file_content=$(jq -c . .release/published_packages.json)
241+
echo "json=$file_content" >> "$GITHUB_OUTPUT"
242+
resolver:
243+
name: Resolve outputs
244+
needs: [release_snapshot, release_official]
245+
runs-on: ubuntu-latest
246+
outputs:
247+
published_packages_json: ${{ steps.resolver.outputs.published_packages.json }}
248+
if: |
249+
always() &&
250+
(needs.release_snapshot.result == 'success' || needs.release_snapshot.result == 'skipped') &&
251+
(needs.release_official.result == 'success' || needs.release_official.result == 'skipped')
252+
steps:
253+
- id: resolver
254+
run: |
255+
PUBLISHED_PACKAGES_JSON_SNAPSHOT="${{ needs.release_snapshot.outputs.published_packages_json }}"
256+
PUBLISHED_PACKAGES_JSON_OFFICIAL="${{ needs.release_official.outputs.published_packages_json }}"
257+
258+
echo "json=${PUBLISHED_PACKAGES_JSON_SNAPSHOT:-$PUBLISHED_PACKAGES_JSON_OFFICIAL}" >> "$GITHUB_OUTPUT"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Update Kibana dependencies
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dependencies:
7+
description: JSON-serialized map of dependencies to update
8+
type: string
9+
required: true
10+
pr_title:
11+
description: PR title
12+
default: Update EUI dependencies
13+
type: string
14+
pr_body:
15+
description: PR body
16+
type: string
17+
default: ''
18+
workflow_call:
19+
inputs:
20+
dependencies:
21+
description: JSON-serialized map of dependencies to update
22+
type: string
23+
required: true
24+
pr_title:
25+
description: PR title
26+
default: Update EUI dependencies
27+
type: string
28+
pr_body:
29+
description: PR body
30+
type: string
31+
default: ''
32+
outputs:
33+
pr_url:
34+
description: 'URL of the created pull request'
35+
value: ${{ jobs.open_pr.outputs.pr_url }}
36+
37+
jobs:
38+
prepare_changes:
39+
name: Prepare changes
40+
uses: ./.github/workflows/update_kibana_dependencies__prepare_changes.yml
41+
with:
42+
dependencies: ${{ inputs.dependencies }}
43+
open_pr:
44+
name: Open PR
45+
needs: [prepare_changes]
46+
uses: ./.github/workflows/update_kibana_dependencies__open_pr.yml
47+
with:
48+
pr_head: eui-kibana:${{ needs.prepare_changes.outputs.branch_name }}
49+
pr_title: ${{ inputs.pr_title }}
50+
pr_body: ${{ inputs.pr_body }}
51+
pr_draft: true
52+
pr_labels: 'EUI,backport:skip,release_note:skip'
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: 'Update Kibana dependencies - Open PR'
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
pr_head:
6+
description: HEAD ref
7+
required: true
8+
type: string
9+
pr_title:
10+
description: Title of the PR
11+
required: true
12+
type: string
13+
pr_body:
14+
description: Body of the PR
15+
type: string
16+
pr_draft:
17+
description: Whether the PR should be marked as draft
18+
type: boolean
19+
default: true
20+
pr_labels:
21+
description: Comma-separated list of labels to add to the PR
22+
type: string
23+
default: 'EUI,backport:skip,release_note:skip'
24+
workflow_call:
25+
inputs:
26+
pr_head:
27+
description: HEAD ref
28+
required: true
29+
type: string
30+
pr_title:
31+
description: Title of the PR
32+
required: true
33+
type: string
34+
pr_body:
35+
description: Body of the PR
36+
type: string
37+
pr_draft:
38+
description: Whether the PR should be marked as draft
39+
type: boolean
40+
pr_labels:
41+
description: Comma-separated list of labels to add to the PR
42+
type: string
43+
outputs:
44+
pr_url:
45+
description: 'URL of the created pull request'
46+
value: ${{ jobs.open_pr.outputs.pr_url }}
47+
48+
permissions:
49+
id-token: write
50+
51+
jobs:
52+
open_pr:
53+
name: Open PR
54+
runs-on: ubuntu-latest
55+
outputs:
56+
pr_url: ${{ steps.open_pr.outputs.pr_url }}
57+
steps:
58+
- name: Fetch GitHub token
59+
id: ephemeral_token
60+
uses: elastic/ci-gh-actions/fetch-github-token@v1.5.0
61+
with:
62+
vault-instance: ci-prod
63+
vault-role: token-policy-6becee3e5a43
64+
- name: Open PR
65+
id: open_pr
66+
env:
67+
GH_TOKEN: ${{ steps.ephemeral_token.outputs.token }}
68+
PR_HEAD: ${{ inputs.pr_head }}
69+
PR_TITLE: ${{ inputs.pr_title }}
70+
PR_BODY: ${{ inputs.pr_body }}
71+
PR_DRAFT: ${{ inputs.pr_draft }}
72+
PR_LABELS: ${{ inputs.pr_labels }}
73+
# language=bash
74+
run: |
75+
args=(
76+
--repo "elastic/kibana"
77+
--head "$PR_HEAD"
78+
--title "$PR_TITLE"
79+
--body "$PR_BODY"
80+
)
81+
82+
if [[ "$PR_DRAFT" == "true" ]]; then
83+
args+=(--draft)
84+
fi
85+
86+
if [[ -n "$PR_LABELS" ]]; then
87+
args+=(--label "$PR_LABELS")
88+
fi
89+
90+
stderr_file="$(mktemp)"
91+
trap 'rm -f "$stderr_file"' EXIT
92+
93+
# Create PR
94+
exit_code=0
95+
pr_url="$(gh pr create "${args[@]}" 2>"$stderr_file")" || exit_code=$?
96+
97+
stderr_content="$(cat "$stderr_file")"
98+
[[ -n "$stderr_content" ]] && printf '%s\n' "$stderr_content" >&2
99+
100+
if [[ "$exit_code" -eq 0 ]]; then
101+
echo "pr_url=$pr_url" >> "$GITHUB_OUTPUT"
102+
{
103+
echo "### Pull request created"
104+
echo ""
105+
echo "$pr_url"
106+
} >> "$GITHUB_STEP_SUMMARY"
107+
else
108+
{
109+
echo "### Failed to create pull request"
110+
echo ""
111+
echo "Exit code: \`$exit_code\`"
112+
echo "Check the job output for error details"
113+
} >> "$GITHUB_STEP_SUMMARY"
114+
exit "$exit_code"
115+
fi
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: 'Update Kibana dependencies - Prepare changes'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dependencies:
7+
description: JSON-serialized map of dependencies to update
8+
type: string
9+
required: true
10+
workflow_call:
11+
inputs:
12+
dependencies:
13+
description: JSON-serialized map of dependencies to update
14+
type: string
15+
required: true
16+
outputs:
17+
branch_name:
18+
description: Name of the branch created in the elastic/eui-kibana repository
19+
value: ${{ jobs.update.outputs.branch_name }}
20+
21+
permissions:
22+
id-token: write
23+
24+
jobs:
25+
update:
26+
name: Prepare changes
27+
runs-on: ubuntu-latest
28+
outputs:
29+
branch_name: ${{ steps.git_branch.outputs.BRANCH_NAME }}
30+
steps:
31+
- name: Verify dependencies input
32+
env:
33+
DEPENDENCIES: ${{ inputs.dependencies }}
34+
# language=bash
35+
run: |
36+
num_deps=$(jq 'map(select(has("name") and has("version"))) | length' <<< "$DEPENDENCIES") || exit_code=$?
37+
if [[ "$exit_code" -ne 0 ]]; then
38+
echo "::error::Invalid dependencies input"
39+
exit 2
40+
elif [[ "$num_deps" -eq 0 ]]; then
41+
echo "::warning::No dependencies to update"
42+
exit 1
43+
else
44+
echo "$num_deps dependencies to update"
45+
fi
46+
- name: Checkout the upstream elastic/kibana repository
47+
uses: actions/checkout@v6
48+
with:
49+
repository: elastic/kibana
50+
fetch-depth: 1
51+
persist-credentials: false # We use different credentials for other git operations
52+
- name: Setup Node
53+
uses: actions/setup-node@v6
54+
with:
55+
node-version-file: .nvmrc
56+
package-manager-cache: false # Don't cache anything as it's a different repository
57+
- name: Fetch ephemeral GitHub token
58+
id: fetch_ephemeral_token
59+
uses: elastic/ci-gh-actions/fetch-github-token@v1.5.0
60+
with:
61+
vault-instance: ci-prod
62+
vault-role: token-policy-4fabc48bd03f
63+
- name: Configure git
64+
env:
65+
GH_TOKEN: ${{ steps.fetch_ephemeral_token.outputs.token }}
66+
# language=bash
67+
run: |
68+
gh auth setup-git
69+
git config --global user.name 'github-actions[bot]'
70+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
71+
git remote add fork https://github.com/elastic/eui-kibana.git
72+
- name: Create new branch
73+
id: git_branch
74+
# language=bash
75+
run: |
76+
branch_name="update-dependencies/$(date +%s)"
77+
git checkout -b "$branch_name"
78+
echo "BRANCH_NAME=$branch_name" >> "$GITHUB_OUTPUT"
79+
echo "::debug::Created branch '$branch_name'"
80+
- name: Update dependency versions
81+
env:
82+
DEPENDENCIES: ${{ inputs.dependencies }}
83+
# language=bash
84+
run: |
85+
jq -j '.[] | .name, "\u0000", .version, "\u0000"' <<< "$DEPENDENCIES" |
86+
xargs -0 -n 2 bash -c '
87+
pkg="$0"
88+
ver="$1"
89+
if [[ $(npm pkg get "devDependencies.$pkg") != "{}" ]]; then
90+
npm pkg set "devDependencies.$pkg=$ver"
91+
elif [[ $(npm pkg get "dependencies.$pkg") != "{}" ]]; then
92+
npm pkg set "dependencies.$pkg=$ver"
93+
else
94+
echo "::warning::Skipping $pkg: Not found in either dependencies or devDependencies";
95+
fi'
96+
- name: Run Kibana bootstrap scripts
97+
# language=bash
98+
run: yarn kbn bootstrap
99+
- name: Commit changed files
100+
# language=bash
101+
run: |
102+
git add package.json yarn.lock src/platform/packages/private/kbn-ui-shared-deps-npm/version_dependencies.txt
103+
git commit -m "chore: update dependencies"
104+
- name: Push branch to elastic/eui-kibana
105+
env:
106+
GH_TOKEN: ${{ steps.fetch_ephemeral_token.outputs.token }}
107+
BRANCH_NAME: ${{ steps.git_branch.outputs.BRANCH_NAME }}
108+
# language=bash
109+
run: git push -u fork "$BRANCH_NAME"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ WARP.md
3838

3939
# Build artifacts
4040
package.tgz
41+
42+
# Release metadata directory
43+
.release

0 commit comments

Comments
 (0)