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

Build a function without clearing the build directory. #2213

Closed
knplnl opened this issue Sep 11, 2020 · 2 comments
Closed

Build a function without clearing the build directory. #2213

knplnl opened this issue Sep 11, 2020 · 2 comments
Labels
area/build sam build command type/feature Feature request

Comments

@knplnl
Copy link

knplnl commented Sep 11, 2020

Describe your idea/feature/enhancement

I wish sam build would not clear the build directory when building a specific lambda function in my template.

Proposal

Currently, running sam build clears the build directory and builds all the functions and layers in the template. There is an option to build a specific function in the template:
sam build [OPTIONS] FUNCTION_RESOURCE_NAME
Running this command will clear the build directory and build only the function specified by FUNCTION_RESOURCE_NAME. I was hoping I could use this to build my functions separately. You could have, for instance, a Makefile with multiple rules. Each of which builds one specific function, but only if its source code has changed since the last build (I use so called 'empty targets' to keep track of the last build time). However, if multiple functions have changes and I try to build and deploy my functions, this happens:

sam build Function1
sam build Function2  # Wipes the build directory. Function1 is gone now.
sam deploy

Things to consider:

  1. Will this require any updates to the SAM Spec
    No

Additional Details

I am not sure how to handle the situation where you deploy your sam app without building all of your functions first. From what I've experienced, sam seems to just copy your CodeUri directory and use it as the deployment package.

@wchengru wchengru added type/feature Feature request area/build sam build command labels Sep 11, 2020
@wchengru
Copy link
Contributor

This issue is related #805
As a work around, you can doing a sam build instead of the individual one.

@sriram-mv
Copy link
Contributor

Closing this issue, since there is a linked issue already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build sam build command type/feature Feature request
Projects
None yet
Development

No branches or pull requests

3 participants