Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changelog process improvements #36334

Merged
merged 9 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
Empty file added .changes/backported/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
DanielMSchmidt marked this conversation as resolved.
Show resolved Hide resolved
- 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

Expand Down
3 changes: 3 additions & 0 deletions .changes/footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Previous Releases

For information on prior major and minor releases, refer to their changelogs:
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ label to enable the backport bot.
<!--

If your change is user-facing, add a short description in a changelog entry.
You can use `npx changie new` to create a new changelog entry or manually create a new file in the .changes/unreleasd directory.
You can use `npx changie new` to create a new changelog entry or manually create a new file in the .changes/unreleasd directory (or .changes/backported if it's a bug fix that should be backported).

-->

Expand Down
46 changes: 41 additions & 5 deletions scripts/changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
DanielMSchmidt marked this conversation as resolved.
Show resolved Hide resolved


EOF
}

Expand All @@ -39,9 +45,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
Expand All @@ -61,6 +70,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
Expand Down Expand Up @@ -119,16 +129,18 @@ 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
}

# 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

Expand All @@ -137,22 +149,46 @@ 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 {
radeksimko marked this conversation as resolved.
Show resolved Hide resolved
# 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
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
Expand Down
Loading