Skip to content

[CI] UpgradeXpackClusterClientYamlTestSuiteIT test {upgradedNodes=1 yaml=mixed_cluster/90_ml_data_frame_analytics_crud/Start and stop old regression job} failing #5052

[CI] UpgradeXpackClusterClientYamlTestSuiteIT test {upgradedNodes=1 yaml=mixed_cluster/90_ml_data_frame_analytics_crud/Start and stop old regression job} failing

[CI] UpgradeXpackClusterClientYamlTestSuiteIT test {upgradedNodes=1 yaml=mixed_cluster/90_ml_data_frame_analytics_crud/Start and stop old regression job} failing #5052

name: Trigger test analysis
on:
issues:
types: [labeled]
permissions:
contents: read
issues: write
jobs:
trigger-test-analysis:
name: Trigger Buildkite test analysis pipeline
if: |
github.repository == 'elastic/elasticsearch' &&
contains(github.event.issue.labels.*.name, 'needs:risk') &&
contains(github.event.issue.labels.*.name, '>test-failure') &&
(
github.event.label.name == 'needs:risk' ||
github.event.label.name == '>test-failure' ||
startsWith(github.event.label.name, 'Team:')
)
concurrency:
group: test-analysis-${{ github.event.issue.number }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: Check if analysis was already triggered
id: check-processed
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
const reactionContent = 'eyes';
const reactions = await github.paginate(
github.rest.reactions.listForIssue,
{
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
}
);
const alreadyReacted = reactions.some(
(reaction) =>
reaction.content === reactionContent &&
reaction.user?.type === 'Bot'
);
if (alreadyReacted) {
core.info(`Issue #${issue.number} already has a :${reactionContent}: reaction from a bot; skipping analysis`);
}
core.setOutput('alreadyProcessed', alreadyReacted);
- name: Determine team-based analysis config
id: team-config
if: steps.check-processed.outputs.alreadyProcessed != 'true'
uses: actions/github-script@v7
with:
script: |
// Teams that do NOT want the analysis posted as an issue comment.
// Every other team gets the comment by default.
const ANALYSIS_COMMENT_OPTOUT_TEAMS = ['Team:Analytics'];
// Labels that want the `needs:risk` triage label updated based on
// the analysis result. Every other team is left untouched.
const TRIAGE_LABEL_OPTIN = [];
const issueLabels = context.payload.issue.labels.map((label) => label.name);
const commentOptedOut = issueLabels.some((label) => ANALYSIS_COMMENT_OPTOUT_TEAMS.includes(label));
const labelUpdateOptedIn = issueLabels.some((label) => TRIAGE_LABEL_OPTIN.includes(label));
core.setOutput('reportToPr', !commentOptedOut);
core.setOutput('updateNeedsRiskLabel', labelUpdateOptedIn);
- name: Trigger Buildkite pipeline
if: steps.check-processed.outputs.alreadyProcessed != 'true'
env:
BUILDKITE_API_TOKEN: ${{ secrets.BUILDKITE_API_TOKEN }}
ISSUE_URL: ${{ github.event.issue.html_url }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
REPORT_TO_PR: ${{ steps.team-config.outputs.reportToPr }}
UPDATE_NEEDS_RISK_LABEL: ${{ steps.team-config.outputs.updateNeedsRiskLabel }}
run: |
set -euo pipefail
DRY_RUN=$(jq -n --argjson report "$REPORT_TO_PR" '$report | not')
BODY=$(jq -n \
--arg url "$ISSUE_URL" \
--arg title "$ISSUE_TITLE" \
--arg num "$ISSUE_NUMBER" \
--argjson report "$REPORT_TO_PR" \
--argjson dryRun "$DRY_RUN" \
--argjson updateLabel "$UPDATE_NEEDS_RISK_LABEL" \
'{
branch: "main",
commit: "HEAD",
message: ("Risk analysis for #" + $num + ": " + $title),
env: {
ISSUE_URL: $url,
WORKFLOW: "test-analysis",
REPORT_TO_PR: ($report | tostring),
DRY_RUN: ($dryRun | tostring),
UPDATE_NEEDS_RISK_LABEL: ($updateLabel | tostring)
}
}')
curl --fail --silent --show-error \
--request POST \
--url "https://api.buildkite.com/v2/organizations/elastic/pipelines/elasticsearch-agentic-workflow/builds" \
--header "Authorization: Bearer ${BUILDKITE_API_TOKEN}" \
--header "Content-Type: application/json" \
--data "$BODY"
- name: "Mark issue as processed (:eyes: reaction)"
if: steps.check-processed.outputs.alreadyProcessed != 'true'
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
const reactionContent = 'eyes';
await github.rest.reactions.createForIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
content: reactionContent,
});
core.info(`Added :${reactionContent}: reaction to issue #${issue.number}`);