Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion .github/MAINTENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ The following Actions either need to be manually triggered or require significan
2. Update the [object](https://github.com/cdktf/cdktf-tf-module-stack/blob/b9939ad9f3bc6bc5bd7a4f348c953d776778506d/.projenrc.ts#L15-L29)
3. Run `npx projen`
4. Create a new PR with the title `chore(deps): update pinned versions of GitHub Actions`
- **`constructs` library upgrades**: Because `constructs` is a peer dependency, the `upgrade-main` script described above will _never_ increment its version; this will always need to be done manually by [editing](https://github.com/cdktf/cdktf-tf-module-stack/blob/b9939ad9f3bc6bc5bd7a4f348c953d776778506d/.projenrc.ts#L91) `.projenrc.ts`. This could _in theory_ be (semi)automated like some of our other upgrade workflows described above for things like CDKTF, Node, and JSII, but in practice we currently have no logic or criteria that governs when `constructs` should be updated; as such, creating a custom workflow for it felt like more effort than it's really worth.

Also worth noting: Unlike many of our other Projen-based projects, this one does not have a script that automatically upgrades Node.js because this library does not enforce a `minNodeVersion`. If we did at some point want to start enforcing a `minNodeVersion`, we should copy over the `upgrade-node` script that our other Projen projects use.

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/upgrade-cdktf.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const githubActionPinnedVersions = {
"peter-evans/create-pull-request": "67ccf781d68cd99b580ae25a5c18a1cc84ffff1f", // v7.0.6
};

/** JSII and TSII should always use the same major/minor version range */
const constructsVersion = "10.0.25";
/** JSII and TS should always use the same major/minor version range */
const typescriptVersion = "~5.5.0";
const project = new ConstructLibraryCdktf({
author: "HashiCorp",
Expand Down Expand Up @@ -88,7 +89,7 @@ new Automerge(project);
new UpgradeCDKTF(project);
new UpgradeJSIIAndTypeScript(project, typescriptVersion);

project.addPeerDeps("cdktf@>=0.20.0", "constructs@^10.0.25");
project.addPeerDeps("cdktf@>=0.20.0", `constructs@^${constructsVersion}`);
project.addDevDeps(
"semver",
"@types/semver",
Expand Down
5 changes: 4 additions & 1 deletion projenrc/upgrade-cdktf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,19 @@ export class UpgradeCDKTF {
run: [
`CDKTF_VERSION=$(yarn info cdktf --json | jq -r '.data.version')`,
`CDKTF_VERSION_SHORT=$(cut -d "." -f 2 <<< "$CDKTF_VERSION")`,
`CONSTRUCTS_VERSION=$(yarn info cdktf --json | jq -r '.data.peerDependencies.constructs')`,
`CONSTRUCTS_VERSION_EXACT=$(cut -d "^" -f 2 <<< "$CONSTRUCTS_VERSION")`, // strip the caret off the beginning
`echo "value=$CDKTF_VERSION" >> $GITHUB_OUTPUT`,
`echo "short=$CDKTF_VERSION_SHORT" >> $GITHUB_OUTPUT`,
`echo "constructs=$CONSTRUCTS_VERSION_EXACT" >> $GITHUB_OUTPUT`,
].join("\n"),
// IMPORTANT: the above behavior changed in Yarn 2+; `yarn info` instead gives the version of the installed package
// If/when we upgrade we'll likely want to switch to `yarn npm info`: https://yarnpkg.com/cli/npm/info
},
{
name: "Run upgrade script",
if: "steps.current_version.outputs.short != steps.latest_version.outputs.short",
run: "scripts/update-cdktf.sh ${{ steps.latest_version.outputs.value }}",
run: "scripts/update-cdktf.sh ${{ steps.latest_version.outputs.value }} ${{ steps.latest_version.outputs.constructs }}",
},
{
name: "Create draft pull request",
Expand Down
11 changes: 9 additions & 2 deletions scripts/update-cdktf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,24 @@ set -ex

PROJECT_ROOT=$(cd "$(dirname "${BASH_SOURCE:-$0}")/.." && pwd)
CDKTF_VERSION=$1
CONSTRUCTS_VERSION=$2

if [ -z "$CDKTF_VERSION" ]; then
echo "Usage: $0 <cdktf-version>"
echo "Usage: $0 <cdktf-version> <constructs-version>"
exit 1
fi
if [ -z "$CONSTRUCTS_VERSION" ]; then
echo "Usage: $0 <cdktf-version> <constructs-version>"
exit 1
fi

echo "Updating to cdktf version $CDKTF_VERSION"
echo "Updating to cdktf version $CDKTF_VERSION and constructs version $CONSTRUCTS_VERSION"
yarn
sed -i "s/cdktfVersion: \".*\",/cdktfVersion: \"$CDKTF_VERSION\",/" "$PROJECT_ROOT/.projenrc.ts"
sed -i "s/\"cdktf@.*\",/\"cdktf@>=$CDKTF_VERSION\",/" "$PROJECT_ROOT/.projenrc.ts"
sed -i "s/constructsVersion = \".*\";/constructsVersion = \"$CONSTRUCTS_VERSION\";/" "$PROJECT_ROOT/.projenrc.ts"
CI=0 npx projen

echo "Updating README"
sed -i 's/`cdktf` >= .*/`cdktf` >= '"$CDKTF_VERSION"'/' "$PROJECT_ROOT/README.md"
sed -i 's/`constructs` >= .*/`constructs` >= '"$CONSTRUCTS_VERSION"'/' "$PROJECT_ROOT/README.md"
Loading