mintel / build-harness

🤖Collection of Makefiles to facilitate building Python/Golang projects, Dockerfiles, and more
Apache License 2.0
2 stars 6 forks source link

Supply software version to lambda runtime with `pyproject.toml` #68

Closed aspage2 closed 4 years ago

aspage2 commented 4 years ago

Context

Some of our work requires that software agents be aware of their own version. ECS-deployed agents have their version built into their dockerfile, but we don't have the same for lambda bundles. This PR adds support to the faas/ module for adding a pyproject.toml file to the lambda bundle which contains a software-managed "version" field.

New Behavior

make faas/python/build will now create dist/pyproject.toml and bundle that file into the final build.zip. If a pyproject.toml exists in the project root, it is copied into dist/, otherwise, a bare pyproject.toml is created. Before zipping, dist/pyproject.toml's "version" field is updated to either $(GIT_TAG) or $(GIT_COMMIT_SHORT), in that order.