Skip to content

Commit

Permalink
chore(release): 2.34.2 (#21388)
Browse files Browse the repository at this point in the history
See [CHANGELOG](https://github.com/aws/aws-cdk/blob/patch/v2.34.2/CHANGELOG.v2.md)

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mergify[bot] authored Jul 29, 2022
2 parents ab3bb71 + 35a7a00 commit 7abcbc6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 55 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.34.2-alpha.0](https://github.com/aws/aws-cdk/compare/v2.34.1-alpha.0...v2.34.2-alpha.0) (2022-07-29)

## [2.34.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.34.0-alpha.0...v2.34.1-alpha.0) (2022-07-29)

### Bug Fixes
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.34.2](https://github.com/aws/aws-cdk/compare/v2.34.1...v2.34.2) (2022-07-29)

### Bug Fixes

* **cli:** context value type conversion causing parse failures ([21381](https://github.com/aws/aws-cdk/issues/21381))

## [2.34.1](https://github.com/aws/aws-cdk/compare/v2.34.0...v2.34.1) (2022-07-29)

### Bug Fixes
Expand Down
32 changes: 1 addition & 31 deletions packages/aws-cdk/lib/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,35 +300,6 @@ export class Settings {
return ret;
}

/**
* Context can be passed as CLI arguments in the format
* --context foo=bar
*
* The context value can be of any type, but when it is parsed
* it is always a string. Here we attempt to determine the actual
* type of the value.
*/
private static parseContextValue(contextValue: string): any {
// If the value is a JSON object, then we try and parse it and return
// the object.
try {
return JSON.parse(contextValue);
} catch {}
const num = parseFloat(contextValue);
// parseFloat tries to convert any string to a number, but
// if the string begins with a number it will convert that and
// ignore the rest so only return a number if the number and the
// string are the same
if (!isNaN(num) && num.toString() === contextValue) {
return num;
}
// The string value 'false' is truthy so explicitely check for 'false'
if (contextValue === 'false') {
return false;
}
return contextValue;
}

private static parseStringContextListToObject(argv: Arguments): any {
const context: any = {};

Expand All @@ -339,15 +310,14 @@ export class Settings {
if (parts[0].match(/^aws:.+/)) {
throw new Error(`User-provided context cannot use keys prefixed with 'aws:', but ${parts[0]} was provided.`);
}
context[parts[0]] = this.parseContextValue(parts[1]);
context[parts[0]] = parts[1];
} else {
warning('Context argument is not an assignment (key=value): %s', assignment);
}
}
return context;
}


/**
* Parse tags out of arguments
*
Expand Down
22 changes: 1 addition & 21 deletions packages/aws-cdk/test/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,6 @@ test('can parse string context from command line arguments with equals sign in v
expect(settings2.get(['context']).foo).toEqual( 'bar=');
});

test('can parse context from command line arguments and convert value to correct type', () => {
// GIVEN
const settings1 = Settings.fromCommandLineArguments({ context: ['foo=false'], _: [Command.DEPLOY] });
const settings2 = Settings.fromCommandLineArguments({ context: ['foo=0'], _: [Command.DEPLOY] });
const settings3 = Settings.fromCommandLineArguments({ context: ['foo=true'], _: [Command.DEPLOY] });
const settings4 = Settings.fromCommandLineArguments({ context: ['foo={"a": "b", "c": true, "d": ["a", "b"]}'], _: [Command.DEPLOY] });
const settings5 = Settings.fromCommandLineArguments({ context: ['foo=34'], _: [Command.DEPLOY] });
const settings6 = Settings.fromCommandLineArguments({ context: ['foo=34 35'], _: [Command.DEPLOY] });
const settings7 = Settings.fromCommandLineArguments({ context: ['foo=0x22'], _: [Command.DEPLOY] });

// THEN
expect(settings1.get(['context']).foo).toEqual(false);
expect(settings2.get(['context']).foo).toEqual(0);
expect(settings3.get(['context']).foo).toEqual(true);
expect(settings4.get(['context']).foo).toEqual({ a: 'b', c: true, d: ['a', 'b'] });
expect(settings5.get(['context']).foo).toEqual(34);
expect(settings6.get(['context']).foo).toEqual('34 35');
expect(settings7.get(['context']).foo).toEqual('0x22');
});

test('bundling stacks defaults to an empty list', () => {
// GIVEN
const settings = Settings.fromCommandLineArguments({
Expand Down Expand Up @@ -174,4 +154,4 @@ test('providing a build arg', () => {

// THEN
expect(settings.get(['build'])).toEqual('mvn package');
});
});
6 changes: 3 additions & 3 deletions version.v2.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.34.1",
"alphaVersion": "2.34.1-alpha.0"
}
"version": "2.34.2",
"alphaVersion": "2.34.2-alpha.0"
}

0 comments on commit 7abcbc6

Please sign in to comment.