From da0cfec4441b049516f7b5b5d6503e7bfcf2b502 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 15 Jan 2025 16:21:44 +0100 Subject: [PATCH 1/9] add back experiments --- .changes/experiments.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.changes/experiments.md b/.changes/experiments.md index 6aba0a091e22..8cbffbf8241e 100644 --- a/.changes/experiments.md +++ b/.changes/experiments.md @@ -2,6 +2,7 @@ EXPERIMENTS: Experiments are only enabled in alpha releases of Terraform CLI. The following features are not yet available in stable releases. +- `terraform test` accepts a new option `-junit-xml=FILENAME`. If specified, and if the test configuration is valid enough to begin executing, then Terraform writes a JUnit XML test result report to the given filename, describing similar information as included in the normal test output. ([#34291](https://github.com/hashicorp/terraform/issues/34291)) - The new command `terraform rpcapi` exposes some Terraform Core functionality through an RPC interface compatible with [`go-plugin`](https://github.com/hashicorp/go-plugin). The exact RPC API exposed here is currently subject to change at any time, because it's here primarily as a vehicle to support the [Terraform Stacks](https://www.hashicorp.com/blog/terraform-stacks-explained) private preview and so will be broken if necessary to respond to feedback from private preview participants, or possibly for other reasons. Do not use this mechanism yet outside of Terraform Stacks private preview. - The experimental "deferred actions" feature, enabled by passing the `-allow-deferral` option to `terraform plan`, permits `count` and `for_each` arguments in `module`, `resource`, and `data` blocks to have unknown values and allows providers to react more flexibly to unknown values. This experiment is under active development, and so it's not yet useful to participate in this experiment From ac5036a414ecb253a985e8bb500079da2660fbc8 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 15 Jan 2025 16:24:10 +0100 Subject: [PATCH 2/9] only include experiments in dev and alpha releases --- .changes/{experiments.md => footer-with-experiments.md} | 0 .changes/footer.md | 3 +++ scripts/changelog.sh | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) rename .changes/{experiments.md => footer-with-experiments.md} (100%) create mode 100644 .changes/footer.md diff --git a/.changes/experiments.md b/.changes/footer-with-experiments.md similarity index 100% rename from .changes/experiments.md rename to .changes/footer-with-experiments.md diff --git a/.changes/footer.md b/.changes/footer.md new file mode 100644 index 000000000000..259cdc4e337c --- /dev/null +++ b/.changes/footer.md @@ -0,0 +1,3 @@ +## Previous Releases + +For information on prior major and minor releases, refer to their changelogs: diff --git a/scripts/changelog.sh b/scripts/changelog.sh index 72cdfd0beeaa..c12ae22d6a1a 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -39,9 +39,12 @@ function generate { exit 1 fi + FOOTER_FILE='footer.md' + case "$RELEASE_TYPE" in dev) + FOOTER_FILE='footer-with-experiments.md' LATEST_VERSION=$(npx -y changie@$CHANGIE_VERSION latest -r --skip-prereleases) # Check if we already released this version already @@ -61,6 +64,7 @@ function generate { ;; alpha) + FOOTER_FILE='footer-with-experiments.md' PRERELEASE_VERSION=$(date +"alpha%Y%m%d") LATEST_VERSION=$(npx -y changie@$CHANGIE_VERSION latest -r --skip-prereleases) HUMAN_DATE=$(date +"%B %d, %Y") # Date in Janurary 1st, 2022 format @@ -119,7 +123,7 @@ function generate { echo "$COMPLETE_VERSION" > version/VERSION # Add footer to the changelog - cat ./.changes/experiments.md >> CHANGELOG.md + cat ./.changes/$FOOTER_FILE >> CHANGELOG.md echo "" >> CHANGELOG.md cat ./.changes/previous-releases.md >> CHANGELOG.md } From 455f12a24bf1084eab56054d025a455bddf02ffd Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 15 Jan 2025 16:43:08 +0100 Subject: [PATCH 3/9] setup script for maintenance branch By changing the folder changie uses for the changelog we can make sure that users can put the changelog entries into a specific folder based on if the change will be backported. This way it will only appear in the patch release of the maintenance branch and not in the changelog of the current development branch. --- .changes/backported/.gitkeep | 0 scripts/changelog.sh | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 .changes/backported/.gitkeep diff --git a/.changes/backported/.gitkeep b/.changes/backported/.gitkeep new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/scripts/changelog.sh b/scripts/changelog.sh index c12ae22d6a1a..fd66202f0fcd 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -21,12 +21,18 @@ Commands: type. The release type should be one of "dev", "alpha", "rc", "release", or "patch". `dev`: will update the changelog with the latest unreleased changes. `alpha`: will generate a new section with an alpha version for today. + `beta`: will generate a new beta release. `rc`: will generate a new rc release. `release`: will make the initial minor release for this branch. `patch`: will generate a new patch release nextminor - Run this to get a new release branch for the next minor version. + This function expects the current branch to be main. Run it if you want to set main to the next + minor version. + + maintenancerelease + + EOF } @@ -128,11 +134,13 @@ function generate { cat ./.changes/previous-releases.md >> CHANGELOG.md } +# This function expects the current branch to be main. Run it if you want to set main to the next +# minor version. function nextminor { + # Prepend the latest version to the previous releases LATEST_VERSION=$(npx -y changie@$CHANGIE_VERSION latest -r --skip-prereleases) LATEST_VERSION=${LATEST_VERSION%.*} # Remove the patch version CURRENT_FILE_CONTENT=$(cat ./.changes/previous-releases.md) - # Prepend the latest version to the previous releases echo "- [v$LATEST_VERSION](https://github.com/hashicorp/terraform/blob/v$LATEST_VERSION/CHANGELOG.md)" > ./.changes/previous-releases.md echo "$CURRENT_FILE_CONTENT" >> ./.changes/previous-releases.md @@ -141,22 +149,42 @@ function nextminor { rm ./.changes/*.*.*.md # Remove all unreleased changes rm ./.changes/unreleased/*.yaml + # Remove all backported changes + rm ./.changes/backported/*.yaml # Create a new empty version file for the next minor version touch ./.changes/$NEXT_VERSION.md generate "dev" } +# This function is expected to be run on the branch of the last minor release. It will make sure +# that backports work properly +function maintenancerelease { + # For the maintenance branch we don't want to base our changelog on the unreleased but the backported folder instead + awk '{sub(/unreleasedDir: unreleased/, "unreleasedDir: backported")}1' ./.changie.yaml > temp && mv temp ./.changie.yaml + + # If we have unreleased changes, they will be released in the next patch, therefore they need + # to go into the backported folder + if [ "$(ls -A ./.changes/unreleased/)" ]; then + mv ./.changes/unreleased/* ./.changes/backported/ + fi + + generate "dev" +} + function main { case "$1" in generate) generate "${@:2}" - ;; + nextminor) nextminor "${@:2}" - ;; + + maintenancerelease) + maintenancerelease "${@:2}" + ;; *) usage exit 1 From 82440257fbdb76b991f01752ce0010718d471327 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 15 Jan 2025 16:53:46 +0100 Subject: [PATCH 4/9] add backported comment to PR template --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6b4dd468082c..d6a0e7ca9800 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -38,7 +38,7 @@ label to enable the backport bot. From 53a25d79fa6f861b69d05bc77604a2318cc65838 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 15 Jan 2025 16:57:10 +0100 Subject: [PATCH 5/9] remove old backported changes --- scripts/changelog.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/changelog.sh b/scripts/changelog.sh index fd66202f0fcd..4f900e04b048 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -163,6 +163,10 @@ function maintenancerelease { # For the maintenance branch we don't want to base our changelog on the unreleased but the backported folder instead awk '{sub(/unreleasedDir: unreleased/, "unreleasedDir: backported")}1' ./.changie.yaml > temp && mv temp ./.changie.yaml + # If we have backported changes, we need to remove them now since they were backported into the + # last version + rm -f ./.changes/backported/*.yaml + # If we have unreleased changes, they will be released in the next patch, therefore they need # to go into the backported folder if [ "$(ls -A ./.changes/unreleased/)" ]; then From dc4fae3f6753c189ceeded94c809607a5a83754b Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 15 Jan 2025 17:50:05 +0100 Subject: [PATCH 6/9] remove experiment --- .changes/footer-with-experiments.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.changes/footer-with-experiments.md b/.changes/footer-with-experiments.md index 8cbffbf8241e..6aba0a091e22 100644 --- a/.changes/footer-with-experiments.md +++ b/.changes/footer-with-experiments.md @@ -2,7 +2,6 @@ EXPERIMENTS: Experiments are only enabled in alpha releases of Terraform CLI. The following features are not yet available in stable releases. -- `terraform test` accepts a new option `-junit-xml=FILENAME`. If specified, and if the test configuration is valid enough to begin executing, then Terraform writes a JUnit XML test result report to the given filename, describing similar information as included in the normal test output. ([#34291](https://github.com/hashicorp/terraform/issues/34291)) - The new command `terraform rpcapi` exposes some Terraform Core functionality through an RPC interface compatible with [`go-plugin`](https://github.com/hashicorp/go-plugin). The exact RPC API exposed here is currently subject to change at any time, because it's here primarily as a vehicle to support the [Terraform Stacks](https://www.hashicorp.com/blog/terraform-stacks-explained) private preview and so will be broken if necessary to respond to feedback from private preview participants, or possibly for other reasons. Do not use this mechanism yet outside of Terraform Stacks private preview. - The experimental "deferred actions" feature, enabled by passing the `-allow-deferral` option to `terraform plan`, permits `count` and `for_each` arguments in `module`, `resource`, and `data` blocks to have unknown values and allows providers to react more flexibly to unknown values. This experiment is under active development, and so it's not yet useful to participate in this experiment From f9960d860bad4a6e1fef7fc1f2e37fed0d0577fe Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 15 Jan 2025 17:50:12 +0100 Subject: [PATCH 7/9] add usage comment --- scripts/changelog.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/changelog.sh b/scripts/changelog.sh index 4f900e04b048..ef9b2091b3e8 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -31,7 +31,8 @@ Commands: minor version. maintenancerelease - + This function is expected to be run on the branch of the last minor release. It will make sure + that backports work properly EOF } From 791e36aab65ff63f2113f261c750a094d8787872 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 16 Jan 2025 11:47:33 +0100 Subject: [PATCH 8/9] rename to firstbeta --- scripts/changelog.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/changelog.sh b/scripts/changelog.sh index ef9b2091b3e8..703c1149fe55 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -30,7 +30,7 @@ Commands: This function expects the current branch to be main. Run it if you want to set main to the next minor version. - maintenancerelease + firstbeta This function is expected to be run on the branch of the last minor release. It will make sure that backports work properly @@ -160,7 +160,7 @@ function nextminor { # This function is expected to be run on the branch of the last minor release. It will make sure # that backports work properly -function maintenancerelease { +function firstbeta { # For the maintenance branch we don't want to base our changelog on the unreleased but the backported folder instead awk '{sub(/unreleasedDir: unreleased/, "unreleasedDir: backported")}1' ./.changie.yaml > temp && mv temp ./.changie.yaml @@ -187,8 +187,8 @@ function main { nextminor "${@:2}" ;; - maintenancerelease) - maintenancerelease "${@:2}" + firstbeta) + firstbeta "${@:2}" ;; *) usage From cff8616a755570684b9746294fc1db59a24121eb Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 16 Jan 2025 11:50:07 +0100 Subject: [PATCH 9/9] fix typo Co-authored-by: Radek Simko --- scripts/changelog.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/changelog.sh b/scripts/changelog.sh index 703c1149fe55..8eb9a0576e6f 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -30,7 +30,7 @@ Commands: This function expects the current branch to be main. Run it if you want to set main to the next minor version. - firstbeta + firstbeta This function is expected to be run on the branch of the last minor release. It will make sure that backports work properly