Skip to content

Commit

Permalink
chore(cfnspec): prepare cfnspec update for autobump (#6557)
Browse files Browse the repository at this point in the history
* chore(cfnspec): prepare cfnspec update for autobump

`update-cfnspec.sh` is a single script that does the whole bump process
from a fresh repo.

`cfn.version` holds the current version of the CloudFormation version
which changes with the bump process. This is required by delivlib's bump
API here - https://github.com/awslabs/aws-delivlib/blob/0342978b78c5dd2c7bff2279d3b9a43c9e1f359c/lib/bump/bump.ts#L23-L27

* rename to bump

* tweaked per PR feedback

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and pull[bot] committed Apr 8, 2020
1 parent b9cbf23 commit 5276067
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
15 changes: 11 additions & 4 deletions packages/@aws-cdk/cfnspec/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# AWS CDK CloudFormation Tools

To update the CloudFormation spec to the latest version, run:
To update the CloudFormation spec, you can run `bump-cfnspec.sh` from a clean repo, as so -

npm run update
```
./scripts/bump-cfnspec.sh
```

If you wish to only update the CFN spec, make sure to install all dependencies and build the `cfnspec` module,
and then you can just run:

```
yarn update
```

Any JSON hashes are alpha-sorted to make sure that only actual changes appear in
diffs.
13 changes: 9 additions & 4 deletions packages/@aws-cdk/cfnspec/build-tools/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ update-spec \
spec-source/000_CloudFormationResourceSpecification.json \
true

echo >&2 "Recording new version..."
rm -f cfn.version
node -p "require('${scriptdir}/../spec-source/000_CloudFormationResourceSpecification.json').ResourceSpecificationVersion" > cfn.version

update-spec \
"Serverless Application Model (SAM) Resource Specification" \
"https://raw.githubusercontent.com/awslabs/goformation/master/generate/sam-2016-10-31.json" \
Expand All @@ -70,7 +74,8 @@ node ${scriptdir}/create-missing-libraries.js || {
(cd ${scriptdir}/../../../monocdk-experiment && node ./deps.js || true)

# append old changelog after new and replace as the last step because otherwise we will not be idempotent
cat CHANGELOG.md >> CHANGELOG.md.new
cp CHANGELOG.md.new CHANGELOG.md


_changelog_contents=$(cat CHANGELOG.md.new)
if [ -n "${_changelog_contents}" ]; then
cat CHANGELOG.md >> CHANGELOG.md.new
cp CHANGELOG.md.new CHANGELOG.md
fi
1 change: 1 addition & 0 deletions packages/@aws-cdk/cfnspec/cfn.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11.1.0
13 changes: 13 additions & 0 deletions scripts/bump-cfnspec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail

if [ ! -f "lerna.json" ]; then
echo "This script should be run from the root of the CDK repository"
exit 1
fi

./install.sh
cd packages/@aws-cdk/cfnspec
../../../scripts/buildup
yarn update
git commit -a -m "feat: cloudformation spec v$(cat cfn.version)" || true # don't fail if there are no updates

0 comments on commit 5276067

Please sign in to comment.