Skip to content

Commit

Permalink
Merge branch 'main' into hotswap2
Browse files Browse the repository at this point in the history
  • Loading branch information
rix0rrr authored Mar 17, 2023
2 parents 444ed31 + dfa09d1 commit c85fdaa
Show file tree
Hide file tree
Showing 806 changed files with 20,303 additions and 9,310 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v3.1.0
- uses: hmarr/auto-approve-action@v3.2.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
1 change: 0 additions & 1 deletion .github/workflows/issue-label-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ env:
[
{"area":"package/tools","keywords":["cli","command line","init","synth","diff","bootstrap"],"labels":["package/tools"],"enableGlobalAffixes":false},
{"area":"@aws-cdk/alexa-ask","keywords":["alexa-ask","alexa"],"labels":["@aws-cdk/alexa-ask"]},
{"area":"@aws-cdk/assert","keywords":["assert"],"labels":["@aws-cdk/assert"]},
{"area":"@aws-cdk/assertions","keywords":["assertions"],"labels":["@aws-cdk/assertions"]},
{"area":"@aws-cdk/assets","keywords":["assets","staging"],"labels":["@aws-cdk/assets"]},
{"area":"@aws-cdk/aws-accessanalyzer","keywords":["aws-accessanalyzer","accessanalyzer"],"labels":["@aws-cdk/aws-accessanalyzer"]},
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@

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.69.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.68.0-alpha.0...v2.69.0-alpha.0) (2023-03-14)


### Features

* **kinesisanalytics-flink:** VPC support for Flink applications ([#24442](https://github.com/aws/aws-cdk/issues/24442)) ([7c7ad6d](https://github.com/aws/aws-cdk/commit/7c7ad6d18bd0d48a30858c1964d27d8a02b274ae)), closes [40aws-cdk/aws-lambda/lib/function.ts#L170](https://github.com/40aws-cdk/aws-lambda/lib/function.ts/issues/L170) [#21104](https://github.com/aws/aws-cdk/issues/21104)

## [2.68.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.67.0-alpha.0...v2.68.0-alpha.0) (2023-03-08)


### ⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES

* **servicecatalogappregistry:** This commit contains destructive changes to the RAM Share.
Since the application RAM share name is calculated by the application construct, where one property is removed. Integration test detects a breaking change where RAM share will be created. Integration test snapshot is updated to cater this destructive change.

### Features

* **msk:** add Kafka version 3.3.2 ([#24440](https://github.com/aws/aws-cdk/issues/24440)) ([1b2014e](https://github.com/aws/aws-cdk/commit/1b2014eef9e3f2190b2cce79c55f635cc1f167e3)), closes [#24432](https://github.com/aws/aws-cdk/issues/24432)
* **redshift:** column compression encodings and comments can now be customised ([#24177](https://github.com/aws/aws-cdk/issues/24177)) ([1ca3e00](https://github.com/aws/aws-cdk/commit/1ca3e0027323e84aacade4d9bd058bbc5687a7ab)), closes [#24165](https://github.com/aws/aws-cdk/issues/24165) [#23597](https://github.com/aws/aws-cdk/issues/23597) [#22506](https://github.com/aws/aws-cdk/issues/22506)
* **redshift:** columns require an id attribute (under feature flag) ([#24272](https://github.com/aws/aws-cdk/issues/24272)) ([9a07ab0](https://github.com/aws/aws-cdk/commit/9a07ab008d1b6d23e9a302921f1a5165a21fb128)), closes [#24234](https://github.com/aws/aws-cdk/issues/24234)


### Bug Fixes

* **servicecatalogappregistry:** allow disabling automatic CfnOutput ([#24483](https://github.com/aws/aws-cdk/issues/24483)) ([3db1a0d](https://github.com/aws/aws-cdk/commit/3db1a0d0bcf615871a225919eed235b78904e144)), closes [#23779](https://github.com/aws/aws-cdk/issues/23779)
* **servicecatalogappregistry:** Associate an application with attribute group ([#24378](https://github.com/aws/aws-cdk/issues/24378)) ([d1264c1](https://github.com/aws/aws-cdk/commit/d1264c1c414257fb8dd5288fdc24cfe9605cdf90))

## [2.67.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.66.1-alpha.0...v2.67.0-alpha.0) (2023-03-02)


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

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.69.0](https://github.com/aws/aws-cdk/compare/v2.68.0...v2.69.0) (2023-03-14)


### Features

* **custom-resources:** AwsCustomResource copy physicalResourceId from request when omit it in onUpdate ([#24194](https://github.com/aws/aws-cdk/issues/24194)) ([21ad7a7](https://github.com/aws/aws-cdk/commit/21ad7a7a0462a00c491ed104163d2065828a9aa1)), closes [#23843](https://github.com/aws/aws-cdk/issues/23843)
* **docdb:** added ability to enable performance insights ([#24039](https://github.com/aws/aws-cdk/issues/24039)) ([c897f44](https://github.com/aws/aws-cdk/commit/c897f44ea438487a8bf48053dead667c35cade02)), closes [#24036](https://github.com/aws/aws-cdk/issues/24036)
* **ecr-assets:** Support cache-from and cache-to flags ([#24024](https://github.com/aws/aws-cdk/issues/24024)) ([4e02566](https://github.com/aws/aws-cdk/commit/4e02566fab0f6c6708c9ee766e2805adbb329f18))
* **eks:** support for Kubernetes version 1.25 ([#24484](https://github.com/aws/aws-cdk/issues/24484)) ([70fd3e9](https://github.com/aws/aws-cdk/commit/70fd3e97e5b3555f4036ada6e562cec4359cadeb)), closes [#24282](https://github.com/aws/aws-cdk/issues/24282)
* **rds:** add support for minor versions of PostgreSQL: 14.7, 13.10, 12.14, and 11.19 ([#24539](https://github.com/aws/aws-cdk/issues/24539)) ([15cb919](https://github.com/aws/aws-cdk/commit/15cb919fab9d20d0e8f0485662131cbb10980269))
* **rds:** PostgreSQL engine version 15.2 ([#24463](https://github.com/aws/aws-cdk/issues/24463)) ([59d795b](https://github.com/aws/aws-cdk/commit/59d795b6e8d77b2d2d099169eaeb83a66c9d6a1a)), closes [#24462](https://github.com/aws/aws-cdk/issues/24462)


### Bug Fixes

* **custom-resource:** custom resources fail with data containing multi-byte utf8 chars ([#24501](https://github.com/aws/aws-cdk/issues/24501)) ([9bd5078](https://github.com/aws/aws-cdk/commit/9bd507842f567ee3e450c3f44e5c3dccc7c42ae6)), closes [#24491](https://github.com/aws/aws-cdk/issues/24491)
* **ecr-assets:** prefix cache arguments correctly ([#24524](https://github.com/aws/aws-cdk/issues/24524)) ([d451b30](https://github.com/aws/aws-cdk/commit/d451b3014a1d39e0a6ea18c2ec79a547b187adc5))
* **pipelines:** Ubuntu 5 images will be slow, move to Ubuntu 6 ([#24544](https://github.com/aws/aws-cdk/issues/24544)) ([1f62c43](https://github.com/aws/aws-cdk/commit/1f62c438fb68332a492b624bad65159cc9c0308f))
* **sfn:** can't override toStateJson() from other languages ([#24593](https://github.com/aws/aws-cdk/issues/24593)) ([e955d18](https://github.com/aws/aws-cdk/commit/e955d18052b8ec397c06ae6994b96bb7558e12bb)), closes [#14639](https://github.com/aws/aws-cdk/issues/14639)

## [2.68.0](https://github.com/aws/aws-cdk/compare/v2.67.0...v2.68.0) (2023-03-08)


### Bug Fixes

* **apprunner-alpha:** env vars and secrets can't solely be added via .add*() methods ([#24346](https://github.com/aws/aws-cdk/issues/24346)) ([45195b6](https://github.com/aws/aws-cdk/commit/45195b6f2e5162eaa795d3a412d89dd09680aa8b)), closes [#24345](https://github.com/aws/aws-cdk/issues/24345)
* **cli:** cannot `cdk import` resources with multiple identifiers ([#24439](https://github.com/aws/aws-cdk/issues/24439)) ([a70ff1a](https://github.com/aws/aws-cdk/commit/a70ff1ad332af780c052e3117b73df060deee7ae)), closes [#20895](https://github.com/aws/aws-cdk/issues/20895)
* **core:** Fix dotnet version check to allow .NET 7.0 ([#24467](https://github.com/aws/aws-cdk/issues/24467)) ([a4856e9](https://github.com/aws/aws-cdk/commit/a4856e997684f84476fe92e00afcd4da76a69b04)), closes [#24466](https://github.com/aws/aws-cdk/issues/24466)
* **lambda-nodejs:** esbuild preCompilation tsconfig precedence is wrong ([#23871](https://github.com/aws/aws-cdk/issues/23871)) ([790a709](https://github.com/aws/aws-cdk/commit/790a709d758333f4622c5fb860d9bbb48dee7106))
* **lambda-nodejs:** Required auto prefix of `handler` with `index.` breaks custom non-`index` handler settings used by layers ([#24406](https://github.com/aws/aws-cdk/issues/24406)) ([d7a1c34](https://github.com/aws/aws-cdk/commit/d7a1c34e540e12413319918a5d807060057a1a1b)), closes [#24403](https://github.com/aws/aws-cdk/issues/24403)
* **rds:** add clusterResourceIdentifier property to database cluster ([#23605](https://github.com/aws/aws-cdk/issues/23605)) ([6bda4e5](https://github.com/aws/aws-cdk/commit/6bda4e5ae4205a917a00714433f136550c59e409))

## [2.67.0](https://github.com/aws/aws-cdk/compare/v2.66.1...v2.67.0) (2023-03-02)


Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"@types/node": "18.11.19",
"@types/prettier": "2.6.0",
"@yarnpkg/lockfile": "^1.1.0",
"cdk-generate-synthetic-examples": "^0.1.167",
"cdk-generate-synthetic-examples": "^0.1.173",
"conventional-changelog-cli": "^2.2.2",
"fs-extra": "^9.1.0",
"graceful-fs": "^4.2.10",
"jest-junit": "^13.2.0",
"jsii-diff": "1.76.0",
"jsii-pacmak": "1.76.0",
"jsii-reflect": "1.76.0",
"jsii-diff": "1.77.0",
"jsii-pacmak": "1.77.0",
"jsii-reflect": "1.77.0",
"jsii-rosetta": "v4.9-next",
"lerna": "^4.0.0",
"patch-package": "^6.5.1",
Expand Down
11 changes: 10 additions & 1 deletion packages/@aws-cdk-testing/cli-integ/lib/integ-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export interface TestContext {
log(s: string): void;
};

if (process.env.JEST_TEST_CONCURRENT === 'true') {
process.stderr.write('ℹ️ JEST_TEST_CONCURRENT is true: tests will run concurrently and filters have no effect!');
}

/**
* A wrapper for jest's 'test' which takes regression-disabled tests into account and prints a banner
*/
Expand All @@ -18,7 +22,6 @@ export function integTest(
callback: (context: TestContext) => Promise<void>,
timeoutMillis?: number,
): void {

// Integ tests can run concurrently, and are responsible for blocking
// themselves if they cannot. Because `test.concurrent` executes the test
// code immediately, regardles of any `--testNamePattern`, this cannot be the
Expand All @@ -35,6 +38,8 @@ export function integTest(
output.write(`${name}\n`);
output.write('================================================================\n');

const now = Date.now();
process.stderr.write(`[INTEG TEST::${name}] Starting (pid ${process.pid})...\n`);
try {
return await callback({
output,
Expand All @@ -44,13 +49,17 @@ export function integTest(
},
});
} catch (e) {
process.stderr.write(`[INTEG TEST::${name}] Failed: ${e}\n`);
output.write(e.message);
output.write(e.stack);
// Print output only if the test fails. Use 'console.log' so the output is buffered by
// jest and prints without a stack trace (if verbose: false).
// eslint-disable-next-line no-console
console.log(output.buffer().toString());
throw e;
} finally {
const duration = Date.now() - now;
process.stderr.write(`[INTEG TEST::${name}] Done (${duration} ms).\n`);
}
}, timeoutMillis);
}
Expand Down
16 changes: 6 additions & 10 deletions packages/@aws-cdk-testing/cli-integ/lib/resource-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ export class ResourcePool<A extends string=string> {
while (true) {
// Start a wait on the unlock now -- if the unlock signal comes after
// we try to acquire but before we start the wait, we might miss it.
const wait = this.pool.awaitUnlock(5000);
//
// (The timeout is in case the unlock signal doesn't come for whatever reason).
const wait = this.pool.awaitUnlock(10_000);

for (const res of this.unlockedResources()) {
// Try all mutexes, we might need to reacquire an expired lock
for (const res of this.resources) {
const lease = await this.tryObtainLease(res);
if (lease) {
// Ignore the wait (count as handled)
Expand Down Expand Up @@ -86,7 +89,7 @@ export class ResourcePool<A extends string=string> {
let disposed = false;
return {
value,
dispose: () => {
dispose: async () => {
if (disposed) {
throw new Error('Calling dispose() on an already-disposed lease.');
}
Expand All @@ -107,13 +110,6 @@ export class ResourcePool<A extends string=string> {
delete this.locks[value];
await lock?.release();
}

/**
* Return all resources that we definitely don't own the locks for
*/
private unlockedResources(): A[] {
return this.resources.filter(res => !this.locks[res]);
}
}

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/@aws-cdk-testing/cli-integ/lib/staging/maven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export async function uploadJavaPackages(packages: string[], login: LoginInforma
console.log(`❌ ${pkg}: already exists. Skipped.`);
return 'skip';
}
if (output.toString().includes('Too Many Requests')) {
console.log(`♻️ ${pkg}: Too many requests. Retrying.`);
return 'retry';
}
return 'fail';
});
}
Expand Down
5 changes: 4 additions & 1 deletion packages/@aws-cdk-testing/cli-integ/lib/with-cdk-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { packageSourceInSubprocess } from './package-sources/subprocess';
import { RESOURCES_DIR } from './resources';
import { shell, ShellOptions, ShellHelper, rimraf } from './shell';
import { AwsContext, withAws } from './with-aws';
import { withTimeout } from './with-timeout';

export const DEFAULT_TEST_TIMEOUT_S = 10 * 60;

/**
* Higher order function to execute a block with a CDK app fixture
Expand Down Expand Up @@ -135,7 +138,7 @@ export function withMonolithicCfnIncludeCdkApp<A extends TestContext>(block: (co
* test declaration but centralizing it is going to make it convenient to modify in the future.
*/
export function withDefaultFixture(block: (context: TestFixture) => Promise<void>) {
return withAws(withCdkApp(block));
return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withCdkApp(block)));
}

export interface DisableBootstrapContext {
Expand Down
30 changes: 24 additions & 6 deletions packages/@aws-cdk-testing/cli-integ/lib/with-sam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { TestContext } from './integ-test';
import { RESOURCES_DIR } from './resources';
import { ShellOptions, rimraf } from './shell';
import { AwsContext, withAws } from './with-aws';
import { cloneDirectory, installNpmPackages, TestFixture } from './with-cdk-app';
import { cloneDirectory, installNpmPackages, TestFixture, DEFAULT_TEST_TIMEOUT_S } from './with-cdk-app';
import { withTimeout } from './with-timeout';


export interface ActionOutput {
Expand Down Expand Up @@ -113,7 +114,7 @@ function errorCausedByGoPkg(error: string) {
* SAM Integration test fixture for CDK - SAM integration test cases
*/
export function withSamIntegrationFixture(block: (context: SamIntegrationTestFixture) => Promise<void>) {
return withAws(withSamIntegrationCdkApp(block));
return withAws(withTimeout(DEFAULT_TEST_TIMEOUT_S, withSamIntegrationCdkApp(block)));
}

export class SamIntegrationTestFixture extends TestFixture {
Expand All @@ -139,7 +140,7 @@ export class SamIntegrationTestFixture extends TestFixture {
args.push('--port');
args.push(port.toString());

return this.samShell(['sam', 'local', 'start-api', ...args], '(Press CTRL+C to quit)', ()=>{
return this.samShell(['sam', 'local', 'start-api', ...args], 'Press CTRL+C to quit', ()=>{
return new Promise<ActionOutput>((resolve, reject) => {
axios.get(`http://127.0.0.1:${port}${apiPath}`).then( resp => {
resolve(resp.data);
Expand Down Expand Up @@ -172,7 +173,12 @@ export function randomInteger(min: number, max: number) {
* Is platform-aware, handles errors nicely.
*/
export async function shellWithAction(
command: string[], filter?: string, action?: () => Promise<any>, options: ShellOptions = {}): Promise<ActionOutput> {
command: string[],
filter?: string,
action?: () => Promise<any>,
options: ShellOptions = {},
actionTimeoutSeconds: number = 600,
): Promise<ActionOutput> {
if (options.modEnv && options.env) {
throw new Error('Use either env or modEnv but not both');
}
Expand All @@ -198,8 +204,8 @@ export async function shellWithAction(
let actionExecuted = false;

function executeAction(chunk: any) {
out.push(chunk);
if (!actionExecuted && typeof filter === 'string' && out.toString().includes(filter) && typeof action === 'function') {
out.push(Buffer.from(chunk));
if (!actionExecuted && typeof filter === 'string' && Buffer.concat(out).toString('utf-8').includes(filter) && typeof action === 'function') {
actionExecuted = true;
options.output?.write('before executing action');
action().then((output) => {
Expand All @@ -217,6 +223,18 @@ export async function shellWithAction(
}
}

if (typeof filter === 'string' && typeof action === 'function') {
// Reject with an error if an action is configured, but the filter failed
// to show up in the output before the timeout occurred.
setTimeout(
() => {
if (!actionExecuted) {
reject(new Error(`Timed out waiting for filter ${JSON.stringify(filter)} to appear in command output after ${actionTimeoutSeconds} seconds\nOutput so far:\n${Buffer.concat(out).toString('utf-8')}`));
}
}, actionTimeoutSeconds * 1_000,
).unref();
}

child.stdout!.on('data', chunk => {
options.output?.write(chunk);
stdout.push(chunk);
Expand Down
33 changes: 33 additions & 0 deletions packages/@aws-cdk-testing/cli-integ/lib/with-timeout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Run a block with a timeout
*
* We can't use the jest timeout feature:
*
* - `jest.concurrent()` does not do any concurrency management. It starts all
* tests at the same time.
* - Our tests use locking to make sure only one test is running at a time per
* region.
*
* The wait time for the locks is included in the jest test timeout. We therefore
* need to set it unreasonably high (as long as the last test may need to wait
* if all tests are executed using only 1 region, and they effectively execute
* sequentially), which makes it not useful to detect stuck tests.
*
* The `withTimeout()` modifier makes it possible to measure only a specific
* block of code. In our case: the effective test code, excluding the wait time.
*/
export function withTimeout<A>(seconds: number, block: (x: A) => Promise<void>) {
return (x: A) => {
const timeOut = new Promise<void>((_ok, ko) => {
const timerHandle = setTimeout(
() => ko(new Error(`Timeout: test took more than ${seconds}s to complete`)),
seconds * 1000);
timerHandle.unref();
});

return Promise.race([
block(x),
timeOut,
]);
};
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk-testing/cli-integ/lib/xpmutex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class XpMutex {
// signal due to unfortunate timing.
const wait = this.pool.awaitUnlock(5000);

const lock = await this.acquire();
const lock = await this.tryAcquire();
if (lock) {
// Ignore the wait (count as handled)
wait.then(() => {}, () => {});
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk-testing/cli-integ/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@octokit/rest": "^18.12.0",
"aws-sdk": "^2.1325.0",
"aws-sdk": "^2.1329.0",
"axios": "^0.27.2",
"fs-extra": "^9.1.0",
"glob": "^7.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test('double dispose throws', async () => {
const lease = await pool.take();

await lease.dispose();
expect(() => lease.dispose()).toThrow();
await expect(() => lease.dispose()).rejects.toThrow();
});

test('somewhat balance', async () => {
Expand Down
Loading

0 comments on commit c85fdaa

Please sign in to comment.