Skip to content

Commit

Permalink
Merge branch 'main' into addInterfaceEndpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo10Gama authored Nov 5, 2024
2 parents 8082505 + 9027cd2 commit a7a9d30
Show file tree
Hide file tree
Showing 368 changed files with 76,301 additions and 81,355 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/repo-metrics-weekly.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/request-cli-integ-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
git config --global user.email '[email protected]'
git push --force --atomic https://github.com/${{ github.repository }}.git FETCH_HEAD:test-main-pipeline
- name: Explain next steps
uses: thollander/actions-comment-pull-request@e2c37e53a7d2227b61585343765f73a9ca57eda9
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
with:
message: |
:arrow_right: **PR build request submitted to `test-main-pipeline`** :arrow_left:
Expand Down
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"packages/@aws-cdk-testing/*",
"packages/@aws-cdk/*/lambda-packages/*",
"tools/@aws-cdk/cdk-build-tools",
"tools/@aws-cdk/yargs-gen",
"tools/@aws-cdk/cdk-release",
"tools/@aws-cdk/node-bundle",
"tools/@aws-cdk/pkglint",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"standard-version": "^9.5.0",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "~5.4.5"
"typescript": "~5.5.2"
},
"resolutions": {
"colors": "1.4.0",
Expand Down Expand Up @@ -78,6 +78,7 @@
"packages/@aws-cdk-testing/*",
"packages/@aws-cdk/*/lambda-packages/*",
"tools/@aws-cdk/cdk-build-tools",
"tools/@aws-cdk/yargs-gen",
"tools/@aws-cdk/cdk-release",
"tools/@aws-cdk/node-bundle",
"tools/@aws-cdk/pkglint",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
const cdk = require('aws-cdk-lib');
const lambda = require('aws-cdk-lib/aws-lambda');
const sqs = require('aws-cdk-lib/aws-sqs');
const cr = require('aws-cdk-lib/custom-resources');

/**
* This stack will be deployed in multiple phases, to achieve a very specific effect
*
* It contains resources r1 and r2, where r1 gets deployed first.
* It contains resources r1 and r2, and a queue q, where r1 gets deployed first.
*
* - PHASE = 1: both resources deploy regularly.
* - PHASE = 2a: r1 gets updated, r2 will fail to update
* - PHASE = 2b: r1 gets updated, r2 will fail to update, and r1 will fail its rollback.
* - PHASE = 3: q gets replaced w.r.t. phases 1 and 2
*
* To exercise this app:
*
Expand All @@ -22,7 +24,7 @@ const cr = require('aws-cdk-lib/custom-resources');
* # This will start a rollback that will fail because r1 fails its rollabck
*
* env PHASE=2b npx cdk rollback --force
* # This will retry the rollabck and skip r1
* # This will retry the rollback and skip r1
* ```
*/
class RollbacktestStack extends cdk.Stack {
Expand All @@ -31,6 +33,7 @@ class RollbacktestStack extends cdk.Stack {

let r1props = {};
let r2props = {};
let fifo = false;

const phase = process.env.PHASE;
switch (phase) {
Expand All @@ -46,6 +49,9 @@ class RollbacktestStack extends cdk.Stack {
r1props.FailRollback = true;
r2props.FailUpdate = true;
break;
case '3':
fifo = true;
break;
}

const fn = new lambda.Function(this, 'Fun', {
Expand Down Expand Up @@ -76,6 +82,10 @@ class RollbacktestStack extends cdk.Stack {
properties: r2props,
});
r2.node.addDependency(r1);

new sqs.Queue(this, 'Queue', {
fifo,
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,103 @@ integTest(
}),
);

integTest(
'automatic rollback if paused and change contains a replacement',
withSpecificFixture('rollback-test-app', async (fixture) => {
let phase = '1';

// Should succeed
await fixture.cdkDeploy('test-rollback', {
options: ['--no-rollback'],
modEnv: { PHASE: phase },
verbose: false,
});
try {
phase = '2a';

// Should fail
const deployOutput = await fixture.cdkDeploy('test-rollback', {
options: ['--no-rollback'],
modEnv: { PHASE: phase },
verbose: false,
allowErrExit: true,
});
expect(deployOutput).toContain('UPDATE_FAILED');

// Do a deployment with a replacement and --force: this will roll back first and then deploy normally
phase = '3';
await fixture.cdkDeploy('test-rollback', {
options: ['--no-rollback', '--force'],
modEnv: { PHASE: phase },
verbose: false,
});
} finally {
await fixture.cdkDestroy('test-rollback');
}
}),
);

integTest(
'automatic rollback if paused and --no-rollback is removed from flags',
withSpecificFixture('rollback-test-app', async (fixture) => {
let phase = '1';

// Should succeed
await fixture.cdkDeploy('test-rollback', {
options: ['--no-rollback'],
modEnv: { PHASE: phase },
verbose: false,
});
try {
phase = '2a';

// Should fail
const deployOutput = await fixture.cdkDeploy('test-rollback', {
options: ['--no-rollback'],
modEnv: { PHASE: phase },
verbose: false,
allowErrExit: true,
});
expect(deployOutput).toContain('UPDATE_FAILED');

// Do a deployment removing --no-rollback: this will roll back first and then deploy normally
phase = '1';
await fixture.cdkDeploy('test-rollback', {
options: ['--force'],
modEnv: { PHASE: phase },
verbose: false,
});
} finally {
await fixture.cdkDestroy('test-rollback');
}
}),
);

integTest(
'automatic rollback if replacement and --no-rollback is removed from flags',
withSpecificFixture('rollback-test-app', async (fixture) => {
let phase = '1';

// Should succeed
await fixture.cdkDeploy('test-rollback', {
options: ['--no-rollback'],
modEnv: { PHASE: phase },
verbose: false,
});
try {
// Do a deployment with a replacement and removing --no-rollback: this will do a regular rollback deploy
phase = '3';
await fixture.cdkDeploy('test-rollback', {
options: ['--force'],
modEnv: { PHASE: phase },
verbose: false,
});
} finally {
await fixture.cdkDestroy('test-rollback');
}
}),
);

integTest(
'test cdk rollback --force',
withSpecificFixture('rollback-test-app', async (fixture) => {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"Properties": {
"Code": {
"S3Bucket": "cdk-hnb659fds-assets-12345678-us-east-1",
"S3Key": "3ea02d32123ecd935a42a15cebb9022338000fbc3eaa4f1700001dce79df9b8c.zip"
"S3Key": "bbfb567dc956ce71e67ac1f96589821990e2ca48307b93a577bbb345d2de441b.zip"
},
"Timeout": 900,
"MemorySize": 128,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"Properties": {
"Code": {
"S3Bucket": "cdk-hnb659fds-assets-12345678-us-east-2",
"S3Key": "2c44d9e4e14992db032760cf3293023d14f1ad5b047eb65bf25266aefb5eae08.zip"
"S3Key": "d6fa38886a871b64de769ec5016af90a071e6429aa8e7de84f595e4e2462e17d.zip"
},
"Timeout": 900,
"MemorySize": 128,
Expand Down
Loading

0 comments on commit a7a9d30

Please sign in to comment.