diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md
index e79c0c5cc43..248fbeddf3e 100644
--- a/docs/release-notes/breaking-changes.md
+++ b/docs/release-notes/breaking-changes.md
@@ -8,15 +8,15 @@ mapped_pages:
Breaking changes can impact your Elastic applications, potentially disrupting normal operations. Before you upgrade, carefully review the Elastic APM breaking changes and take the necessary steps to mitigate any issues. To learn how to upgrade, check [Upgrade](docs-content://deploy-manage/upgrade.md).
-% ## Next version [next-version]
+## Next version [next-version]
% **Release date:** Month day, year
% ::::{dropdown} Title of breaking change
% Description of the breaking change.
% For more information, check [#PR-number]({{apm-pull}}PR-number).
-
+%
% **Impact**
Impact of the breaking change.
-
+%
% **Action**
Steps for mitigating deprecation impact.
% ::::
diff --git a/docs/release-notes/deprecations.md b/docs/release-notes/deprecations.md
index df46987e1cc..cdf0ce0e382 100644
--- a/docs/release-notes/deprecations.md
+++ b/docs/release-notes/deprecations.md
@@ -7,7 +7,7 @@ Over time, certain Elastic functionality becomes outdated and is replaced or rem
Review the deprecated functionality for Elastic APM. While deprecations have no immediate impact, we strongly encourage you update your implementation after you upgrade. To learn how to upgrade, check out [Upgrade](docs-content://deploy-manage/upgrade.md).
-% ## Next version [next-version]
+## Next version [next-version]
% **Release date:** Month day, year
% ::::{dropdown} Deprecation title
@@ -25,4 +25,4 @@ Review the deprecated functionality for Elastic APM. While deprecations have no
% For more information, check [PR #](PR link).
% **Impact**
Impact of deprecation.
% **Action**
Steps for mitigating deprecation impact.
-% ::::
\ No newline at end of file
+% ::::
diff --git a/docs/release-notes/index.md b/docs/release-notes/index.md
index 9f46eec4ae1..9352096d1d5 100644
--- a/docs/release-notes/index.md
+++ b/docs/release-notes/index.md
@@ -14,12 +14,12 @@ To check for security updates, go to [Security announcements for the Elastic sta
% Release notes include only features, enhancements, and fixes. Add breaking changes, deprecations, and known issues to the applicable release notes sections.
% For each new version section, include the Elastic APM and Kibana changes.
-% ## version.next [elastic-apm-next-release-notes]
+## version.next [elastic-apm-next-release-notes]
% **Release date:** Month day, year
-% ### Features and enhancements [elastic-apm-next-features-enhancements]
+### Features and enhancements [elastic-apm-next-features-enhancements]
-% ### Fixes [elastic-apm-next-fixes]
+### Fixes [elastic-apm-next-fixes]
## 9.0.0 [9-0-0]
**Release date:** April 2, 2025
diff --git a/release.mk b/release.mk
index 7a15a95318c..8109a2eaa43 100644
--- a/release.mk
+++ b/release.mk
@@ -48,11 +48,6 @@ NEXT_RELEASE ?= $(RELEASE_BRANCH).$(shell expr $(PROJECT_PATCH_VERSION) + 1)
BRANCH_PATCH = update-$(NEXT_RELEASE)
endif
-# for the view commits
-# NOTE: as long as 8.x is the branch to run releases, then we use base branch 8.x
-# when 8.x is not available then we use the main base branch.
-CHANGELOG_BRANCH = 8.x
-
# BASE_BRANCH select by release type (default patch)
ifeq ($(RELEASE_TYPE),minor)
# NOTE: as long as 8.x is the branch to run releases, then we use base branch 8.x
@@ -68,50 +63,9 @@ endif
ifeq ($(RELEASE_TYPE),major)
BASE_BRANCH ?= main
- CHANGELOG_BRANCH = main
UPDATE_MERGIFY = true
endif
-#######################
-## Templates
-#######################
-## Changelog template
-define CHANGELOG_TMPL
-[[release-notes-head]]
-== APM version HEAD
-
-https://github.com/elastic/apm-server/compare/$(RELEASE_BRANCH)\...$(CHANGELOG_BRANCH)[View commits]
-
-[float]
-==== Breaking Changes
-
-[float]
-==== Bug fixes
-
-[float]
-==== Deprecations
-
-[float]
-==== Intake API Changes
-
-[float]
-==== Added
-endef
-
-## Changelog template for new minors
-define CHANGELOG_MINOR_TMPL
-[[apm-release-notes-$(RELEASE_BRANCH)]]
-== APM version $(RELEASE_BRANCH)
-* <>
-
-[float]
-[[apm-release-notes-$(RELEASE_BRANCH).0]]
-=== APM version $(RELEASE_BRANCH).0
-
-https://github.com/elastic/apm-server/compare/v$(CURRENT_RELEASE)\...v$(RELEASE_BRANCH).0[View commits]
-
-endef
-
#######################
## Public make goals
#######################
@@ -137,8 +91,7 @@ minor-release:
# BASE=$(RELEASE_BRANCH)
# Target main and use the backport strategy
$(MAKE) create-branch NAME=changelog-$(RELEASE_BRANCH) BASE=main
- $(MAKE) update-changelog VERSION=$(RELEASE_BRANCH)
- $(MAKE) rename-changelog VERSION=$(RELEASE_BRANCH)
+ $(MAKE) update-changelog VERSION=$(RELEASE_VERSION)
$(MAKE) create-commit COMMIT_MESSAGE="docs: Update changelogs for $(RELEASE_BRANCH) release"
# NOTE: as long as 8.x is the branch to run releases, then we update mergify
@@ -161,7 +114,7 @@ endif
#endif
$(MAKE) update-version VERSION=$(NEXT_PROJECT_MINOR_VERSION)
$(MAKE) create-commit COMMIT_MESSAGE="[Release] update version $(NEXT_PROJECT_MINOR_VERSION)"
- $(MAKE) rename-changelog VERSION=$(RELEASE_BRANCH)
+ $(MAKE) update-changelog VERSION=$(RELEASE_VERSION)
$(MAKE) create-commit COMMIT_MESSAGE="[Release] update changelogs for $(RELEASE_BRANCH) release"
@echo "INFO: Push changes to $(PROJECT_OWNER)/apm-server and create the relevant Pull Requests"
@@ -183,7 +136,7 @@ endif
#
.PHONY: major-release
major-release:
-# NOTE: major release uses minor-release with BASE_BRANCH=main and CHANGELOG_BRANCH=main
+# NOTE: major release uses minor-release with BASE_BRANCH=main
$(MAKE) minor-release
# This is the contract with the GitHub action .github/workflows/run-patch-release.yml
@@ -205,38 +158,12 @@ patch-release:
## Internal make goals to bump versions
############################################
-# Rename changelog file to generate something similar to https://github.com/elastic/apm-server/pull/12172
-.PHONY: rename-changelog
-export CHANGELOG_TMPL
-rename-changelog: VERSION=$${VERSION}
-rename-changelog:
- $(MAKE) common-changelog
- @echo ">> rename-changelog"
- echo "$$CHANGELOG_TMPL" > changelogs/head.asciidoc
- @if ! grep -q 'apm-release-notes-$(VERSION)' CHANGELOG.asciidoc ; then \
- awk "NR==2{print \"* <>\"}1" CHANGELOG.asciidoc > CHANGELOG.asciidoc.new; \
- mv CHANGELOG.asciidoc.new CHANGELOG.asciidoc ; \
- fi
- @if ! grep -q '$(VERSION).asciidoc' CHANGELOG.asciidoc ; then \
- $(SED) -E -e 's#(head.asciidoc\[\])#\1\ninclude::.\/changelogs\/$(VERSION).asciidoc[]#g' CHANGELOG.asciidoc; \
- fi
-
# Update changelog file to generate something similar to https://github.com/elastic/apm-server/pull/12220
.PHONY: update-changelog
update-changelog: VERSION=$${VERSION}
update-changelog:
- $(MAKE) common-changelog
@echo ">> update-changelog"
- $(SED) 's#head#$(VERSION)#g' CHANGELOG.asciidoc
-
-# Common changelog file steps
-.PHONY: common-changelog
-export CHANGELOG_MINOR_TMPL
-common-changelog: VERSION=$${VERSION}
-common-changelog:
- @echo ">> common-changelog"
- echo "$$CHANGELOG_MINOR_TMPL" > changelogs/$(VERSION).asciidoc
- tail -n +6 changelogs/head.asciidoc >> changelogs/$(VERSION).asciidoc
+ bash ./tools/scripts/changelog.sh $(VERSION)
## Update the references on .mergify.yml with the new minor release.
.PHONY: update-mergify
diff --git a/tools/scripts/changelog.sh b/tools/scripts/changelog.sh
new file mode 100755
index 00000000000..2034831b27a
--- /dev/null
+++ b/tools/scripts/changelog.sh
@@ -0,0 +1,87 @@
+#!/usr/bin/bash
+#
+# This script adds the specific version header to all release notes files.
+
+set -eou pipefail
+
+updateFile() {
+ local file
+ file=$1
+ # offset of placeholder content after Next version
+ local offset
+ offset=$2
+
+ newfile="newfile.md"
+
+ # get the line where we will introduce back the next version section
+ LN=$(grep -n "## Next version" "$file" | head -1 | grep -Eo '^[^:]+')
+ # create anchor from version string
+ anchor=$(echo "$VERSION" | tr . -)
+ # create the new file content
+ # take lines up to next version section
+ head -n "$(($LN + $offset))" "$file" > "$newfile"
+ # introduce the new version header
+ echo "## $VERSION [$anchor]" >> "$newfile"
+ echo "% **Release date:** Month day, year" >> "$newfile"
+ # Add the rest of the file, skip placeholder content, replace next section with version.
+ tail -n+$(($LN + $offset)) "$file" | \
+ sed "s|## Next version.*|## $VERSION [$anchor]|g" /dev/stdin >> "$newfile"
+ # replace breaking change file with new content
+ mv "$newfile" "$file"
+}
+
+updateBreakingChanges() {
+ # offset is number of lines below in the Next version section + 1
+ updateFile "./docs/release-notes/breaking-changes.md" 11
+}
+
+updateDeprecations() {
+ # offset is number of lines below in the Next version section + 1
+ updateFile "./docs/release-notes/deprecations.md" 9
+}
+
+updateIndex() {
+ file=./docs/release-notes/index.md
+ newfile="newfile.md"
+
+ # get the line where we will introduce back the next version section
+ LN=$(grep -n "## version.next" "$file" | head -1 | grep -Eo '^[^:]+')
+ # create anchor from version string
+ anchor=$(echo "$VERSION" | tr . -)
+ # create the new file content
+ # take lines up to next version section
+ head -n "$(($LN - 1))" "$file" > "$newfile"
+ # add template
+ echo "## Next version [elastic-apm-next-release-notes]" >> "$newfile"
+ echo "% **Release date:** Month day, year" >> "$newfile"
+ echo "" >> "$newfile"
+ echo "### Features and enhancements [elastic-apm-next-features-enhancements]" >> "$newfile"
+ echo "% * 1 sentence describing the change. ([#PR number](https://github.com/elastic/apm-server/pull/PR number))" >> "$newfile"
+ echo "" >> "$newfile"
+ echo "### Fixes [elastic-apm-next-fixes]" >> "$newfile"
+ echo "% * 1 sentence describing the change. ([#PR number](https://github.com/elastic/apm-server/pull/PR number))" >> "$newfile"
+ echo "" >> "$newfile"
+ # introduce the new version header
+ echo "## $VERSION [$anchor]" >> "$newfile"
+ echo "% **Release date:** Month day, year" >> "$newfile"
+ # Add the rest of the file, skip placeholder content, replace next section with version.
+ tail -n+$(($LN + 2)) "$file" | \
+ sed "s|elastic-apm-next-features-enhancements|$anchor-features-enhancements|g" /dev/stdin | \
+ sed "s|elastic-apm-next-fixes|$anchor-fixes|g" /dev/stdin >> "$newfile"
+ # replace index file with new content
+ mv "$newfile" "$file"
+}
+
+
+VERSION=${1:-}
+
+test -z VERSION && {
+ echo "VERSION is required"
+ exit 2
+}
+
+echo ">> updating changelog for $VERSION"
+
+updateBreakingChanges
+updateDeprecations
+updateIndex