From 95f8cef0505dd2deb8ee5e45ab98c6ab1b764b02 Mon Sep 17 00:00:00 2001 From: Rico Hermans Date: Mon, 21 Aug 2023 17:05:49 +0200 Subject: [PATCH 01/15] fix(lambda-python): poetry bundling is broken after Aug 20 (#26823) The Dockerfile that builds an executable container to run `poetry` in installs the latest version of `poetry` on a Python 3.7 Docker image. Unfortunately `poetry 1.6.0`, released August 20, drops support for Python 3.7 which means that all poetry bundling jobs started failing on that date. `1.6.0` also does not work on Python 3.8, which I don't see mentioned in the change log, but our integration tests that use Python 3.8 are also broken. Lock the poetry version back to `1.5.1` by using a version specifier so the command is not dependent on the date it is run. This is the last version that supported both Python 3.7 and 3.8. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-lambda-python-alpha/lib/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python-alpha/lib/Dockerfile b/packages/@aws-cdk/aws-lambda-python-alpha/lib/Dockerfile index e61f15fcb0fa8..334b2a80ac4d9 100644 --- a/packages/@aws-cdk/aws-lambda-python-alpha/lib/Dockerfile +++ b/packages/@aws-cdk/aws-lambda-python-alpha/lib/Dockerfile @@ -6,6 +6,7 @@ FROM $IMAGE ARG PIP_INDEX_URL ARG PIP_EXTRA_INDEX_URL ARG HTTPS_PROXY +ARG POETRY_VERSION=1.5.1 # Add virtualenv path ENV PATH="/usr/app/venv/bin:$PATH" @@ -17,7 +18,7 @@ ENV PIP_CACHE_DIR=/tmp/pip-cache ENV POETRY_CACHE_DIR=/tmp/poetry-cache RUN \ -# create a new virtualenv for python to use +# create a new virtualenv for python to use # so that it isn't using root python -m venv /usr/app/venv && \ # Create a new location for the pip cache @@ -31,7 +32,7 @@ RUN \ # Ensure all users can write to poetry cache chmod -R 777 /tmp/poetry-cache && \ # pipenv 2022.4.8 is the last version with Python 3.6 support - pip install pipenv==2022.4.8 poetry && \ + pip install pipenv==2022.4.8 poetry==$POETRY_VERSION && \ # Ensure no temporary files remain in the caches rm -rf /tmp/pip-cache/* /tmp/poetry-cache/* From 26dcc1e11a07d93681145049aa06d80a7d2114b9 Mon Sep 17 00:00:00 2001 From: Calvin Combs <66279577+comcalvi@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:38:36 -0700 Subject: [PATCH 02/15] fix(CLI): diff reports wrong count of changed stacks (#26796) The current logic counts the number of changes in any parent stacks. It doesn't count nested stacks correctly, and doesn't count parent stacks correctly. With this change: Screenshot 2023-08-18 at 9 43 49 AM Without this change: Screenshot 2023-08-18 at 9 51 55 AM Closes #26818. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/deployments.ts | 10 +- .../aws-cdk/lib/api/nested-stack-helpers.ts | 28 +++++ packages/aws-cdk/lib/cdk-toolkit.ts | 16 ++- .../api/cloudformation-deployments.test.ts | 16 ++- packages/aws-cdk/test/diff.test.ts | 103 +++++++++++++----- 5 files changed, 135 insertions(+), 38 deletions(-) diff --git a/packages/aws-cdk/lib/api/deployments.ts b/packages/aws-cdk/lib/api/deployments.ts index a375bf25c4f65..cab9eb922a66d 100644 --- a/packages/aws-cdk/lib/api/deployments.ts +++ b/packages/aws-cdk/lib/api/deployments.ts @@ -6,7 +6,7 @@ import { ISDK } from './aws-auth/sdk'; import { CredentialsOptions, SdkForEnvironment, SdkProvider } from './aws-auth/sdk-provider'; import { deployStack, DeployStackResult, destroyStack, makeBodyParameterAndUpload, DeploymentMethod } from './deploy-stack'; import { HotswapMode } from './hotswap/common'; -import { loadCurrentTemplateWithNestedStacks, loadCurrentTemplate } from './nested-stack-helpers'; +import { loadCurrentTemplateWithNestedStacks, loadCurrentTemplate, flattenNestedStackNames, TemplateWithNestedStackCount } from './nested-stack-helpers'; import { ToolkitInfo } from './toolkit-info'; import { CloudFormationStack, Template, ResourcesToImport, ResourceIdentifierSummaries } from './util/cloudformation'; import { StackActivityProgress } from './util/cloudformation/stack-activity-monitor'; @@ -300,9 +300,13 @@ export class Deployments { public async readCurrentTemplateWithNestedStacks( rootStackArtifact: cxapi.CloudFormationStackArtifact, retrieveProcessedTemplate: boolean = false, - ): Promise