diff --git a/dev_docs/RELEASES.md b/dev_docs/RELEASES.md index 049aab07b93..ab0c40b5dac 100644 --- a/dev_docs/RELEASES.md +++ b/dev_docs/RELEASES.md @@ -166,3 +166,50 @@ APM UI:: **Title** Topic... ``` + +# Release 8.x + +There will be no more minor versions in the `8.x` line, apart from `8.19.0.`, but only patch releases. + +## 8.17 patch releases + +Run the `run-patch-release` with any `8.17.x` version. + +**NOTE**: This automation does not handle the changelog, which should be manually handled. + +## 8.18 patch releases + +Run the `run-patch-release` with any `8.18.x` version. + +**NOTE**: This automation does not handle the changelog, which should be manually handled. + +## 8.19.0 + +This is technically a minor release, but it's the last minor we will ever create on the 8.x line. +The trunk branch `8.x` does not exist anymore (as expected) and has been renamed to `8.19`. This +makes our current minor release automation broken. + +The `run-minor-release` automation is currently not working, and fixing it is not worth for a single release. +As such for this release we should do it manually. + +What does that include? +- update the changelog in `8.19` branch +- update versions to `8.19.1` + +The process: +- switch to `8.19` branch +- create a new branch: `release-8.19.0` +- update the changelog, manually +- update versions with `make update-version VERSION=8.19.1` +- push the branch and create a Pull Request named: `8.19.0: update changelog, versions` + +An example PR for the changelog update can be seen here: https://github.com/elastic/apm-server/pull/14382/files +An example PR for the other changes can be seen here, but note that this time `8.x` branch is `8.19`: https://github.com/elastic/apm-server/pull/14381/files + +Refer to `release.mk` and the `minor-release` target for further details. + +## 8.19 patch releases + +Run the `run-patch-release` with any `8.19.x` version. + +**NOTE**: This automation does not handle the changelog, which should be manually handled. diff --git a/docs/release-notes/breaking-changes.md b/docs/release-notes/breaking-changes.md index 6c62779ff6d..8da54d04556 100644 --- a/docs/release-notes/breaking-changes.md +++ b/docs/release-notes/breaking-changes.md @@ -8,14 +8,14 @@ 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] % ::::{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 4e86b8db46e..0f90251b914 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] % ::::{dropdown} Deprecation title % Description of the deprecation. @@ -16,6 +16,14 @@ Review the deprecated functionality for Elastic APM. While deprecations have no % **Action**
Steps for mitigating deprecation impact. % :::: -% ## 9.0.0 [9-0-0] +## 9.0.2 [9-0-2] -_No deprecations_ \ No newline at end of file +_No deprecations_ + +## 9.0.1 [9-0-1] + +_No deprecations_ + +## 9.0.0 [9-0-0] + +_No deprecations_ diff --git a/docs/release-notes/index.md b/docs/release-notes/index.md index 95cbda2478e..21085447a4e 100644 --- a/docs/release-notes/index.md +++ b/docs/release-notes/index.md @@ -14,11 +14,11 @@ 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] +## Next version [elastic-apm-next-release-notes] -% ### 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.3 [elastic-apm-9.0.3-release-notes] diff --git a/release.mk b/release.mk index cca89f174b9..cd8df95b0e5 100644 --- a/release.mk +++ b/release.mk @@ -61,49 +61,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 ####################### @@ -123,24 +83,17 @@ minor-release: $(MAKE) update-version-makefile VERSION=$(PROJECT_MAJOR_VERSION)\.$(PROJECT_MINOR_VERSION) $(MAKE) create-commit COMMIT_MESSAGE="[Release] update version $(RELEASE_VERSION)" - @echo "INFO: Create feature branch and update the versions. Target branch $(RELEASE_BRANCH)" - $(MAKE) create-branch NAME=changelog-$(RELEASE_BRANCH) BASE=$(RELEASE_BRANCH) - $(MAKE) update-changelog VERSION=$(RELEASE_BRANCH) - $(MAKE) rename-changelog VERSION=$(RELEASE_BRANCH) - $(MAKE) create-commit COMMIT_MESSAGE="docs: Update changelogs for $(RELEASE_BRANCH) release" - @echo "INFO: Create feature branch and update the versions. Target branch $(BASE_BRANCH)" $(MAKE) create-branch NAME=update-$(RELEASE_VERSION) BASE=$(BASE_BRANCH) $(MAKE) update-mergify VERSION=$(RELEASE_BRANCH) $(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" git push origin $(RELEASE_BRANCH) $(MAKE) create-pull-request BRANCH=update-$(RELEASE_VERSION) TARGET_BRANCH=$(BASE_BRANCH) TITLE="$(RELEASE_BRANCH): update docs, mergify, versions and changelogs" BODY="Merge as soon as the GitHub checks are green." - $(MAKE) create-pull-request BRANCH=changelog-$(RELEASE_BRANCH) TARGET_BRANCH=$(RELEASE_BRANCH) TITLE="$(RELEASE_BRANCH): update docs" BODY="Merge as soon as $(TARGET_BRANCH) branch is created and the GitHub checks are green." # This is the contract with the GitHub action .github/workflows/run-major-release.yml. # The GitHub action will provide the below environment variables: @@ -148,7 +101,7 @@ minor-release: # .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 @@ -166,42 +119,24 @@ patch-release: @echo "INFO: Push changes to $(PROJECT_OWNER)/apm-server and create the relevant Pull Requests" $(MAKE) create-pull-request BRANCH=$(BRANCH_PATCH) TARGET_BRANCH=$(RELEASE_BRANCH) TITLE="$(RELEASE_VERSION): update versions" BODY="Merge on request by the Release Manager." BACKPORT_LABEL=backport-skip + @echo "INFO: Create feature branch and update the versions. Target branch $(BASE_BRANCH)" + $(MAKE) create-branch NAME=update-$(RELEASE_VERSION) BASE=$(BASE_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" + git push origin update-$(RELEASE_VERSION) + $(MAKE) create-pull-request BRANCH=update-$(RELEASE_VERSION) TARGET_BRANCH=$(BASE_BRANCH) TITLE="$(RELEASE_BRANCH): update release notes" BODY="Merge as soon as the GitHub checks are green." + ############################################ ## 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..86a022fb031 --- /dev/null +++ b/tools/scripts/changelog.sh @@ -0,0 +1,146 @@ +#!/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" + # 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" +} + +# maybeInsertEmptyReleaseNote file start_marker end_marker comment +# This function checks if between $start_marker and $end_marker lines there are +# non empty and non commented lines. If there are any, adds the content of +# $comment in between. This allows to automate inserting empty release notes when +# necessary. +# NOTE: it overrides $file with the new content. +maybeInsertEmptyReleaseNote() { + local file + file="$1" + local start_marker + start_marker="$2" + local end_marker + end_marker="$3" + local comment + comment="$4" + + awk -v sm="$start_marker" -v em="$end_marker" -v comment="$comment" ' + BEGIN {in_block=0; found=0} + { + # Detect start marker + if ($0 ~ sm) { + print + in_block=1 + block_lines="" + next + } + # Detect end marker + if (in_block && $0 ~ em) { + # Check if any non-comment, non-blank lines found + if (found == 0) { + print comment, "\n" + } + print + in_block=0 + found=0 + next + } + if (in_block) { + # Only check lines between the markers + if ($0 !~ /^%/ && $0 !~ /^[[:space:]]*$/) { + found=1 + } + block_lines = block_lines $0 "\n" + print + next + } + print + } + ' "$file" > "$file.new" + + mv "$file.new" "$file" +} + +updateBreakingChanges() { + file="./docs/release-notes/breaking-changes.md" + maybeInsertEmptyReleaseNote "$file" "## Next version" "## [0-9]+\.[0-9]+\.[0-9]+" "_No breaking changes_" + # offset is number of lines below in the Next version section + 1 + updateFile "$file" 10 +} + +updateDeprecations() { + file="./docs/release-notes/deprecations.md" + maybeInsertEmptyReleaseNote "$file" "## Next version" "## [0-9]+\.[0-9]+\.[0-9]+" "_No deprecations_" + # offset is number of lines below in the Next version section + 1 + updateFile "$file" 8 +} + +updateIndex() { + file=./docs/release-notes/index.md + newfile="newfile.md" + + + maybeInsertEmptyReleaseNote "$file" "## Features and enhancements" "## Fixes" "_No new features or enhancements_" + maybeInsertEmptyReleaseNote "$file" "## Fixes" "## [0-9]+\.[0-9]+\.[0-9]+" "_No new fixes_" + + # 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 - 1))" "$file" > "$newfile" + # add template + echo "## Next version [elastic-apm-next-release-notes]" >> "$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 "" >> "$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