File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change 22
33set -euo pipefail
44
5- echo " steps:"
6-
75source .buildkite/scripts/branches.sh
86
7+ # We use that filtering to keep different schedule for different branches
8+ if [ -n " ${INCLUDED_BRANCHES:- } " ]; then
9+ # If set, only trigger the pipeline for the specified branches
10+ IFS=' ,' read -r -a BRANCHES <<< " ${INCLUDED_BRANCHES}"
11+ elif [ -n " ${EXCLUDED_BRANCHES:- } " ]; then
12+ # If set, listed branches will be excluded from the list of branches in branches.json
13+ IFS=' ,' read -r -a EXCLUDED_BRANCHES <<< " ${EXCLUDED_BRANCHES}"
14+ FILTERED_BRANCHES=()
15+ for BRANCH in " ${BRANCHES[@]} " ; do
16+ EXCLUDE=false
17+ for EXCLUDED_BRANCH in " ${EXCLUDED_BRANCHES[@]} " ; do
18+ if [ " $BRANCH " == " $EXCLUDED_BRANCH " ]; then
19+ EXCLUDE=true
20+ break
21+ fi
22+ done
23+ if [ " $EXCLUDE " = false ]; then
24+ FILTERED_BRANCHES+=(" $BRANCH " )
25+ fi
26+ done
27+ BRANCHES=(" ${FILTERED_BRANCHES[@]} " )
28+ fi
29+
30+
31+ echo " steps:"
32+
933for BRANCH in " ${BRANCHES[@]} " ; do
1034 INTAKE_PIPELINE_SLUG=" elasticsearch-intake"
1135 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}' )
You can’t perform that action at this time.
0 commit comments