From a1715e42944ba8a1d06513d288f2d28ca94eeccf Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 12:13:13 +0000 Subject: [PATCH] fix(lambda-python): asset files are generated inside the 'asset-input' folder (backport #18306) (#18341) This is an automatic backport of pull request #18306 done by [Mergify](https://mergify.com). ---
Mergify commands and options
More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport ` will backport this PR on `` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com
--- .../@aws-cdk/aws-lambda-python/lib/bundling.ts | 4 ++-- .../aws-lambda-python/test/bundling.test.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts b/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts index 37e52ac13435b..34dd54e3eee98 100644 --- a/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts +++ b/packages/@aws-cdk/aws-lambda-python/lib/bundling.ts @@ -86,8 +86,8 @@ export class Bundling implements CdkBundlingOptions { bundlingCommands.push(packaging.exportCommand ?? ''); if (packaging.dependenciesFile) { bundlingCommands.push(`python -m pip install -r ${DependenciesFile.PIP} -t ${options.outputDir}`); - }; - bundlingCommands.push(`cp -R ${options.inputDir} ${options.outputDir}`); + } + bundlingCommands.push(`cp -R ${options.inputDir}/ ${options.outputDir}`); return bundlingCommands; } } diff --git a/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts b/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts index 5e4cf194f5151..e5f91b2ea09b8 100644 --- a/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts +++ b/packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts @@ -36,7 +36,7 @@ test('Bundling a function without dependencies', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'cp -R /asset-input /asset-output', + 'cp -R /asset-input/ /asset-output', ], }), })); @@ -62,7 +62,7 @@ test('Bundling a function with requirements.txt', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'python -m pip install -r requirements.txt -t /asset-output && cp -R /asset-input /asset-output', + 'python -m pip install -r requirements.txt -t /asset-output && cp -R /asset-input/ /asset-output', ], }), })); @@ -81,7 +81,7 @@ test('Bundling Python 2.7 with requirements.txt installed', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'python -m pip install -r requirements.txt -t /asset-output && cp -R /asset-input /asset-output', + 'python -m pip install -r requirements.txt -t /asset-output && cp -R /asset-input/ /asset-output', ], }), })); @@ -101,7 +101,7 @@ test('Bundling a layer with dependencies', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input /asset-output/python', + 'python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input/ /asset-output/python', ], }), })); @@ -121,7 +121,7 @@ test('Bundling a python code layer', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'cp -R /asset-input /asset-output/python', + 'cp -R /asset-input/ /asset-output/python', ], }), })); @@ -141,7 +141,7 @@ test('Bundling a function with pipenv dependencies', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'PIPENV_VENV_IN_PROJECT=1 pipenv lock -r > requirements.txt && rm -rf .venv && python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input /asset-output/python', + 'PIPENV_VENV_IN_PROJECT=1 pipenv lock -r > requirements.txt && rm -rf .venv && python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input/ /asset-output/python', ], }), })); @@ -161,7 +161,7 @@ test('Bundling a function with poetry dependencies', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'poetry export --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input /asset-output/python', + 'poetry export --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input/ /asset-output/python', ], }), })); @@ -184,7 +184,7 @@ test('Bundling a function with custom bundling image', () => { image, command: [ 'bash', '-c', - 'python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input /asset-output/python', + 'python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input/ /asset-output/python', ], }), }));