Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lambda-nodejs): pnpm installs frozen lockfile in a CI environment #24781

Merged
merged 4 commits into from
Mar 29, 2023
Merged

fix(lambda-nodejs): pnpm installs frozen lockfile in a CI environment #24781

merged 4 commits into from
Mar 29, 2023

Conversation

Tucker-Eric
Copy link
Contributor

pnpm automatically enables --frozen-lockfile in CI environments which breaks NodejsFunction local bundling.

This change appends the --no-prefer-frozen-lockfile flag as described in pnpm/pnpm#1994 (comment)


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Mar 24, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team March 24, 2023 16:24
@github-actions github-actions bot added the p2 label Mar 24, 2023
@Tucker-Eric Tucker-Eric changed the title Make pnpm install without frozen lockfile in a CI environment fix(NodejsFunction): Make pnpm install without frozen lockfile in a CI environment Mar 24, 2023
@Tucker-Eric Tucker-Eric changed the title fix(NodejsFunction): Make pnpm install without frozen lockfile in a CI environment fix(aws-lambda-nodejs): Make pnpm install without frozen lockfile in a CI environment Mar 24, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@Tucker-Eric Tucker-Eric changed the title fix(aws-lambda-nodejs): Make pnpm install without frozen lockfile in a CI environment fix(lambda-nodejs): Make pnpm install without frozen lockfile in a CI environment Mar 24, 2023
@Tucker-Eric
Copy link
Contributor Author

Looking for an Exemption Request for the integration test as well.

@TheRealAmazonKendra
Copy link
Contributor

Looking for an Exemption Request for the integration test as well.

To provide the exemption request, can you please describe how this was manually tested? I am inclined to agree that this is difficult to write an automated test for.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Mar 28, 2023
@TheRealAmazonKendra
Copy link
Contributor

I'm removing the exemption request label for now. Please use a quote reply to my last message to add it back when you respond to my question so I see that this needs another look.

Thanks for you work here!

@TheRealAmazonKendra TheRealAmazonKendra removed the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Mar 28, 2023
@Tucker-Eric
Copy link
Contributor Author

Looking for an Exemption Request for the integration test as well.

To provide the exemption request, can you please describe how this was manually tested? I am inclined to agree that this is difficult to write an automated test for.

Hey @TheRealAmazonKendra! Appreciate your help with this!

This was manually tested locally using the command dumped in the error output of the current command.
image

Removing/replacing the asset staging path with a local one and rerunning the same commands in order (with the CI=true env variable to mimmic a CI environment) the following commands were run.

without --no-prefer-frozen-lockfile

mkdir asset-staging && \
    echo '{"dependencies":{"pg":"8.10.0"}}' > "asset-staging/package.json" && \
    cp "pnpm-lock.yaml" "asset-staging/pnpm-lock.yaml" && \
    cd asset-staging && \
    CI=true pnpm install --config.node-linker=hoisted --config.package-import-method=clone-or-copy && \
    rm "node_modules/.modules.yaml"

with --no-prefer-frozen-lockfile

mkdir asset-staging && \
    echo '{"dependencies":{"pg":"8.10.0"}}' > "asset-staging/package.json" && \
    cp "pnpm-lock.yaml" "asset-staging/pnpm-lock.yaml" && \
    cd asset-staging && \
    CI=true pnpm install --config.node-linker=hoisted --config.package-import-method=clone-or-copy --no-prefer-frozen-lockfile && \
    rm "node_modules/.modules.yaml"

image

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Mar 29, 2023
@TheRealAmazonKendra TheRealAmazonKendra added pr-linter/exempt-integ-test The PR linter will not require integ test changes and removed pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Mar 29, 2023
@TheRealAmazonKendra TheRealAmazonKendra changed the title fix(lambda-nodejs): Make pnpm install without frozen lockfile in a CI environment fix(lambda-nodejs): pnpm installs frozen lockfile in a CI environment Mar 29, 2023
Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@aws-cdk-automation aws-cdk-automation dismissed their stale review March 29, 2023 22:16

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

@mergify
Copy link
Contributor

mergify bot commented Mar 29, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@TheRealAmazonKendra
Copy link
Contributor

TheRealAmazonKendra commented Mar 29, 2023

@Mergifyio refresh

@aws aws deleted a comment from mergify bot Mar 29, 2023
@aws aws deleted a comment from mergify bot Mar 29, 2023
@mergify
Copy link
Contributor

mergify bot commented Mar 29, 2023

refresh

✅ Pull request refreshed

@mergify
Copy link
Contributor

mergify bot commented Mar 29, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 764ca2e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 552cef4 into aws:main Mar 29, 2023
@mergify
Copy link
Contributor

mergify bot commented Mar 29, 2023

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@ofhouse
Copy link

ofhouse commented Apr 5, 2023

I there any ETA when this fix will be published?
Tested it with aws-cdk-lib@2.72.1 but it seems like this was not part of the release: https://unpkg.com/browse/aws-cdk-lib@2.72.1/aws-lambda-nodejs/lib/package-manager.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants