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

chore: update contribution guide with feature flag support for v2 #13084

Merged
merged 4 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,22 @@ 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.

#### CDKv2

We have started working on the next version of the CDK, specifically CDKv2. This is currently being maintained
on a separate branch `v2-main` whereas `master` continues to track versions `1.x`.

Feature flags introduced in the CDK 1.x and removed in 2.x, must be added to the `FUTURE_FLAGS_EXPIRED` list in
[cx-api/lib/features.ts](https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/cx-api/lib/features.ts)
on the `v2-main` branch.
This will make the default behaviour that the feature flag is enabled and would prevent customers to explicitly
disable the feature flag.

A couple of [jest helper methods] are available for use with unit tests. These help run unit tests that test
behaviour when flags are enabled or disabled in the two major versions.

[jest helper methods]: https://github.com/aws/aws-cdk/blob/master/tools/cdk-build-tools/lib/feature-flag.ts

### Versioning and Release

The `release.json` file at the root of the repo determines which release line
Expand Down
5 changes: 5 additions & 0 deletions packages/@aws-cdk/cx-api/test/features.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { testLegacyBehavior } from 'cdk-build-tools/lib/feature-flag';
import * as feats from '../lib/features';

test('all future flags have defaults configured', () => {
Object.keys(feats.FUTURE_FLAGS).forEach(flag => {
expect(typeof(feats.futureFlagDefault(flag))).toEqual('boolean');
});
});

testLegacyBehavior('FUTURE_FLAGS_DEFAULTS must be empty in CDKv1', Object, () => {
expect(feats.FUTURE_FLAGS_EXPIRED.length).toEqual(0);
});