A proposal for a new set of SwiftPM plugins to facilitate the
scaffolding, build, archive, and deployment of Lambda functions.
This is a call for comments to finalize the design before starting an
actual implementation
Resources are not included in the archive on Linux
https://github.com/swift-server/swift-aws-lambda-runtime/issues/505
In addition, the script that checks if the resources are correctly
included in an archive when building on Linux is not working.
It failed to detected missing resources.
This patch fix both the plugin and the CI script
Instructions for customizing the output path are incorrect
### Motivation:
`displayHelpMessage` was incorrect - it claimed that the output path was
customizable via a `--output-directory` flag, but the code actually
looks for `--output-path`
### Modifications:
Changing the help message here, instead of the code, in case existing
projects already depend on `--output-path`
### Result:
`displayHelpMessage` will show the correct instructions
When including resources in the package and packaging on Ubuntu,
`FileManager` throws a FilePermission error. The docker daemon runs as
root and files to be copied are owned by `root` while the archiver runs
as the current user (`ubuntu` on EC2 Ubuntu). The `FileManager` manages
to copy the files but throws an error after the copy. We suspect the
`FileManager` to perform some kind of operation after the copy and it
fails because of the `root` permission of the files.
See
https://github.com/swift-server/swift-aws-lambda-runtime/issues/449#issuecomment-2595978246
for a description of the problem.
This PR contains code to reproduce the problem, a very simple
workaround, and an integration test.
The workaround consists of
- trapping all errors
- verify if the error is the permission error (Code = 513)
- verify if the files have been copied or not
- if the two above conditions are met, ignore the error, otherwise
re-throw it
I would rather prefer a solution that solves the root cause rather than
just ignoring the error.
We're still investigating the root cause (see [this
thread](https://forums.swift.org/t/filemanager-copyitem-on-linux-fails-after-copying-the-files/77282)
on the Swift Forum and this issue on Swift Foundation
https://github.com/swiftlang/swift-foundation/issues/1125
* do not force unwrap
Revert a change from #d2bd7f1aae1fc9455b208567ba5d85e42463c82c that caused the plugin to crash
* test stdout for nil
---------
Co-authored-by: Fabian Fett <fabianfett@apple.com>
* Add Support For Copying All Resources Into Final Executable
* Run formatter
---------
Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
* Require Swift 6
* Apply formatter
* Disable 5.8, 5.9, and 5.10 checks
* Remove -warnings-as-errors for now
* Ensure plugin compiles in Swift 6 language mode
* Add support for resources when packaging using the SwiftPM plugin.
* Copy the resources directory to the working directory instead of recreating the directroy structure.
* Add resource packaging example.
* Use the bundle's url function to locate the file url.
* Fix year for soundness check.
---------
Co-authored-by: Sébastien Stormacq <sebastien.stormacq@gmail.com>
motivation: sometimes, you need to use a customized local docker image and `docker pull` don’t have to be called
changes:
* add `--disable-docker-image-update` plugin flag to disable `docker pull` call
motivation: add an easy wasy for lambda users to package their lambda and upload it to AWS
changes:
* add SwiftPM plugin to package the lambda as zipfile, with the verb "archive"
* use docker to build and package the lambda(s) on macOS and non-amazonlinux
* build directly on when on amazonlinux, zip correctly
Co-authored-by: Yim Lee <yim_lee@apple.com>
Co-authored-by: Fabian Fett <fabianfett@apple.com>