Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions .github/workflows/update_kibana_dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Update Kibana dependencies

on:
schedule:
- cron: '0 3 * * 1-5'
pull_request:
types: [labeled]
workflow_dispatch:
Expand Down Expand Up @@ -35,10 +37,12 @@ on:
jobs:
release:
name: Create snapshot release
if: ${{ github.event_name != 'pull_request' || github.event.label.name == 'ci:regression-integration-test-kibana' }}
if: >-
(github.event_name != 'pull_request' || github.event.label.name == 'ci:regression-integration-test-kibana') &&
(github.event_name != 'schedule' || github.repository == 'elastic/eui')
uses: ./.github/workflows/release.yml
with:
release_ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || inputs.release_ref }}
release_ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || inputs.release_ref || github.sha }}
type: snapshot
dry_run: false

Expand Down
40 changes: 39 additions & 1 deletion .github/workflows/update_kibana_dependencies__open_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ jobs:
base_repo='elastic/kibana'
head_repo='elastic/eui-kibana'

# Reuse an existing open PR for this head branch if one exists. Nightly
# runs push to a fixed branch, so the PR should be updated (via the
# force-push), not duplicated.
existing_pr_url="$(gh api "repos/$base_repo/pulls?state=open&head=elastic:$PR_HEAD" --jq '.[0].html_url // ""')"
if [[ -n "$existing_pr_url" ]]; then
echo "pr_url=$existing_pr_url" >> "$GITHUB_OUTPUT"
{
echo "### Pull request updated"
echo ""
echo "$existing_pr_url"
} >> "$GITHUB_STEP_SUMMARY"
exit 0
fi

base_repo_id="$(gh api "repos/$base_repo" --jq .node_id)"
head_repo_id="$(gh api "repos/$head_repo" --jq .node_id)"

Expand Down Expand Up @@ -266,7 +280,6 @@ jobs:
needs: [open_pr, check_ci_status_1, check_ci_status_2]
if: |
always() &&
inputs.source_pr_number &&
(
(needs.check_ci_status_1.result == 'success' && needs.check_ci_status_2.result == 'skipped') ||
(needs.check_ci_status_1.result == 'failure' && needs.check_ci_status_2.result == 'skipped') ||
Expand Down Expand Up @@ -313,10 +326,35 @@ jobs:
fi
echo 'COMMENT_DELIMITER'
} >> "$GITHUB_OUTPUT"

# Plain-text variant for the Slack notification (nightly runs).
slack_text="*Kibana Regression Integration Test*"$'\n'"Status: $status"$'\n'"Branch: \`$PR_HEAD\`"$'\n'"Kibana PR: $KIBANA_PR_URL"
{
echo 'slack_text<<SLACK_DELIMITER'
echo "$slack_text"
echo 'SLACK_DELIMITER'
} >> "$GITHUB_OUTPUT"
- name: Add a comment
# Source-PR runs report back on the originating EUI PR.
if: ${{ inputs.source_pr_number }}
uses: ./.github/actions/pr_bot_comment
with:
gh_token: ${{ steps.ephemeral_token.outputs.token }}
pr_number: ${{ inputs.source_pr_number }}
marker: 'kibana-regression-integration-test'
comment_body: ${{ steps.compose_comment_body.outputs.comment_body }}
- name: Notify Slack
# Nightly runs have no source PR, so report to Slack instead.
if: ${{ !inputs.source_pr_number }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.KIBANA_NIGHTLY_SLACK_WEBHOOK }}
SLACK_TEXT: ${{ steps.compose_comment_body.outputs.slack_text }}
# language=bash
run: |
set -euo pipefail
if [[ -z "${SLACK_WEBHOOK_URL:-}" ]]; then
echo "::warning::KIBANA_NIGHTLY_SLACK_WEBHOOK is not set; skipping Slack notification"
exit 0
fi
payload="$(jq -n --arg text "$SLACK_TEXT" '{ text: $text }')"
curl -fsSL -X POST -H 'Content-type: application/json' --data "$payload" "$SLACK_WEBHOOK_URL"
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,17 @@ jobs:
git remote add fork https://github.com/elastic/eui-kibana.git
- name: Create new branch
id: git_branch
env:
SOURCE_PR_NUMBER: ${{ inputs.source_pr_number }}
# language=bash
run: |
branch_name="update-dependencies/$(date +%s)"
# Nightly runs (no source PR) reuse a single fixed branch so they don't
# accumulate stale branches/PRs. Per-PR runs keep a unique branch name.
if [[ -n "$SOURCE_PR_NUMBER" ]]; then
branch_name="update-dependencies/$(date +%s)"
else
branch_name="nightly/update-dependencies"
fi
git checkout -b "$branch_name"
echo "BRANCH_NAME=$branch_name" >> "$GITHUB_OUTPUT"
echo "::debug::Created branch '$branch_name'"
Expand Down Expand Up @@ -139,7 +147,9 @@ jobs:
GH_TOKEN: ${{ steps.fetch_ephemeral_token.outputs.token }}
BRANCH_NAME: ${{ steps.git_branch.outputs.BRANCH_NAME }}
# language=bash
run: git push -u fork "$BRANCH_NAME"
# Force-push so nightly runs can reuse the fixed branch. Per-PR runs use
# unique branch names, so the force flag is a no-op for them.
run: git push -u --force fork "$BRANCH_NAME"
- name: Trigger workflow to open PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading