Chalice: Info on deployed app should be ignored by git

Created on 26 Jul 2018  路  6Comments  路  Source: aws/chalice

When I run chalice deploy, the directory .chalice/deployed/ is created and contain a json file that records the AWS resources for my deployment. Git is not configured to ignore this directory, when presumably it should be.

https://github.com/aws/chalice/blob/3bfbd3d6800777206198fc58d264eaee1c4f574d/chalice/deploy/deployer.py#L831-L844

feature-request

Most helpful comment

The ./chalice/deployed folder is a critical component when using chalice across multiple developers that are targeting the same environment. If this folder is .git ignored, each developer will deploy to a separate API Gateway endpoint.

Adding the .git ignore after project bootstrapping is relatively easy. However, if we had the behavior changed, any developers using and depending on this folder would be in for a nasty surprise the next time they create a new project.

If this feature is implemented, I would recommend it as a --no-deployment-folder option to the new-project command, with the current behavior assumed if the switch isn't in place.

All 6 comments

If you bootstrap the project using chalice new-project a .gitignore is generated which will ignore that directory.

$ chalice new-project foo
$ cat foo/.gitignore
.chalice/deployments/
.chalice/venv/

I did bootstrap using chalice new-project. There are two similarly named directories:

  • .chalice/deployments/ contains zip files and is in gitignore
  • .chalice/deployed/ contains json files and is not in gitignore.

I'm happy to submit a PR adding the latter to the gitignore template as well if there is agreement that it belongs there.

Yeah, I think adding this to the default gitignore sounds reasonable. People can always remove it if they do want to check in that file for some reason.

@jamesls Ignoring .chalice/deployments/ makes sense as it where the builds end up.

Ignoring the .chalice/deployed/ directory will result in each deployment creating a new API gateway endpoint. I don't think that's desired behaviour.

The ./chalice/deployed folder is a critical component when using chalice across multiple developers that are targeting the same environment. If this folder is .git ignored, each developer will deploy to a separate API Gateway endpoint.

Adding the .git ignore after project bootstrapping is relatively easy. However, if we had the behavior changed, any developers using and depending on this folder would be in for a nasty surprise the next time they create a new project.

If this feature is implemented, I would recommend it as a --no-deployment-folder option to the new-project command, with the current behavior assumed if the switch isn't in place.

Does committing the deployed resource manifest to VCS make any sense though? The deployed "state" is something that needs to always be up to date, the history of the state has no use when deploying. Imagine deploying based on that file while checked out to a different branch on the repository, there will still be errors.

The way that state is handled with tools like terraform (for example) locates this file in a central location for all developers to poll against a "live" version of. See the terraform docs on this for more details.

Was this page helpful?
0 / 5 - 0 ratings