Skip to content

Version bump idempotency - #21555

Open
ninalee12 wants to merge 9 commits into
elastic:mainfrom
ninalee12:version-bump-idempotency
Open

Version bump idempotency#21555
ninalee12 wants to merge 9 commits into
elastic:mainfrom
ninalee12:version-bump-idempotency

Conversation

@ninalee12

@ninalee12 ninalee12 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Motivation/summary

Often we re-trigger the version bump pipeline, which re-invokes the release workflow. Without idempotency checks, this would run the release steps again, re-creating the release branch or opening duplicate bump PRs. This PR adds checks to skip the release steps if they've already run.

How to test these changes

Hard to test without triggering an actual release.

We can test the commands

For the branch check (minor):

git ls-remote --exit-code --heads https://github.com/elastic/apm-server.git 9.5

Should return exit code 0 and print the ref

For the PR check (minor):

gh pr list --head "update-9.5.0" --base main --label release --state all --json number --jq 'length' --repo elastic/apm-server

For the PR check (patch), find a real past patch PR to verify:

gh pr list --head "update-9.4.1" --base "9.4" --label release --state all --json number --jq 'length' --repo elastic/apm-server

Related issues

fr4nc1sc0-r4m0n and others added 3 commits July 3, 2026 12:14
Merge duplicate major/minor branch checks into a single step with
release-type-specific error messaging.
Align branch existence validation with the tag check step.
@github-actions

Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify

mergify Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

This pull request does not have a backport label. Could you fix it @ninalee12? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8.19 is the label to automatically backport to the 8.19 branch.
  • backport-9./d is the label to automatically backport to the 9./d branch. /d is the digit.
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

Comment thread .github/workflows/prepare-release/action.yml Outdated
Comment thread .github/workflows/prepare-release/action.yml Outdated
@ninalee12
ninalee12 marked this pull request as ready for review July 22, 2026 16:29
@ninalee12
ninalee12 requested review from a team as code owners July 22, 2026 16:29
@ninalee12
ninalee12 requested a review from v1v July 22, 2026 16:29
Comment thread release.mk Outdated
@ninalee12
ninalee12 requested a review from v1v July 23, 2026 20:27

@v1v v1v left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

I've just ran this PR locally:

$ gh pr checkout 21555
$ GITHUB_TOKEN=$(gh auth token) make minor-release RELEASE_VERSION=9.0.0 PROJECT_OWNER=v1v RELEASE_TYPE=minor
$ GITHUB_TOKEN=$(gh auth token) make minor-release RELEASE_VERSION=9.4.0 PROJECT_OWNER=v1v RELEASE_TYPE=minor
INFO: Create GitHub label backport for the version 9.4.0
::group::create-github-label backport-9.4
✓ Label "backport-9.4" created in v1v/apm-server
::endgroup::
INFO: Create release branch and update new version 9.4.0
::group::create-branch 9.4
Switched to branch 'main'
Your branch is ahead of 'origin/main' by 320 commits.
  (use "git push" to publish your local commits)
Switched to a new branch '9.4'
::endgroup::
>> update-version
>> update-version-makefile
::group::git-diff
diff --git a/Makefile b/Makefile
index 652a9576a..1206b5a97 100644
--- a/Makefile
+++ b/Makefile
@@ -227,7 +227,7 @@ testing/infra/terraform/modules/%/README.md: .FORCE
 # Beats synchronisation.
 ##############################################################################
 
-BEATS_VERSION?=main
+BEATS_VERSION?=9.4
 BEATS_MODULE:=github.com/elastic/beats/v7
 
 .PHONY: update-beats
diff --git a/cmd/intake-receiver/version.go b/cmd/intake-receiver/version.go
index d96214af7..6ed99d39b 100644
--- a/cmd/intake-receiver/version.go
+++ b/cmd/intake-receiver/version.go
@@ -18,4 +18,4 @@
 package main
 
 // version matches the APM Server's version
-const version = "9.5.0"
+const version = "9.4.0"
diff --git a/internal/version/version.go b/internal/version/version.go
index 22e70c288..b0c38c11f 100644
--- a/internal/version/version.go
+++ b/internal/version/version.go
@@ -18,4 +18,4 @@
 package version
 
 // Version holds the APM Server version.
-const Version = "9.5.0"
+const Version = "9.4.0"
::endgroup::
::group::create-commit
 M Makefile
 M cmd/intake-receiver/version.go
 M internal/version/version.go
?? Makefile.bck
?? cmd/intake-receiver/version.go.bck
?? internal/version/version.go.bck
[9.4 d163a850d] [Release] update version 9.4.0
 6 files changed, 435 insertions(+), 3 deletions(-)
 create mode 100644 Makefile.bck
 create mode 100644 cmd/intake-receiver/version.go.bck
 create mode 100644 internal/version/version.go.bck
::endgroup::
INFO: Create feature branch and update the versions. Target branch main
::group::create-branch update-9.4.0
Switched to branch 'main'
Your branch is ahead of 'origin/main' by 320 commits.
  (use "git push" to publish your local commits)
Switched to a new branch 'update-9.4.0'
::endgroup::
>> update-mergify
::warn::Mergify already contains backport-9.4
>> update-version
::group::git-diff
::endgroup::
::group::create-commit
?? cmd/intake-receiver/version.go.bck
?? internal/version/version.go.bck
[update-9.4.0 cf9d60ab5] [Release] update version 9.5.0
 2 files changed, 42 insertions(+)
 create mode 100644 cmd/intake-receiver/version.go.bck
 create mode 100644 internal/version/version.go.bck
::endgroup::
>> update-changelog
>> updating changelog for 9.4.0
::group::git-diff
diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md
index 63543e3cb..42c0ab09c 100644
--- a/docs/release-notes/breaking-changes.md
+++ b/docs/release-notes/breaking-changes.md
@@ -21,7 +21,11 @@ Breaking changes can impact your Elastic applications, potentially disrupting no
 % **Action**<br> Steps for mitigating deprecation impact.
 % ::::
 
+## 9.4.0 [9-4-0]
+
 % Commenting 9.4.0 release notes until it is released
+_No breaking changes_ 
+
 % ## 9.4.0 [9-4-0] 
 
 % _No breaking changes_ 
diff --git a/docs/release-notes/deprecations.md b/docs/release-notes/deprecations.md
index 340f138ec..7515a20e4 100644
--- a/docs/release-notes/deprecations.md
+++ b/docs/release-notes/deprecations.md
@@ -18,7 +18,11 @@ Review the deprecated functionality for Elastic APM. While deprecations have no
 % **Action**<br> Steps for mitigating deprecation impact.
 % ::::
 
+## 9.4.0 [9-4-0]
+
 % Commenting 9.4.0 release notes until it is released
+_No deprecations_ 
+
 % ## 9.4.0 [9-4-0]
 
 % _No deprecations_ 
diff --git a/docs/release-notes/index.md b/docs/release-notes/index.md
index 3f5c70d9a..20ddd15ba 100644
--- a/docs/release-notes/index.md
+++ b/docs/release-notes/index.md
@@ -24,6 +24,18 @@ To check for security updates, go to [Security announcements for the Elastic sta
 % ### Fixes [apm-next-fixes]
 % * 1 sentence describing the change. ([#PR number](https://github.com/elastic/apm-server/pull/PR number))
 
+## 9.4.0 [apm-9.4.0-release-notes]
+
+% ### Features and enhancements [apm-9.4.0-features-enhancements]
+% * 1 sentence describing the change. ([#PR number](https://github.com/elastic/apm-server/pull/PR number))
+
+_No new features or enhancements_ 
+
+% ### Fixes [apm-9.4.0-fixes]
+% * 1 sentence describing the change. ([#PR number](https://github.com/elastic/apm-server/pull/PR number))
+
+_No new fixes_ 
+
 ## 9.4.1 [apm-9.4.1-release-notes]
 
 ### Fixes [apm-9.4.1-fixes]
::endgroup::
::group::create-commit
 M docs/release-notes/breaking-changes.md
 M docs/release-notes/deprecations.md
 M docs/release-notes/index.md
[update-9.4.0 ead22e35d] [Release] update changelogs for 9.4 release
 3 files changed, 20 insertions(+)
::endgroup::
INFO: Push changes to v1v/apm-server and create the relevant Pull Requests
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 12 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 1.03 KiB | 150.00 KiB/s, done.
Total 9 (delta 6), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (6/6), completed with 6 local objects.
remote: Bypassed rule violations for refs/heads/9.4:
remote: 
remote: - This branch must not contain merge commits.
remote:   Found 1 violation:
remote: 
remote:   f831d2a93b9a51a58a63caff33761ae1c562b9df
remote: 
remote: 
remote: Create a pull request for '9.4' on GitHub by visiting:
remote:      https://github.com/v1v/apm-server/pull/new/9.4
remote: 
To https://github.com/v1v/apm-server.git
 * [new branch]          9.4 -> 9.4
::group::create-pull-request update-9.4.0 -> main
Enumerating objects: 23, done.
Counting objects: 100% (23/23), done.
Delta compression using up to 12 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 1.78 KiB | 202.00 KiB/s, done.
Total 13 (delta 8), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (8/8), completed with 7 local objects.
remote: 
remote: Create a pull request for 'update-9.4.0' on GitHub by visiting:
remote:      https://github.com/v1v/apm-server/pull/new/update-9.4.0
remote: 
To https://github.com/v1v/apm-server.git
 * [new branch]          update-9.4.0 -> update-9.4.0
--label 

Creating pull request for update-9.4.0 into main in v1v/apm-server

https://github.com/v1v/apm-server/pull/90
::endgroup::

IIRC, you could run something like:

$ GITHUB_TOKEN=$(gh auth token) make major-release RELEASE_VERSION=9.0.0 PROJECT_OWNER=v1v RELEASE_TYPE=major

but if I run it again it does not work

$ GITHUB_TOKEN=$(gh auth token) make minor-release RELEASE_VERSION=9.4.0 PROJECT_OWNER=v1v RELEASE_TYPE=minor
INFO: Create GitHub label backport for the version 9.4.0
::group::create-github-label backport-9.4
✓ Label "backport-9.4" created in v1v/apm-server
::endgroup::
INFO: Create release branch and update new version 9.4.0
::group::create-branch 9.4
WARNING: Branch 9.4 already exists. Fetching and checking out.
From https://github.com/v1v/apm-server
 ! [rejected]            9.4        -> 9.4  (non-fast-forward)
Switched to branch '9.4'
::endgroup::
>> update-version
>> update-version-makefile
::group::git-diff
diff --git a/Makefile.bck b/Makefile.bck
index 652a9576a..1206b5a97 100644
--- a/Makefile.bck
+++ b/Makefile.bck
@@ -227,7 +227,7 @@ testing/infra/terraform/modules/%/README.md: .FORCE
 # Beats synchronisation.
 ##############################################################################
 
-BEATS_VERSION?=main
+BEATS_VERSION?=9.4
 BEATS_MODULE:=github.com/elastic/beats/v7
 
 .PHONY: update-beats
diff --git a/cmd/intake-receiver/version.go.bck b/cmd/intake-receiver/version.go.bck
index d96214af7..6ed99d39b 100644
--- a/cmd/intake-receiver/version.go.bck
+++ b/cmd/intake-receiver/version.go.bck
@@ -18,4 +18,4 @@
 package main
 
 // version matches the APM Server's version
-const version = "9.5.0"
+const version = "9.4.0"
diff --git a/internal/version/version.go.bck b/internal/version/version.go.bck
index 22e70c288..b0c38c11f 100644
--- a/internal/version/version.go.bck
+++ b/internal/version/version.go.bck
@@ -18,4 +18,4 @@
 package version
 
 // Version holds the APM Server version.
-const Version = "9.5.0"
+const Version = "9.4.0"
::endgroup::
::group::create-commit
 M Makefile.bck
 M cmd/intake-receiver/version.go.bck
 M internal/version/version.go.bck
[9.4 b1789d666] [Release] update version 9.4.0
 3 files changed, 3 insertions(+), 3 deletions(-)
::endgroup::
INFO: Create feature branch and update the versions. Target branch main
::group::create-branch update-9.4.0
Switched to branch 'main'
Your branch is ahead of 'origin/main' by 320 commits.
  (use "git push" to publish your local commits)
Switched to a new branch 'update-9.4.0'
::endgroup::
>> update-mergify
::warn::Mergify already contains backport-9.4
>> update-version
::group::git-diff
::endgroup::
::group::create-commit
?? cmd/intake-receiver/version.go.bck
?? internal/version/version.go.bck
[update-9.4.0 b9997ec7d] [Release] update version 9.5.0
 2 files changed, 42 insertions(+)
 create mode 100644 cmd/intake-receiver/version.go.bck
 create mode 100644 internal/version/version.go.bck
::endgroup::
>> update-changelog
>> updating changelog for 9.4.0
::group::git-diff
diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md
index 63543e3cb..42c0ab09c 100644
--- a/docs/release-notes/breaking-changes.md
+++ b/docs/release-notes/breaking-changes.md
@@ -21,7 +21,11 @@ Breaking changes can impact your Elastic applications, potentially disrupting no
 % **Action**<br> Steps for mitigating deprecation impact.
 % ::::
 
+## 9.4.0 [9-4-0]
+
 % Commenting 9.4.0 release notes until it is released
+_No breaking changes_ 
+
 % ## 9.4.0 [9-4-0] 
 
 % _No breaking changes_ 
diff --git a/docs/release-notes/deprecations.md b/docs/release-notes/deprecations.md
index 340f138ec..7515a20e4 100644
--- a/docs/release-notes/deprecations.md
+++ b/docs/release-notes/deprecations.md
@@ -18,7 +18,11 @@ Review the deprecated functionality for Elastic APM. While deprecations have no
 % **Action**<br> Steps for mitigating deprecation impact.
 % ::::
 
+## 9.4.0 [9-4-0]
+
 % Commenting 9.4.0 release notes until it is released
+_No deprecations_ 
+
 % ## 9.4.0 [9-4-0]
 
 % _No deprecations_ 
diff --git a/docs/release-notes/index.md b/docs/release-notes/index.md
index 3f5c70d9a..20ddd15ba 100644
--- a/docs/release-notes/index.md
+++ b/docs/release-notes/index.md
@@ -24,6 +24,18 @@ To check for security updates, go to [Security announcements for the Elastic sta
 % ### Fixes [apm-next-fixes]
 % * 1 sentence describing the change. ([#PR number](https://github.com/elastic/apm-server/pull/PR number))
 
+## 9.4.0 [apm-9.4.0-release-notes]
+
+% ### Features and enhancements [apm-9.4.0-features-enhancements]
+% * 1 sentence describing the change. ([#PR number](https://github.com/elastic/apm-server/pull/PR number))
+
+_No new features or enhancements_ 
+
+% ### Fixes [apm-9.4.0-fixes]
+% * 1 sentence describing the change. ([#PR number](https://github.com/elastic/apm-server/pull/PR number))
+
+_No new fixes_ 
+
 ## 9.4.1 [apm-9.4.1-release-notes]
 
 ### Fixes [apm-9.4.1-fixes]
::endgroup::
::group::create-commit
 M docs/release-notes/breaking-changes.md
 M docs/release-notes/deprecations.md
 M docs/release-notes/index.md
[update-9.4.0 faa1d0714] [Release] update changelogs for 9.4 release
 3 files changed, 20 insertions(+)
::endgroup::
INFO: Push changes to v1v/apm-server and create the relevant Pull Requests
To https://github.com/v1v/apm-server.git
 ! [rejected]            9.4 -> 9.4 (non-fast-forward)
error: failed to push some refs to 'https://github.com/v1v/apm-server.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you want to integrate the remote changes, use 'git pull'
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
make: *** [minor-release] Error 1

Likely this is related to:

  1. it checkouts a branch and its makefile reference is not up-to-date with the changes in this PR.

Likely it requires to be backported to all the active branches, so we can validate if it works afterwards

@mergify

mergify Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This pull request is now in conflicts. Could you fix it @ninalee12? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b version-bump-idempotency upstream/version-bump-idempotency
git merge upstream/main
git push upstream version-bump-idempotency

@v1v v1v added the backport-active-all Automated backport with mergify to all the active branches label Jul 29, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

@ninalee12
ninalee12 requested a review from v1v August 3, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants