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

feat(contributors): use 0.0.0 as a version marker #6463

Merged
merged 8 commits into from
Feb 26, 2020
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
6 changes: 3 additions & 3 deletions .github/actions/prlinter/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "prlinter",
"private": true,
"version": "999.0.0",
"version": "0.0.0",
"description": "",
"main": "index.js",
"keywords": [],
"license": "Apache-2.0",
"license": "Apache-2.0",
"author": {
"name": "Amazon Web Services",
"url": "https://aws.amazon.com",
Expand All @@ -16,4 +16,4 @@
"@actions/github": "^2.1.0",
"prlint": "file:../../../tools/prlint"
}
}
}
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ and let us know if it's not up-to-date (even better, submit a PR with your corr
- [API Compatibility Checks](#api-compatibility-checks)
- [Examples](#examples)
- [Feature Flags](#feature-flags)
- [Versioning](#versioning)
- [Troubleshooting](#troubleshooting)
- [Debugging](#debugging)
- [Connecting the VS Code Debugger](#connecting-the-vs-code-debugger)
Expand Down Expand Up @@ -381,6 +382,12 @@ If you also wish to package to all languages, make sure you have all the [toolch
$ ./pack.sh
```

> NOTE: in local builds, pack.sh will finish but will fail with an error
> indicating the build artifacts use the marker version (`0.0.0`). This is
> normal, and you can trust the output in `dist/` despite the failure. This is a
> protection we have to make sure we don't accidentally release artifacts with
> the marker version.

### Full Docker build

Clone the repo:
Expand Down Expand Up @@ -659,6 +666,25 @@ CDK](https://github.com/aws/aws-cdk/issues/3398) we will either remove the
legacy behavior or flip the logic for all these features and then
reset the `FEATURE_FLAGS` map for the next cycle.

### Versioning

All `package.json` files in this repo use a stable marker version of `0.0.0`.
This means that when you declare dependencies, you should always use `0.0.0`.
This makes it easier for us to bump a new version (the `bump.sh` script will
just update the central version and create a CHANGELOG entry) and also reduces
the chance of merge conflicts after a new version is released.

Additional scripts that take part in the versioning mechanism:

- `scripts/get-version.js` can be used to obtain the actual version of the repo.
You can use either from JavaScript code by `require('./scripts/get-version')`
or from a shell script `node -p "require('./scripts/get-version')"`.
- `scripts/get-version-marker.js` returns `0.0.0` and used to DRY the version
marker.
- `scripts/align-version.sh` and `scripts/align-version.js` are used to align
all package.json files in the repo to the official version. This script is
invoked in CI builds and should not be used inside a development environment.

## Troubleshooting

Most build issues can be solved by doing a full clean rebuild:
Expand Down
20 changes: 18 additions & 2 deletions pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ done
# Remove a JSII aggregate POM that may have snuk past
rm -rf dist/java/software/amazon/jsii

# Get version from lerna
version="$(cat ${root}/lerna.json | grep version | cut -d '"' -f4)"
# Get version
version="$(node -p "require('./scripts/get-version')")"

# Ensure we don't publish anything beyond 1.x for now
if [[ ! "${version}" == "1."* ]]; then
echo "ERROR: accidentally releasing a major version? Expecting repo version to start with '1.' but got '${version}'"
exit 1
fi

# Get commit from CodePipeline (or git, if we are in CodeBuild)
# If CODEBUILD_RESOLVED_SOURCE_VERSION is not defined (i.e. local
Expand All @@ -79,6 +85,16 @@ HERE
# copy CHANGELOG.md to dist/ for github releases
cp CHANGELOG.md ${distdir}/

# defensive: make sure our artifacts don't use the version marker (this means
# that "pack" will always fails when building in a dev environment)
# when we get to 10.0.0, we can fix this...
marker=$(node -p "require('./scripts/get-version-marker')")
if find dist/ | grep "${marker}"; then
echo "ERROR: build artifacts use the version marker '${marker}' instead of a real version."
echo "This is expected for builds in a development environment but should not happen in CI builds!"
eladb marked this conversation as resolved.
Show resolved Hide resolved
exit 1
fi

# for posterity, print all files in dist
echo "=============================================================================================="
echo " dist contents"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-cdk",
"version": "999.0.0",
"version": "0.0.0",
"private": true,
"pkglint": {
"include": "dependencies/node-version"
Expand Down Expand Up @@ -58,4 +58,4 @@
"@aws-cdk/cx-api/semver/**"
]
}
}
}
14 changes: 7 additions & 7 deletions packages/@aws-cdk/alexa-ask/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-cdk/alexa-ask",
"version": "999.0.0",
"version": "0.0.0",
"description": "The CDK Construct Library for Alexa::ASK",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -80,16 +80,16 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "999.0.0",
"cdk-build-tools": "999.0.0",
"cfn2ts": "999.0.0",
"pkglint": "999.0.0"
"@aws-cdk/assert": "0.0.0",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
"pkglint": "0.0.0"
},
"dependencies": {
"@aws-cdk/core": "999.0.0"
"@aws-cdk/core": "0.0.0"
},
"peerDependencies": {
"@aws-cdk/core": "999.0.0"
"@aws-cdk/core": "0.0.0"
},
"engines": {
"node": ">= 10.3.0"
Expand Down
44 changes: 22 additions & 22 deletions packages/@aws-cdk/app-delivery/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aws-cdk/app-delivery",
"description": "Continuous Integration / Continuous Delivery for CDK Applications",
"version": "999.0.0",
"version": "0.0.0",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"jsii": {
Expand Down Expand Up @@ -40,24 +40,24 @@
"compat": "cdk-compat"
},
"dependencies": {
"@aws-cdk/aws-cloudformation": "999.0.0",
"@aws-cdk/aws-codebuild": "999.0.0",
"@aws-cdk/aws-codepipeline": "999.0.0",
"@aws-cdk/aws-codepipeline-actions": "999.0.0",
"@aws-cdk/aws-events": "999.0.0",
"@aws-cdk/aws-iam": "999.0.0",
"@aws-cdk/core": "999.0.0",
"@aws-cdk/cx-api": "999.0.0"
"@aws-cdk/aws-cloudformation": "0.0.0",
"@aws-cdk/aws-codebuild": "0.0.0",
"@aws-cdk/aws-codepipeline": "0.0.0",
"@aws-cdk/aws-codepipeline-actions": "0.0.0",
"@aws-cdk/aws-events": "0.0.0",
"@aws-cdk/aws-iam": "0.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0"
},
"devDependencies": {
"@aws-cdk/assert": "999.0.0",
"@aws-cdk/aws-s3": "999.0.0",
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/aws-s3": "0.0.0",
"@types/nodeunit": "^0.0.30",
"cdk-build-tools": "999.0.0",
"cdk-integ-tools": "999.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"fast-check": "^1.22.2",
"nodeunit": "^0.11.3",
"pkglint": "999.0.0"
"pkglint": "0.0.0"
},
"repository": {
"type": "git",
Expand All @@ -76,14 +76,14 @@
"cdk"
],
"peerDependencies": {
"@aws-cdk/aws-cloudformation": "999.0.0",
"@aws-cdk/aws-codebuild": "999.0.0",
"@aws-cdk/aws-codepipeline": "999.0.0",
"@aws-cdk/aws-codepipeline-actions": "999.0.0",
"@aws-cdk/aws-events": "999.0.0",
"@aws-cdk/aws-iam": "999.0.0",
"@aws-cdk/core": "999.0.0",
"@aws-cdk/cx-api": "999.0.0"
"@aws-cdk/aws-cloudformation": "0.0.0",
"@aws-cdk/aws-codebuild": "0.0.0",
"@aws-cdk/aws-codepipeline": "0.0.0",
"@aws-cdk/aws-codepipeline-actions": "0.0.0",
"@aws-cdk/aws-events": "0.0.0",
"@aws-cdk/aws-iam": "0.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0"
},
"engines": {
"node": ">= 10.3.0"
Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-cdk/assert",
"version": "999.0.0",
"version": "0.0.0",
"description": "An assertion library for use with CDK Apps",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -30,18 +30,18 @@
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^25.1.2",
"cdk-build-tools": "999.0.0",
"cdk-build-tools": "0.0.0",
"jest": "^24.9.0",
"pkglint": "999.0.0",
"pkglint": "0.0.0",
"ts-jest": "^25.2.0"
},
"dependencies": {
"@aws-cdk/cloudformation-diff": "999.0.0",
"@aws-cdk/core": "999.0.0",
"@aws-cdk/cx-api": "999.0.0"
"@aws-cdk/cloudformation-diff": "0.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0"
},
"peerDependencies": {
"@aws-cdk/core": "999.0.0",
"@aws-cdk/core": "0.0.0",
"jest": "^24.9.0"
},
"repository": {
Expand Down
20 changes: 10 additions & 10 deletions packages/@aws-cdk/assets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-cdk/assets",
"version": "999.0.0",
"version": "0.0.0",
"description": "Integration of CDK apps with local assets",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -63,27 +63,27 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "999.0.0",
"@aws-cdk/assert": "0.0.0",
"@types/minimatch": "^3.0.3",
"@types/nodeunit": "^0.0.30",
"@types/sinon": "^7.5.2",
"aws-cdk": "999.0.0",
"cdk-build-tools": "999.0.0",
"cdk-integ-tools": "999.0.0",
"aws-cdk": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"nodeunit": "^0.11.3",
"pkglint": "999.0.0",
"pkglint": "0.0.0",
"sinon": "^9.0.0",
"ts-mock-imports": "^1.2.6"
},
"dependencies": {
"@aws-cdk/core": "999.0.0",
"@aws-cdk/cx-api": "999.0.0",
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0",
"minimatch": "^3.0.4"
},
"homepage": "https://github.com/aws/aws-cdk",
"peerDependencies": {
"@aws-cdk/core": "999.0.0",
"@aws-cdk/cx-api": "999.0.0"
"@aws-cdk/core": "0.0.0",
"@aws-cdk/cx-api": "0.0.0"
},
"engines": {
"node": ">= 10.3.0"
Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-accessanalyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-cdk/aws-accessanalyzer",
"version": "999.0.0",
"version": "0.0.0",
"description": "The CDK Construct Library for AWS::AccessAnalyzer",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -81,16 +81,16 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "999.0.0",
"cdk-build-tools": "999.0.0",
"cfn2ts": "999.0.0",
"pkglint": "999.0.0"
"@aws-cdk/assert": "0.0.0",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
"pkglint": "0.0.0"
},
"dependencies": {
"@aws-cdk/core": "999.0.0"
"@aws-cdk/core": "0.0.0"
},
"peerDependencies": {
"@aws-cdk/core": "999.0.0"
"@aws-cdk/core": "0.0.0"
},
"engines": {
"node": ">= 10.3.0"
Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-acmpca/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-cdk/aws-acmpca",
"version": "999.0.0",
"version": "0.0.0",
"description": "The CDK Construct Library for AWS::ACMPCA",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -81,16 +81,16 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "999.0.0",
"cdk-build-tools": "999.0.0",
"cfn2ts": "999.0.0",
"pkglint": "999.0.0"
"@aws-cdk/assert": "0.0.0",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
"pkglint": "0.0.0"
},
"dependencies": {
"@aws-cdk/core": "999.0.0"
"@aws-cdk/core": "0.0.0"
},
"peerDependencies": {
"@aws-cdk/core": "999.0.0"
"@aws-cdk/core": "0.0.0"
},
"engines": {
"node": ">= 10.3.0"
Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-amazonmq/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aws-cdk/aws-amazonmq",
"version": "999.0.0",
"version": "0.0.0",
"description": "The CDK Construct Library for AWS::AmazonMQ",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -80,16 +80,16 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "999.0.0",
"cdk-build-tools": "999.0.0",
"cfn2ts": "999.0.0",
"pkglint": "999.0.0"
"@aws-cdk/assert": "0.0.0",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
"pkglint": "0.0.0"
},
"dependencies": {
"@aws-cdk/core": "999.0.0"
"@aws-cdk/core": "0.0.0"
},
"peerDependencies": {
"@aws-cdk/core": "999.0.0"
"@aws-cdk/core": "0.0.0"
},
"engines": {
"node": ">= 10.3.0"
Expand Down
Loading