My workspace has 5 lambdas in it (pig, duck, goose, cow, farmer). 4 of them require the following configuration to be built:
--arm64
--output-format zip
one of them (farmer) requires
--arm64
--output-format zip
--include tractor
When running
cargo lambda build -p duck -p pig -p goose -p cow --arm64 --output-format zip
and then
cargo lambda build -p farmer --arm64 --output-format zip --include tractor
the resulting zips all contain tractor.
When run in the opposite order, none of them do.
I have attempted the following:
cargo lambda build -p duck -p pig -p goose -p cow -p farmer --arm64 --output-format zip
and added package configuration include = ["tractor"] for just the farmer build to its cargo.toml, but it seems that when more than one package is provided, the package-specific config is ignored.
The workaround appears to be to use a different --lambda-dir for each invocation, since all zips get overwritten on each invocation, regardless of the packages passed in. Is that right? Is it expected?
Thank you for the effort on the tool, it is really excellent.
EDIT:
I have found the issue. --package does accurately build only the specified binaries, but the --output-format zip functionality iterates over all constructed binaries, rather than all constructed binaries specified in this function call. The last call to cargo lambda build --output-format zip determines the content of the zip files for all binaries built in that target directory, even those binaries built in previous invocations.
The actual workaround is to remove the binaries after invoking the cargo lambda build command (but keep the zips) so that the next call, building a different binary, won't zip them up.
My workspace has 5 lambdas in it (pig, duck, goose, cow, farmer). 4 of them require the following configuration to be built:
--arm64
--output-format zip
one of them (farmer) requires
--arm64
--output-format zip
--include tractor
When running
cargo lambda build -p duck -p pig -p goose -p cow --arm64 --output-format zipand then
cargo lambda build -p farmer --arm64 --output-format zip --include tractorthe resulting zips all contain tractor.
When run in the opposite order, none of them do.
I have attempted the following:
cargo lambda build -p duck -p pig -p goose -p cow -p farmer --arm64 --output-format zipand added package configuration
include = ["tractor"]for just the farmer build to its cargo.toml, but it seems that when more than one package is provided, the package-specific config is ignored.The workaround appears to be to use a different
--lambda-dirfor each invocation, since all zips get overwritten on each invocation, regardless of the packages passed in. Is that right? Is it expected?Thank you for the effort on the tool, it is really excellent.
EDIT:
I have found the issue.
--packagedoes accurately build only the specified binaries, but the--output-format zipfunctionality iterates over all constructed binaries, rather than all constructed binaries specified in this function call. The last call tocargo lambda build --output-format zipdetermines the content of the zip files for all binaries built in that target directory, even those binaries built in previous invocations.The actual workaround is to remove the binaries after invoking the
cargo lambda buildcommand (but keep the zips) so that the next call, building a different binary, won't zip them up.