We develop a project all RestApi services is a Lambda function, We use serverless framework for AWS Lambda deploying. Project is mono-repo.
It's folder structure like this
./app (this is shared folder and a layer on AWS )
- /Models
- /Helper
- ...
./services
- /ServiceGroup
- /service1
- service.handler
- config.yml
- /service2
- service.handler
- config.yml
- /AnotherServiceGroup
- /service3
- service.handler
- config.yml
- /service4
- service.handler
- config.yml
- serverless.yml (this yml configuration file is including all services configuration files)
We use custom own gitlab server. And this project CI folder run this code for lambda deploy
serverless deploy
This command deploy all services but we want deploy only changed services. How to customize CI for that?
If all of your services share the same serverless.yml
file, they live in the same cloudformation stack, so what you're asking for doesn't work.
You can use serverless deploy function
to update just one function, but that skips cloudformation, so new resources won't be created and your stack will drift. You should use it during development, but not for production deployments.
I strongly recommend splitting your stacks. You can still use a mono-repo, and then you can conditionally deploy services depending on which files changed for a given commit.