Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
2df0710
[backports] Add .backports.yml inventory and bootstrap script (#19210)
mrodm May 29, 2026
c864a16
[backports] Improve base_commit resolution in bootstrap and regenerat…
mrodm May 29, 2026
d0336af
[backports] Further improve base_commit resolution; regenerate inventory
github-actions[bot] May 29, 2026
cc6346d
Initial list of backports
github-actions[bot] Jun 2, 2026
f5089b7
Re-order entries
github-actions[bot] Jun 2, 2026
b708b96
Update script to try to handle all scenarios
github-actions[bot] Jun 2, 2026
d941937
[backports] Note manual corrections in .backports.yml header comment
github-actions[bot] Jun 2, 2026
534fbb8
[backports] Add backport_check_active.sh and tests (#19210)
github-actions[bot] Jun 2, 2026
85523c6
[backports] Simplify check-active script with yq; fix test cleanup
github-actions[bot] Jun 2, 2026
d9e05a9
[backports] Validate yq is installed in backport_check_active.sh
github-actions[bot] Jun 2, 2026
42048a5
[backports] Add Go inventory validator, mage target, and CI step (#19…
github-actions[bot] Jun 2, 2026
0c4698a
[backports] Copy dev/backports/ folder into new backport branches
github-actions[bot] Jun 2, 2026
ce009ee
[backports] Add backports paths to non_package_patterns in common.sh …
github-actions[bot] Jun 2, 2026
b1f1cc6
[backports] Only run inventory validation step when relevant files ch…
github-actions[bot] Jun 2, 2026
3a40a7e
[backports] Add check_backports_inventory.sh script and use GCP agent…
github-actions[bot] Jun 2, 2026
6718cfb
[backports] Use LINUX_AGENT_IMAGE for check-backports-inventory step
github-actions[bot] Jun 2, 2026
05274f6
[backports] Use t.TempDir() in inventory test helper
github-actions[bot] Jun 2, 2026
0c34bf0
[backports] Add explicit CODEOWNERS entry for .backports.yml (#19210)
github-actions[bot] Jun 2, 2026
ea3a4fd
[backports] Add check_backports_inventory.sh to non_package_patterns
github-actions[bot] Jun 2, 2026
99ec6bf
[backports] Wire integrations-backport dry-run trigger on .backports.…
github-actions[bot] Jun 2, 2026
4b91e99
[backports] Explain base_commit comparison logic in trigger_backport_…
github-actions[bot] Jun 2, 2026
b0f9a53
[backports] Fix temp file leak and remove dead variable (code review)
github-actions[bot] Jun 2, 2026
454c7ac
[backports] Pin mage working directory to WORKSPACE in check_backport…
github-actions[bot] Jun 2, 2026
d803643
[backports] Block dry-run trigger on inventory validation passing
github-actions[bot] Jun 2, 2026
a4dd077
[backports] Validate base_version (semver), base_commit (hex SHA), an…
github-actions[bot] Jun 2, 2026
03f4b78
[backports] Validate backport branch name format
github-actions[bot] Jun 2, 2026
6a09283
[backports] Only trigger dry-run for new inventory entries
github-actions[bot] Jun 2, 2026
514e4b1
[backports] Harden and clarify trigger_backport_dryrun.sh
github-actions[bot] Jun 2, 2026
65f0990
Merge upstream/main into initial-backports-file
github-actions[bot] Jun 3, 2026
2f8571a
[backports] Extract backport_check_active.sh tests into own file
github-actions[bot] Jun 3, 2026
305099c
[backports] Fix code review issues in trigger and test runner
github-actions[bot] Jun 3, 2026
956747b
Test with a subset of packages - to be reverted
github-actions[bot] Jun 3, 2026
35e57d8
[backports] Skip dry-run trigger when .backports.yml is new on base b…
github-actions[bot] Jun 3, 2026
382ecdb
Fix linting
github-actions[bot] Jun 3, 2026
9152481
Fix errors in CI builds
github-actions[bot] Jun 3, 2026
a704c18
Test triggering dry-run build - to be reverted
github-actions[bot] Jun 3, 2026
9dbedde
Add an empty backports list - to be reverted
github-actions[bot] Jun 3, 2026
72ff7c6
Add condition to the trigger backport dry-run step
github-actions[bot] Jun 3, 2026
6ad8428
Test with PR branch
github-actions[bot] Jun 3, 2026
9ca6828
Update if condition in backport pipeline
github-actions[bot] Jun 3, 2026
3a3c25f
Update conditions in pipeline-backport
github-actions[bot] Jun 3, 2026
aeb87cb
Test other source branch for backport script - to be reverted
github-actions[bot] Jun 3, 2026
7b30533
[backports] Validate duplicate branch names and package/version pairs
github-actions[bot] Jun 4, 2026
2a1d58a
[backports] Refactor ValidateInventory into focused helper functions
github-actions[bot] Jun 4, 2026
4bea349
Update archive keys for entries
github-actions[bot] Jun 4, 2026
dcbbab2
Remove debugging
github-actions[bot] Jun 4, 2026
58215a1
Remove entry for backports file in codeowners
github-actions[bot] Jun 4, 2026
f60e65e
[backports] Migrate backport_check_active.sh to Go
github-actions[bot] Jun 4, 2026
f237dd0
Revert "Remove debugging"
github-actions[bot] Jun 4, 2026
1436a4e
Install mage in script
github-actions[bot] Jun 4, 2026
da0a5a0
Test an archived package
github-actions[bot] Jun 5, 2026
3e36fd9
Sync with latest backport branch created
github-actions[bot] Jun 5, 2026
c45d060
Remove debugging
github-actions[bot] Jun 5, 2026
d7fa665
Update archived value for backport aws 2.30
github-actions[bot] Jun 5, 2026
9ca3737
Ensure that trigger backport-dry-run just happens with PRs targeting …
github-actions[bot] Jun 5, 2026
23c6012
Add the same validation in script
github-actions[bot] Jun 5, 2026
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
437 changes: 437 additions & 0 deletions .backports.yml

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions .buildkite/pipeline.backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ steps:
- label: "Check that it runs from UI"
key: "check-ui"
command:
- "buildkite-agent annotate \"The $BUILDKITE_PIPELINE_SLUG is used only for running from UI!\" --style 'warning'"
- "buildkite-agent annotate \"The $BUILDKITE_PIPELINE_SLUG is used only for running from UI or a trigger step!\" --style 'warning'"
- "exit 1"
if: "build.source != 'ui'"
if: |
!(
build.source == 'ui' ||
(build.source == 'trigger_job' && build.env('BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG') == 'integrations')
)

# Ensure that the check-ui step runs before any other step
- wait: ~

- input: "Input values for the variables"
key: "input-variables"
if: "build.source != 'trigger_job'"
fields:
- select: "DRY_RUN"
key: "DRY_RUN"
Expand Down
26 changes: 26 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,32 @@ steps:
key: "check-dev-scripts"
command: ".buildkite/scripts/run_dev_scripts_tests.sh"

- label: ":ballot_box_with_check: Backports inventory validation"
key: "check-backports-inventory"
command: ".buildkite/scripts/check_backports_inventory.sh"
agents:
image: "${LINUX_AGENT_IMAGE}"
if_changed:
- ".backports.yml"
- ".buildkite/scripts/run_dev_scripts_tests.sh"
- "dev/scripts/**.sh"
- "dev/backports/**"

- label: ":git: Trigger backport dry-runs"
key: "trigger-backport-dryrun"
command: ".buildkite/scripts/trigger_backport_dryrun.sh"
agents:
image: "${LINUX_AGENT_IMAGE}"
depends_on:
- step: "check-backports-inventory"
allow_failure: false
if_changed:
- ".backports.yml"
if: |
build.env('BUILDKITE_PULL_REQUEST') != "false" &&
build.env('BUILDKITE_PIPELINE_SLUG') == "integrations" &&
build.env('BUILDKITE_PULL_REQUEST_BASE_BRANCH') == "main"

- label: ":junit: Sources Junit annotate"
agents:
# requires at least "bash", "curl" and "git"
Expand Down
15 changes: 8 additions & 7 deletions .buildkite/scripts/backport_branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ updateBackportBranchContents() {
local COVERAGE_SCRIPTS_FOLDER="dev/coverage"
local CODEOWNERS_SCRIPTS_FOLDER="dev/codeowners"
local PACKAGENAMES_SCRIPTS_FOLDER="dev/packagenames"
local BACKPORTS_SCRIPTS_FOLDER="dev/backports"
local DEV_SCRIPTS_FOLDER="dev/scripts"

if git ls-tree -d --name-only main:${MAGEFILE_SCRIPTS_FOLDER} > /dev/null 2>&1 ; then
Expand All @@ -193,13 +194,13 @@ updateBackportBranchContents() {
git checkout "$SOURCE_BRANCH" -- "${PACKAGENAMES_SCRIPTS_FOLDER}"
git add "${PACKAGENAMES_SCRIPTS_FOLDER}"

if git ls-tree -d --name-only "${SOURCE_BRANCH}:${DEV_SCRIPTS_FOLDER}" > /dev/null 2>&1; then
echo "Copying $DEV_SCRIPTS_FOLDER from $SOURCE_BRANCH..."
git checkout "$SOURCE_BRANCH" -- "${DEV_SCRIPTS_FOLDER}"
git add "${DEV_SCRIPTS_FOLDER}"
else
echo "Skipping $DEV_SCRIPTS_FOLDER (not found on $SOURCE_BRANCH)"
fi
echo "Copying $BACKPORTS_SCRIPTS_FOLDER from $SOURCE_BRANCH..."
git checkout "$SOURCE_BRANCH" -- "${BACKPORTS_SCRIPTS_FOLDER}"
git add "${BACKPORTS_SCRIPTS_FOLDER}"

echo "Copying $DEV_SCRIPTS_FOLDER from $SOURCE_BRANCH..."
git checkout "$SOURCE_BRANCH" -- "${DEV_SCRIPTS_FOLDER}"
git add "${DEV_SCRIPTS_FOLDER}"

echo "Copying magefile.go from $SOURCE_BRANCH..."
git checkout "$SOURCE_BRANCH" -- "magefile.go"
Expand Down
15 changes: 15 additions & 0 deletions .buildkite/scripts/check_backports_inventory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

source .buildkite/scripts/common.sh

set -euo pipefail

add_bin_path
with_mage
with_yq

echo "--- Validate .backports.yml inventory schema"
mage -d "${WORKSPACE}" -v validateBackportsInventory

echo "--- Check if any files modified"
check_git_diff
6 changes: 5 additions & 1 deletion .buildkite/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,16 @@ is_pr_affected() {
# Same for ".buildkite/scripts/packages/.+.sh": this pattern must not be added to "skip_ci_on_only_changed" to allow triggering the tests of the given package.
local non_package_patterns=(
'packages/'
'\.backports\.yml'
'\.buildkite/pipeline\.backport\.yml'
'\.buildkite/pipeline\.publish\.yml'
'\.buildkite/pipeline\.schedule-daily\.yml'
'\.buildkite/pipeline\.schedule-weekly\.yml'
'\.buildkite/pipeline\.serverless\.yml'
'\.buildkite/pull-requests\.json'
'\.buildkite/scripts/backport_branch\.sh'
'\.buildkite/scripts/check_backports_inventory\.sh'
'\.buildkite/scripts/trigger_backport_dryrun\.sh'
'\.buildkite/scripts/build_packages\.sh'
'\.buildkite/scripts/check_changelog_entries\.sh'
'\.buildkite/scripts/packages/.+\.sh'
Expand All @@ -804,6 +807,7 @@ is_pr_affected() {
'\.agents/skills/'
'catalog-info\.yaml'
'docs/'
'dev/backports/'
'dev/scripts/'
'CODE_OF_CONDUCT\.md'
'CONTRIBUTING\.md'
Expand Down Expand Up @@ -917,7 +921,7 @@ teardown_test_package() {

# list all directories that are packages from the root of the repository
list_all_directories() {
mage -d "${WORKSPACE}" listPackages
mage -d "${WORKSPACE}" listPackages |grep "^packages/elastic_package_registry$"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

To be removed before merging.
Keep it for now in case it is needed to push more changes.

}

check_package() {
Expand Down
11 changes: 1 addition & 10 deletions .buildkite/scripts/run_dev_scripts_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,5 @@ set -euo pipefail

REPO_ROOT="$(git rev-parse --show-toplevel)"

run_tests_if_exists() {
local script="$1"
if [[ ! -f "${script}" ]]; then
echo "Skipping ${script} (file not found)"
return 0
fi
"${script}"
}

echo "=== Running get_release_commit.sh tests ==="
run_tests_if_exists "${REPO_ROOT}/dev/scripts/test_get_release_commit.sh"
bash "${REPO_ROOT}/dev/scripts/test_get_release_commit.sh"
131 changes: 131 additions & 0 deletions .buildkite/scripts/trigger_backport_dryrun.sh

@mrodm mrodm Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This will trigger a DRY_RUN build of the integrations-backport for each new entry detected.

For this first time, it has been set that it will not trigger any build. This is detected when in the main branch there is no .backports.yml file.

It has also been set in the .buildkite/pipeline.yml file that this step is just triggered in Pull Requests targeting main brnach.

    if_changed:
      - ".backports.yml"
    if: |
      build.env('BUILDKITE_PULL_REQUEST') != "false" &&
      build.env('BUILDKITE_PIPELINE_SLUG') == "integrations" &&
      build.env('BUILDKITE_PULL_REQUEST_BASE_BRANCH') == "main"

Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/bin/bash
# Triggered from the main pipeline when .backports.yml changes in a PR.
# For each entry that is new (absent from the base branch), uploads a trigger
# step that runs the integrations-backport pipeline in DRY_RUN mode.

source .buildkite/scripts/common.sh

set -euo pipefail

if [[ "${BUILDKITE_PULL_REQUEST}" == "false" ]]; then
echo "Not a pull request, skipping backport dry-run trigger"
exit 0
fi

if [[ "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}" != "main" ]]; then
echo "Pull request does not target main (base branch: ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}), skipping backport dry-run trigger"
exit 0
fi

add_bin_path
with_yq
with_mage

from="$(get_from_changeset)"
to="$(get_to_changeset)"
commit_merge="$(git merge-base "${from}" "${to}")"

if ! git diff --name-only "${commit_merge}" "${to}" | grep -qE '^\.backports\.yml$'; then
echo ".backports.yml not changed, skipping backport dry-run trigger"
exit 0
fi

echo "--- .backports.yml changed — finding new entries"

BASE_BRANCH="${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"

OLD_INVENTORY=""
PIPELINE_FILE=""

cleanup() {
local exit_code=$?
[[ -n "${OLD_INVENTORY}" ]] && rm -f "${OLD_INVENTORY}"
[[ -n "${PIPELINE_FILE}" ]] && rm -f "${PIPELINE_FILE}"
exit "${exit_code}"
}
trap cleanup EXIT

OLD_INVENTORY="$(mktemp)"
NEW_INVENTORY=".backports.yml"

if ! git show "origin/${BASE_BRANCH}:.backports.yml" > "${OLD_INVENTORY}" 2>/dev/null; then
echo ".backports.yml is new on ${BASE_BRANCH} — skipping dry-runs for initial entries"
echo "To validate new entries, add them in a follow-up PR after this one merges."
exit 0
fi

if ! yq -e '.backports' "${OLD_INVENTORY}" > /dev/null; then
echo "ERROR: old inventory is not valid YAML or missing 'backports' key: ${OLD_INVENTORY}"
exit 1
fi

if ! yq -e '.backports' "${NEW_INVENTORY}" > /dev/null; then
echo "ERROR: new inventory is not valid YAML or missing 'backports' key: ${NEW_INVENTORY}"
exit 1
fi

PIPELINE_FILE="$(mktemp --suffix=.yml)"
entries_found=0

while IFS= read -r branch; do
entry=".backports[] | select(.branch == \"${branch}\")"

active_exit=0
mage CheckBackportBranchActive "${branch}" || active_exit=$?
if [[ "${active_exit}" -eq 2 ]]; then
echo "ERROR: failed to check active status for branch '${branch}'"
exit 1
fi
if [[ "${active_exit}" -ne 0 ]]; then
echo " Skipping inactive entry: ${branch}"
continue
fi

# Only trigger for entries that are new (absent from the old inventory).
# If the entry already existed, the git branch is already created; there is
# nothing to provision. This also covers re-activating a previously archived
# entry (archived:true → false): the branch exists, so no dry-run is needed.
old_branch="$(yq "${entry} | .branch" "${OLD_INVENTORY}")"

if [[ -n "${old_branch}" ]]; then
echo " Skipping existing entry: ${branch} (already present in base branch)"
continue
fi

pkg="$(yq "${entry} | .package" "${NEW_INVENTORY}")"
base_version="$(yq "${entry} | .base_version" "${NEW_INVENTORY}")"
base_commit="$(yq "${entry} | .base_commit" "${NEW_INVENTORY}")"

echo " Queuing dry-run: ${branch} (package=${pkg} version=${base_version} base_commit=${base_commit})"

if [[ "${entries_found}" -eq 0 ]]; then
printf 'steps:\n' > "${PIPELINE_FILE}"
fi

cat >> "${PIPELINE_FILE}" <<EOF
- label: ":git: Backport dry-run: ${branch}"
trigger: "integrations-backport"
build:
env:
DRY_RUN: "true"
PACKAGE_NAME: "${pkg}"
PACKAGE_VERSION: "${base_version}"
BASE_COMMIT: "${base_commit}"
EOF

entries_found=$(( entries_found + 1 ))

done < <(yq '.backports[].branch' "${NEW_INVENTORY}")

rm -f "${OLD_INVENTORY}"

if [[ "${entries_found}" -eq 0 ]]; then
echo "No new non-archived entries found, skipping dry-run trigger"
rm -f "${PIPELINE_FILE}"
exit 0
fi

echo "--- Uploading ${entries_found} dry-run trigger(s)"
cat "${PIPELINE_FILE}"
buildkite-agent pipeline upload "${PIPELINE_FILE}"
rm -f "${PIPELINE_FILE}"
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -612,4 +612,4 @@
/packages/zscaler_zia @elastic/security-service-integrations @elastic/sit-crest-contractors
/packages/zscaler_zpa @elastic/security-service-integrations @elastic/sit-crest-contractors
/packages/otel_rum_dashboards @elastic/apm-agent-rum
/packages/otel_android_dashboards @elastic/apm-agent-android @elastic/apm-agent-approvers
/packages/otel_android_dashboards @elastic/apm-agent-android @elastic/apm-agent-approvers
Loading
Loading