Skip to content

Commit

Permalink
setup changie
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Jan 3, 2025
1 parent a4e1e60 commit 653e915
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 59 deletions.
Empty file added .changes/1.11.0.md
Empty file.
11 changes: 11 additions & 0 deletions .changes/experiments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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

## Previous Releases

For information on prior major and minor releases, refer to their changelogs:
16 changes: 16 additions & 0 deletions .changes/previous-releases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- [v1.10](https://github.com/hashicorp/terraform/blob/v1.10/CHANGELOG.md)
- [v1.9](https://github.com/hashicorp/terraform/blob/v1.9/CHANGELOG.md)
- [v1.8](https://github.com/hashicorp/terraform/blob/v1.8/CHANGELOG.md)
- [v1.7](https://github.com/hashicorp/terraform/blob/v1.7/CHANGELOG.md)
- [v1.6](https://github.com/hashicorp/terraform/blob/v1.6/CHANGELOG.md)
- [v1.5](https://github.com/hashicorp/terraform/blob/v1.5/CHANGELOG.md)
- [v1.4](https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md)
- [v1.3](https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md)
- [v1.2](https://github.com/hashicorp/terraform/blob/v1.2/CHANGELOG.md)
- [v1.1](https://github.com/hashicorp/terraform/blob/v1.1/CHANGELOG.md)
- [v1.0](https://github.com/hashicorp/terraform/blob/v1.0/CHANGELOG.md)
- [v0.15](https://github.com/hashicorp/terraform/blob/v0.15/CHANGELOG.md)
- [v0.14](https://github.com/hashicorp/terraform/blob/v0.14/CHANGELOG.md)
- [v0.13](https://github.com/hashicorp/terraform/blob/v0.13/CHANGELOG.md)
- [v0.12](https://github.com/hashicorp/terraform/blob/v0.12/CHANGELOG.md)
- [v0.11 and earlier](https://github.com/hashicorp/terraform/blob/v0.11/CHANGELOG.md)
Empty file added .changes/unreleased/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions .changes/unreleased/ENHANCEMENTS-20250102-130808.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: ENHANCEMENTS
body: "`init`: Provider installation will utilise credentials configured in a `.netrc` file for the download and shasum URLs returned by provider registries."
time: 2025-01-02T13:00:22.419624+01:00
custom:
Issue: "35843"
5 changes: 5 additions & 0 deletions .changes/unreleased/ENHANCEMENTS-20250102-131022.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: ENHANCEMENTS
body: "New command `modules -json`: Displays a full list of all installed modules in a working directory, including whether each module is currently referenced by the working directory's configuration."
time: 2025-01-02T13:10:22.419624+01:00
custom:
Issue: "35884"
27 changes: 27 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
changesDir: .changes
unreleasedDir: unreleased
versionFooterPath: version_footer.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.Version}} ({{.Time.Format "January 2, 2006"}})'
kindFormat: "{{.Kind}}:"
changeFormat: "* {{.Body}} {{- if .Custom.Issue }} ([#{{.Custom.Issue}}](https://github.com/hashicorp/terraform/issues/{{.Custom.Issue}})){{- end}}"
custom:
- key: Issue
label: Issue/PR Number
type: int
minInt: 1
kinds:
- label: NEW FEATURES
- label: ENHANCEMENTS
- label: BUG FIXES
- label: NOTES
- label: UPGRADE NOTES
- label: BREAKING CHANGES
newlines:
afterChangelogHeader: 0
afterKind: 1
afterVersion: 1
beforeChangelogVersion: 0
endOfVersion: 2
envPrefix: CHANGIE_
20 changes: 5 additions & 15 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,14 @@ label to enable the backport bot.

1.11.x

## Draft CHANGELOG entry
## CHANGELOG entry

<!--
Choose a category, delete the others:
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.
-->

### NEW FEATURES | UPGRADE NOTES | ENHANCEMENTS | BUG FIXES | EXPERIMENTS

<!--
Write a short description of the user-facing change. Examples:
- `terraform show -json`: Fixed crash with sensitive set values.
- When rendering a diff, Terraform now quotes the name of any object attribute whose string representation is not a valid identifier.
- The local token configuration in the cloud and remote backend now has higher priority than a token specified in a credentials block in the CLI configuration.
-->

-
- [ ] This change is user-facing and I added a changelog entry.
- [ ] This change is not user-facing.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

ENHANCEMENTS:

- `init`: Provider installation will utilise credentials configured in a `.netrc` file for the download and shasum URLs returned by provider registries. ([https://github.com/hashicorp/terraform/pull/35843](35843))
- New command `modules -json`: Displays a full list of all installed modules in a working directory, including whether each module is currently referenced by the working directory's configuration. ([#35884](https://github.com/hashicorp/terraform/pull/35884), [#36062](https://github.com/hashicorp/terraform/pull/36062))
* `init`: Provider installation will utilise credentials configured in a `.netrc` file for the download and shasum URLs returned by provider registries. ([#35843](https://github.com/hashicorp/terraform/issues/35843))
* New command `modules -json`: Displays a full list of all installed modules in a working directory, including whether each module is currently referenced by the working directory's configuration. ([#35884](https://github.com/hashicorp/terraform/issues/35884))

EXPERIMENTS:

Expand Down
143 changes: 101 additions & 42 deletions scripts/changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@


set -uo pipefail
set -x

# TODO: Make all paths relative to the script location

function usage {
cat <<-'EOF'
Expand All @@ -13,59 +16,115 @@ Description:
This script will update CHANGELOG.md with the given version and date.
Commands:
prepare <version> <date>
prepare updates the first line in the CHANGELOG.md file with the
given version and date.
./changelog.sh prepare 1.0.0 "November 1, 2021"
cleanup <released-version> <next-version>
cleanup prepends a new section to the CHANGELOG.md file with the given
version and (Unreleased) as the date. If the released version contains a
pre-release tag, the next version will replace the top line instead of
inserting a new section.
generate <release-type>
generate will create a new section in the CHANGELOG.md file for the given release
type. The release type should be one of "dev", "alpha", "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.
`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.
EOF
}

function prepare {
VERSION="${1:-}"
DATE="${2:-}"

if [[ -z "$VERSION" || -z "$DATE" ]]; then
echo "missing at least one of [<version>, <date>] arguments"
usage
exit 1
fi

sed -i '' -e "1s/.*/## $VERSION ($DATE)/" CHANGELOG.md
function generate {
RELEASE_TYPE="${1:-}"

if [[ -z "$RELEASE_TYPE" ]]; then
echo "missing <release-type> argument"
usage
exit 1
fi

case "$RELEASE_TYPE" in

dev)
LATEST_VERSION=$(npx -y [email protected] latest -r --skip-prereleases)
COMPLETE_VERSION="$LATEST_VERSION-dev"

echo "LASTEST_VERSION: $LATEST_VERSION"

npx -y [email protected] merge -u "## $LATEST_VERSION (Unreleased)"

# If we have no changes yet, the changelog is empty now, so we need to add a header
if [[ ! -s CHANGELOG.md ]]; then
echo "## $LATEST_VERSION (Unreleased)" > CHANGELOG.md
echo "" >> CHANGELOG.md
fi
;;

alpha)
PRERELEASE_VERSION=$(date +"alpha%Y%m%d")
LATEST_VERSION=$(npx -y [email protected] latest -r --skip-prereleases)
HUMAN_DATE=$(date +"%B %d, %Y") # Date in Janurary 1st, 2022 format
COMPLETE_VERSION="$LATEST_VERSION-$PRERELEASE_VERSION"

npx -y [email protected] merge -u "## $COMPLETE_VERSION ($HUMAN_DATE)"
;;
patch)
COMPLETE_VERSION=$(npx -y [email protected] next patch)
COMPLETE_VERSION=${COMPLETE_VERSION:1} # remove the v prefix
npx -y [email protected] batch patch
npx -y [email protected] merge
;;

release)
# This is the first release of the branch, releasing the new minor version
COMPLETE_VERSION=$(npx -y [email protected] latest -r --skip-prereleases)
# We currently keep a file that looks like this release to ensure the alphas and dev versions are generated correctly
rm ./.changes/$COMPLETE_VERSION.md

npx -y [email protected] batch $COMPLETE_VERSION
npx -y [email protected] merge
;;

*)
echo "invalid <release-type> argument"
usage
exit 1

;;
esac

# Set version/VERSION to the to be released version
echo "$COMPLETE_VERSION" > version/VERSION

# Add footer to the changelog
cat ./.changes/experiments.md >> CHANGELOG.md
echo "" >> CHANGELOG.md
cat ./.changes/previous-releases.md >> CHANGELOG.md
}

function cleanup {
RELEASED_VERSION="${1:-}"
NEXT_VERSION="${2:-}"

if [[ -z "$RELEASED_VERSION" || -z "$NEXT_VERSION" ]]; then
echo "missing at least one of [<released-version>, <next-version>] arguments"
usage
exit 1
fi

if [[ "$RELEASED_VERSION" == *-* ]]; then
# then we have a pre-release version, so we should replace the top line
sed -i '' -e "1s/.*/## $NEXT_VERSION (Unreleased)/" CHANGELOG.md
else
sed -i '' -e "1s/^/## $NEXT_VERSION (Unreleased)\n\n/" CHANGELOG.md
fi
function nextminor {
LATEST_VERSION=$(npx -y [email protected] 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

NEXT_VERSION=$(npx -y [email protected] next minor)
# Remove all existing per-release changelogs
rm ./.changes/*.*.*.md
# Remove all unreleased changes
rm ./.changes/unreleased/*.yaml
# Create a new empty version file for the next minor version
touch ./.changes/$NEXT_VERSION.md

generate "dev"
}

function main {
case "$1" in
prepare)
prepare "${@:2}"
generate)
generate "${@:2}"

;;
cleanup)
cleanup "${@:2}"
nextminor)
nextminor "${@:2}"

;;
*)
Expand Down

0 comments on commit 653e915

Please sign in to comment.