Skip to content

[plugin] Use LAMBDA_USE_LOCAL_DEPS env var in local builds with docker #325

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

Merged
merged 2 commits into from
May 22, 2024

Conversation

sebsto
Copy link
Contributor

@sebsto sebsto commented May 13, 2024

Use the newly introduced LAMBDA_USE_LOCAL_DEPS environment variable inside Docker to allow to build Swift Lambda function using the local copy of the runtime

Motivation:

When developing and testing ideas on the Swift AWS Lambda Runtime, we often need to build code for deployment.
The local and CI build systems have been modified to allow to reference the local filesystem version of the library, instead of the remote one on Git. It uses the LAMBDA_USE_LOCAL_DEPS to make the difference. The examples' Package.swift have been updated by #292

Modifications:

This PR, adds a check in the archiver plugin to mount ../.. in the docker container rather than . when building with local dependencies. This allows to refer to the local copy of the Swift AWS Lambda runtime library from within docker.

Result:

LAMBDA_USE_LOCAL_DEPS=true swift package archive --disable-sandbox 

...

  Build complete! (5.28s)
-------------------------------------------------------------------------
archiving "MyLambda"
-------------------------------------------------------------------------
1 archive created
  * MyLambda at /Users/stormacq/<redacted>/swift-aws-lambda-runtime/Examples/Echo/.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/MyLambda/MyLambda.zip
 

@sebsto
Copy link
Contributor Author

sebsto commented May 13, 2024

@tomerd WDYT ?

@tomerd
Copy link
Contributor

tomerd commented May 13, 2024

lgtm

@sebsto
Copy link
Contributor Author

sebsto commented May 15, 2024

@tomerd feel free to approve when you have time - thanks

@sebsto
Copy link
Contributor Author

sebsto commented May 21, 2024

@tomerd can you approve and trigger a set of test? Thanks

@tomerd
Copy link
Contributor

tomerd commented May 21, 2024

@swift-server-bot add to allowlist

@sebsto sebsto merged commit 294d06b into swift-server:main May 22, 2024
7 of 8 checks passed
@sebsto sebsto deleted the sebsto/use_local_deps branch May 22, 2024 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants