Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3d60ccf
[ML] Automate patch version bump in CI pipeline
edsavage Apr 30, 2026
fc81aef
[ML] Version bump Slack: test banner + optional skip DRA wait
edsavage Apr 30, 2026
0fad7e0
[ML] TEMP: allow version-bump pipeline on PR test branch
edsavage May 1, 2026
d337984
[ML] Remove temp version-bump branch filter from patch bump PR
edsavage May 1, 2026
f133adc
[ML] Trim bump_version.sh: drop .backportrc.json handling
edsavage May 1, 2026
00b04b6
[ML] Trim version-bump smoke hooks; keep DRY_RUN
edsavage May 1, 2026
b17a4b9
[ML] Add git push --dry-run auth probe for version bump pipeline
edsavage May 1, 2026
9eb99ee
[ML] Add skeleton GHA workflow for patch version bump
edsavage May 1, 2026
003c4c1
[ML] TEMP: log Vault GitHub app permissions in bump probe
edsavage May 3, 2026
1acb334
[ML] Remove temporary GitHub App permissions probe from bump script
edsavage May 3, 2026
8127a6b
[ML] Version bump validation, pytest, and dev-tools CI step
edsavage May 4, 2026
d4c873a
[ML] Remove redundant test_validate_version_bump_local.sh
edsavage May 4, 2026
cf2f76c
[ML] Add opt-in git-fetch integration tests for version bump validation
edsavage May 4, 2026
6c0cf80
[ML] Add temporary empty-commit probe to version-bump git auth step
edsavage May 4, 2026
a2efe35
[ML] Remove temporary commit probe; tidy version bump pipeline PR
edsavage May 4, 2026
3d2f70b
[ML] Drop run-patch-release workflow (no GitHub App secrets)
edsavage May 4, 2026
16d18b7
[ML] Version bump pipeline: patch-only validation, CI probes, DRY_RUN…
edsavage May 5, 2026
65afdf7
[ML] Version bump via GitHub PR; optional DRA wait after merge
edsavage May 5, 2026
d798689
[ML] Restore DRA wait step in version bump pipeline (after PR merge)
edsavage May 5, 2026
f1a8e15
[ML] Use GitHub CLI for version-bump PRs with gh auto-install
edsavage May 5, 2026
1c71c5b
[ML] Fix gh pr merge for older Wolfi CLI (no --yes flag)
edsavage May 5, 2026
b656f63
[ML] Default version-bump PR merge to squash (no merge commits on repo)
edsavage May 5, 2026
d8f1434
[ML] Opt-in gh pr merge --admin for protected-branch rule bypass
edsavage May 5, 2026
e8e8a2e
[ML] Enable GitHub auto-merge for version bump PRs
edsavage May 6, 2026
bb9a80b
[ML] Remove git push dry-run step from version-bump pipeline
edsavage May 6, 2026
c440424
[ML] Skip DRA wait when version bump is a no-op
edsavage May 6, 2026
de045a5
[ML] Skip Slack and bump steps when validate detects no-op
edsavage May 6, 2026
cef9d96
[ML] Fix version-bump pipeline: avoid build.meta_data in step if
edsavage May 6, 2026
cbebf1d
[ML] Notify Slack after version bump PR with approval link
edsavage May 6, 2026
5971824
[ML] Fix version bump: do not set empty Buildkite PR URL meta-data
edsavage May 6, 2026
0e760ef
[ML] Fix version-bump Slack: use Wolfi agent image and harden notify …
edsavage May 6, 2026
9293f24
[ML] Version bump Slack: use step notify so message sends without wai…
edsavage May 6, 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
83 changes: 83 additions & 0 deletions .buildkite/job-version-bump-phase2.json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env python
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License
# 2.0 and the following additional limitation. Functionality enabled by the
# files subject to the Elastic License 2.0 may only be used in production when
# invoked by an Elasticsearch process with a license key installed that permits
# use of machine learning features. You may not use this file except in
# compliance with the Elastic License 2.0 and the foregoing additional
# limitation.
#
# Phase 2 of the ml-cpp version-bump pipeline (uploaded by
# dev-tools/version_bump_upload_phase2.sh after validate). Step-level `if` cannot
# use Buildkite meta-data; gating is done in that shell script instead.

import contextlib
import json
import os


WOLFI_IMAGE = "docker.elastic.co/release-eng/wolfi-build-essential-release-eng:latest"


def main():
pipeline_steps = [
{
"label": "Bump version to ${NEW_VERSION}",
"key": "bump-version",
"depends_on": "schedule-version-bump-follow-up",
"agents": {
"image": WOLFI_IMAGE,
"cpu": "250m",
"memory": "512Mi",
},
"env": {
"VERSION_BUMP_MERGE_AUTO": os.environ.get("VERSION_BUMP_MERGE_AUTO", "true"),
},
"command": [
"dev-tools/bump_version.sh",
],
},
{
"label": "Notify :slack: — version bump PR needs approval",
"key": "queue-slack-notify",
"depends_on": "bump-version",
"command": [
".buildkite/pipelines/send_slack_version_bump_notification.sh",
],
"agents": {
# Same image as bump-version: the minimal python image does not ship
# buildkite-agent, so meta-data get / pipeline upload silently skipped Slack.
"image": WOLFI_IMAGE,
"cpu": "250m",
"memory": "512Mi",
},
},
{
"label": "Fetch DRA Artifacts",
"key": "fetch-dra-artifacts",
"depends_on": "queue-slack-notify",
"agents": {
"image": WOLFI_IMAGE,
"cpu": "250m",
"memory": "512Mi",
"ephemeralStorage": "1Gi",
},
"command": [
"python3",
"dev-tools/wait_version_bump_dra.py",
],
"timeout_in_minutes": 240,
"retry": {
"automatic": [{"exit_status": "*", "limit": 2}],
"manual": {"permit_on_passed": True},
},
},
]

print(json.dumps({"steps": pipeline_steps}, indent=2))


if __name__ == "__main__":
with contextlib.suppress(KeyboardInterrupt):
main()
85 changes: 24 additions & 61 deletions .buildkite/job-version-bump.json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,50 @@
# compliance with the Elastic License 2.0 and the foregoing additional
# limitation.
#
# This script generates JSON for the ml-cpp version bump pipeline.
# It is intended to be triggered by the centralized release-eng pipeline.
# It can be integrated into existing or new workflows and includes a plugin
# that polls artifact URLs until the expected version is available.

# Phase 1 of the ml-cpp version bump pipeline (dynamic upload from release-eng).
#
# Buildkite step `if` expressions cannot use build meta-data (see
# https://buildkite.com/docs/pipelines/conditionals ). validate_version_bump_params.sh
# sets ml_cpp_version_bump_noop when origin already matches NEW_VERSION; phase 2
# (Slack, bump, DRA wait) is uploaded only when needed by
# dev-tools/version_bump_upload_phase2.sh.

import contextlib
import json


WOLFI_IMAGE = "docker.elastic.co/release-eng/wolfi-build-essential-release-eng:latest"


def main():
pipeline = {}
# TODO: replace the block step with version bump logic
pipeline_steps = [
{
"label": "Queue a :slack: notification for the pipeline",
"label": "Validate version bump parameters",
"key": "validate-version-bump",
"depends_on": None,
"command": ".buildkite/pipelines/send_version_bump_notification.sh | buildkite-agent pipeline upload",
"agents": {
"image": "python",
},
},
{
"block": "Ready to fetch for DRA artifacts?",
"prompt": (
"Unblock when your team is ready to proceed.\n\n"
"Trigger parameters:\n"
"- NEW_VERSION: ${NEW_VERSION}\n"
"- BRANCH: ${BRANCH}\n"
"- WORKFLOW: ${WORKFLOW}\n"
),
"key": "block-get-dra-artifacts",
"blocked_state": "running",
},
{
"label": "Fetch DRA Artifacts",
"key": "fetch-dra-artifacts",
"depends_on": "block-get-dra-artifacts",
"agents": {
"image": "docker.elastic.co/release-eng/wolfi-build-essential-release-eng:latest",
"image": WOLFI_IMAGE,
"cpu": "250m",
"memory": "512Mi",
"ephemeralStorage": "1Gi",
},
"command": [
'echo "Starting DRA artifacts retrieval..."',
"dev-tools/validate_version_bump_params.sh",
],
"timeout_in_minutes": 240,
"retry": {
"automatic": [
{
"exit_status": "*",
"limit": 2,
}
],
"manual": {"permit_on_passed": True},
},
{
"label": "Schedule version bump follow-up steps",
"key": "schedule-version-bump-follow-up",
"depends_on": "validate-version-bump",
"agents": {
"image": "python",
},
"plugins": [
{
"elastic/json-watcher#v1.0.0": {
"url": "https://artifacts-staging.elastic.co/ml-cpp/latest/${BRANCH}.json",
"field": ".version",
"expected_value": "${NEW_VERSION}",
"polling_interval": "30",
}
},
{
"elastic/json-watcher#v1.0.0": {
"url": "https://storage.googleapis.com/elastic-artifacts-snapshot/ml-cpp/latest/${BRANCH}.json",
"field": ".version",
"expected_value": "${NEW_VERSION}-SNAPSHOT",
"polling_interval": "30",
}
},
"command": [
"dev-tools/version_bump_upload_phase2.sh",
],
},
]

pipeline["steps"] = pipeline_steps

print(json.dumps(pipeline, indent=2))
print(json.dumps({"steps": pipeline_steps}, indent=2))


if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipelines/format_and_validation.yml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ steps:
notify:
- github_commit_status:
context: "Validate formatting with clang-format"

- label: "dev-tools pytest"
key: "dev_tools_pytest"
command: ".buildkite/scripts/steps/dev_tools_pytest.sh"
Expand Down
77 changes: 77 additions & 0 deletions .buildkite/pipelines/send_slack_version_bump_notification.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the Elastic License
# 2.0 and the following additional limitation. Functionality enabled by the
# files subject to the Elastic License 2.0 may only be used in production when
# invoked by an Elasticsearch process with a license key installed that permits
# use of machine learning features. You may not use this file except in
# compliance with the Elastic License 2.0 and the foregoing additional
# limitation.
#
# Single Slack notification for the ml-cpp-version-bump pipeline: runs after the
# bump step opens the PR. Reads ml_cpp_version_bump_pr_url from Buildkite meta-data
# (set by dev-tools/bump_version.sh) and posts the PR link so reviewers can approve.
#
# Slack notify must live on the step (see Buildkite docs): build-level notify fires only
# on build.finished — after every downstream step including long DRA waits — so the
# message would appear hours late or never if someone checks earlier.
#
# Optional env:
# ML_CPP_VERSION_BUMP_SLACK_CHANNEL — override channel (default #machine-learn-build)

set -euo pipefail

CHANNEL="${ML_CPP_VERSION_BUMP_SLACK_CHANNEL:-#machine-learn-build}"

if [[ "${BUILDKITE:-}" != "true" ]]; then
echo "BUILDKITE is not true — skipping Slack notification (local run)."
exit 0
fi

if ! command -v buildkite-agent >/dev/null 2>&1; then
echo "ERROR: buildkite-agent not in PATH; cannot read meta-data or upload Slack notify pipeline." >&2
echo "Use the same agent image as bump-version (Wolfi), not a minimal python image." >&2
exit 1
fi

pr_url=""
changed="false"
pr_url=$(buildkite-agent meta-data get "ml_cpp_version_bump_pr_url" 2>/dev/null || true)
changed=$(buildkite-agent meta-data get "ml_cpp_version_bump_changed" 2>/dev/null || echo "false")
# Meta-data values must not contain stray whitespace (Breaks truthiness.)
pr_url=$(echo -n "${pr_url}" | tr -d '\r')
changed=$(echo -n "${changed}" | tr -d '\r')

if [[ -z "${pr_url}" && "${changed}" != "true" ]]; then
echo "No version-bump PR opened (pr_url empty, ml_cpp_version_bump_changed=${changed}); skipping Slack notification."
exit 0
fi

if [[ -z "${pr_url}" && "${changed}" == "true" ]]; then
body_line="DRY RUN — no pull request URL (simulated bump)."
else
body_line="Pull request (approval required): ${pr_url}"
fi

(
cat <<EOF
steps:
- label: "Schedule :slack: notification (version bump)"
command: "echo schedule :slack: notification"
notify:
- slack:
channels:
- "${CHANNEL}"
message: |
**Version bump PR — approval required**
${body_line}
Branch: \${BUILDKITE_BRANCH}
NEW_VERSION: \${NEW_VERSION:-"(unset)"}
BRANCH (param): \${BRANCH:-"(unset)"}
VERSION_BUMP_MERGE_AUTO: \${VERSION_BUMP_MERGE_AUTO:-"(unset)"}
DRY_RUN: \${DRY_RUN:-"(unset)"}
Pipeline: \${BUILDKITE_BUILD_URL}
Build: \${BUILDKITE_BUILD_NUMBER}
Please review and approve this pull request so it can merge (subject to branch protection).
EOF
) | buildkite-agent pipeline upload
2 changes: 0 additions & 2 deletions .buildkite/pipelines/send_version_bump_notification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ notify:
:large_green_circle: Version bump pipeline waiting for approval
Branch: \${BUILDKITE_BRANCH}
New version: \${NEW_VERSION}
Workflow: \${WORKFLOW}
Pipeline: \${BUILDKITE_BUILD_URL}
if: build.state == "blocked"
- slack:
Expand All @@ -33,6 +32,5 @@ notify:
Version bump pipeline finished (${BUILDKITE_BUILD_URL})
Branch: \${BUILDKITE_BRANCH}
New version: \${NEW_VERSION}
Workflow: \${WORKFLOW}
if: build.state != "blocked"
EOL
Loading