Skip to content

Commit 6a9d08b

Browse files
mrodmclaude
andauthored
[CI] Add features/* branch support to changeset detection and publish pipeline (#18962)
Extend CI branch handling to treat feature/* branches the same as backport-* branches. Update docs/ci_pipelines.md to include feature/* branches. --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent ce0f52b commit 6a9d08b

4 files changed

Lines changed: 24 additions & 11 deletions

File tree

.buildkite/scripts/build_packages.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ skipPublishing() {
2727
return 1
2828
fi
2929

30+
# feature/* and other non-publishing branches fall through here
3031
return 0
3132
}
3233

.buildkite/scripts/common.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ platform_type_lowercase="${platform_type,,}"
1010

1111
SCRIPTS_BUILDKITE_PATH="${WORKSPACE}/.buildkite/scripts"
1212

13+
readonly LONG_RUNNING_BRANCH_PATTERN="^(backport-|feature/)"
14+
1315
export ELASTIC_PACKAGE_BIN=${WORKSPACE}/build/elastic-package
1416

1517
API_BUILDKITE_PIPELINES_URL="https://api.buildkite.com/v2/organizations/elastic/pipelines/"
@@ -639,14 +641,14 @@ get_from_changeset() {
639641
from="${BUILDKITE_COMMIT}^"
640642
fi
641643

642-
if [[ "${BUILDKITE_BRANCH}" == "main" || ${BUILDKITE_BRANCH} =~ ^backport- ]]; then
644+
if [[ "${BUILDKITE_BRANCH}" == "main" || ${BUILDKITE_BRANCH} =~ ${LONG_RUNNING_BRANCH_PATTERN} ]]; then
643645
local previous_successful_commit
644646
previous_successful_commit=$(get_previous_successful_commit "${BUILDKITE_PIPELINE_SLUG}" "${BUILDKITE_BRANCH}")
645647

646648
from="${previous_successful_commit}"
647649
if [[ "${previous_successful_commit}" == "null" ]]; then
648-
if [[ "${BUILDKITE_BRANCH}" =~ ^backport- ]]; then
649-
# First push of a new backport branch: only CI infrastructure files
650+
if [[ "${BUILDKITE_BRANCH}" =~ ${LONG_RUNNING_BRANCH_PATTERN} ]]; then
651+
# First push of a new long-running branch (matches LONG_RUNNING_BRANCH_PATTERN): only CI infrastructure files
650652
# changed, no package code was modified — skip package testing.
651653
from="${BUILDKITE_COMMIT}"
652654
else
@@ -662,7 +664,7 @@ get_to_changeset() {
662664
# Changeset that triggered the build
663665
local to="${BUILDKITE_COMMIT}"
664666

665-
if [[ "${BUILDKITE_BRANCH}" == "main" || ${BUILDKITE_BRANCH} =~ ^backport- ]]; then
667+
if [[ "${BUILDKITE_BRANCH}" == "main" || ${BUILDKITE_BRANCH} =~ ${LONG_RUNNING_BRANCH_PATTERN} ]]; then
666668
to="origin/${BUILDKITE_BRANCH}"
667669
fi
668670
echo "${to}"

catalog-info.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ spec:
4242
name: integrations
4343
description: 'Pipeline for the Integrations project'
4444
spec:
45-
branch_configuration: "main backport-*"
45+
branch_configuration: "main backport-* feature/*"
4646
pipeline_file: ".buildkite/pipeline.yml"
4747
provider_settings:
4848
build_pull_request_forks: false
@@ -53,9 +53,9 @@ spec:
5353
build.pull_request.id == null || (build.creator.name == 'elasticmachine' && build.pull_request.id != null && build.source == 'api')
5454
repository: elastic/integrations
5555
cancel_intermediate_builds: true
56-
cancel_intermediate_builds_branch_filter: '!main !backport-*'
56+
cancel_intermediate_builds_branch_filter: '!main !backport-* !feature/*'
5757
skip_intermediate_builds: true
58-
skip_intermediate_builds_branch_filter: '!main !backport-*'
58+
skip_intermediate_builds_branch_filter: '!main !backport-* !feature/*'
5959
env:
6060
ELASTIC_PR_COMMENTS_ENABLED: 'true'
6161
teams:

docs/ci_pipelines.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Currently, there are five different pipelines:
1212

1313
## Pull Requests and pushes to specific branches
1414

15-
In every push to a Pull Request as well as commits to `main` or `backport-*` branches, this pipeline is triggered automatically: https://buildkite.com/elastic/integrations
15+
In every push to a Pull Request as well as commits to `main`, `backport-*`, or `feature/*` branches, this pipeline is triggered automatically: https://buildkite.com/elastic/integrations
1616

1717
This pipeline is in charge of testing the packages with a local Elastic stack.
1818

@@ -62,13 +62,13 @@ These environment variables can be defined in different locations:
6262
More details about this CI pipeline:
6363

6464
- Builds running in a Pull Request are canceled if a new commit is pushed to the PR branch.
65-
- Builds running from `main` or `backport-*` branches are finished even if new commits are merged.
65+
- Builds running from `main`, `backport-*`, or `feature/*` branches are finished even if new commits are merged.
6666
- As part of the Pull Requests, there are some benchmark files created and this data is pushed to the PR as a comment.
6767
- This CI pipeline tries to test the minimum packages possible::
6868
- In the Pull Request context, it is checked the files modified/added/deleted in the given PR:
6969
- Those packages with changes (`packages/*`) will be added to the list of packages to be tested.
70-
- If files outside `packages` folder are updated (e.g. `go.mod` , `.buildkite/*`), all packages are going to be tested. There are some exceptions to this, for instance the `.github/CODEOWNERS` file or `.docs/` folder ([files excluded](https://github.com/elastic/integrations/blob/376fc891a1e6c662b4ef1897b118044faf51e7bf/.buildkite/scripts/common.sh#L695)).
71-
- In branches context (`main` or `backport-*`):
70+
- If files outside `packages` folder are updated (for example `go.mod` , `.buildkite/*`), all packages are going to be tested. There are some exceptions to this, for instance the `.github/CODEOWNERS` file or `.docs/` folder ([files excluded](https://github.com/elastic/integrations/blob/376fc891a1e6c662b4ef1897b118044faf51e7bf/.buildkite/scripts/common.sh#L695)).
71+
- In branches context (`main`, `backport-*`, or `feature/*`):
7272
- The latest Buildkite build that finished successfully in that branch is retrieved, and all the file changes in the working copy between the changeset of that build and the merged commit are obtained.
7373
- Given all those changes, the packages selected to be tested follow the same rules as in the PR.
7474
- Container logs, as they could contain sensitive information, are uploaded to a private Google Bucket.
@@ -225,3 +225,13 @@ from the UI: https://buildkite.com/elastic/integrations-backport/
225225

226226
More information about this pipeline and how to create these hotfixes in:
227227
https://www.elastic.co/guide/en/integrations-developer/current/developer-workflow-support-old-package.html
228+
229+
## Feature branches
230+
231+
`feature/*` branches are long-lived branches used for developing larger features before merging into `main`. They follow the same CI process as Pull Requests, ensuring all checks pass before code is integrated.
232+
233+
- Every push to a `feature/*` branch triggers the main CI pipeline (https://buildkite.com/elastic/integrations), running the same package tests as a regular Pull Request.
234+
- Pull Requests targeting a `feature/*` branch also trigger CI checks, so all changes must pass CI before being merged into the feature branch.
235+
- Intermediate builds are cancelled or skipped when new commits arrive, consistent with `backport-*` branches.
236+
- Changeset detection works the same as for `backport-*` branches: only packages modified since the last successful build are tested. On the first push to a new `feature/*` branch, no package tests are run if only CI infrastructure files changed.
237+
- Publishing is **not** triggered for `feature/*` branches. Packages are published only when PRs are merged into `main` or `backport-*` branches.

0 commit comments

Comments
 (0)