Skip to content

[CI] Add branch filtering logic to DRA trigger pipeline #127308

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

Merged
merged 1 commit into from
May 5, 2025
Merged
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
28 changes: 26 additions & 2 deletions .buildkite/scripts/dra-workflow.trigger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,34 @@

set -euo pipefail

echo "steps:"

source .buildkite/scripts/branches.sh

# We use that filtering to keep different schedule for different branches
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need this. isn't that only used for triggering a DRA build from an intake? If we have something to commit to 7.17, we might want to keep building DRA artifacts immediately?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scratch that.

if [ -n "${INCLUDED_BRANCHES:-}" ]; then
# If set, only trigger the pipeline for the specified branches
IFS=',' read -r -a BRANCHES <<< "${INCLUDED_BRANCHES}"
elif [ -n "${EXCLUDED_BRANCHES:-}" ]; then
# If set, listed branches will be excluded from the list of branches in branches.json
IFS=',' read -r -a EXCLUDED_BRANCHES <<< "${EXCLUDED_BRANCHES}"
FILTERED_BRANCHES=()
for BRANCH in "${BRANCHES[@]}"; do
EXCLUDE=false
for EXCLUDED_BRANCH in "${EXCLUDED_BRANCHES[@]}"; do
if [ "$BRANCH" == "$EXCLUDED_BRANCH" ]; then
EXCLUDE=true
break
fi
done
if [ "$EXCLUDE" = false ]; then
FILTERED_BRANCHES+=("$BRANCH")
fi
done
BRANCHES=("${FILTERED_BRANCHES[@]}")
fi


echo "steps:"

for BRANCH in "${BRANCHES[@]}"; do
INTAKE_PIPELINE_SLUG="elasticsearch-intake"
BUILD_JSON=$(curl -sH "Authorization: Bearer ${BUILDKITE_API_TOKEN}" "https://api.buildkite.com/v2/organizations/elastic/pipelines/${INTAKE_PIPELINE_SLUG}/builds?branch=${BRANCH}&state=passed&per_page=1" | jq '.[0] | {commit: .commit, url: .web_url}')
Expand Down