boaviztapi
boaviztapi copied to clipboard
container image of pre-release v1.0.0a3 does not start
Bug description
Container image published with pre-release v1.0.0a3 does not start.
To Reproduce
https://github.com/Boavizta/boaviztapi/releases/tag/v1.0.0a3
docker run -p5000:5000 ghcr.io/boavizta/boaviztapi:1.0.0a3
results in ModuleNotFoundError: No module named 'yaml'
I did not test yet building the image from dev branch.
Expected behavior
Published docker image should run.
JSON OUTPUT
Additional context
olivier@pad ~/atelier/boavizta/cloud-scanner dev docker run -p5000:5000 ghcr.io/boavizta/boaviztapi:1.0.0a3
Traceback (most recent call last):
File "/app/./uvicorn", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 410, in main
run(
File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 578, in run
server.run()
File "/usr/local/lib/python3.9/site-packages/uvicorn/server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/usr/local/lib/python3.9/site-packages/uvicorn/server.py", line 68, in serve
config.load()
File "/usr/local/lib/python3.9/site-packages/uvicorn/config.py", line 473, in load
self.loaded_app = import_from_string(self.app)
File "/usr/local/lib/python3.9/site-packages/uvicorn/importer.py", line 24, in import_from_string
raise exc from None
File "/usr/local/lib/python3.9/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/app/boaviztapi/__init__.py", line 5, in <module>
import yaml
ModuleNotFoundError: No module named 'yaml'
I believe this dependecy issue was fixed after publication of this pre-release (but I did not verified this yet). -> Will try to rebuild locally the docker image from a more recent commit.
If this is fixed in more recent commit on dev branch, I will try to publish a newer release.
Cannot build docker image on dev branch, need to fix #202 first.
I believe we should pre-release a version 1.0.0a4 (based on actual dev branch) to replace 1.0.0a3 whose docker image is broken. It makes things easier for maintaining cloud scanner to target a working API version (even if only a pre-release).
@bamthomas @da-ekchajzer what is the procedure to publish an updated package and docker image ? Is it sufficient to:
- manually update the version number to 1.0.0a4 in pyproject.toml ? https://github.com/Boavizta/boaviztapi/blob/b468a4e9d075ed2b334576f3158802b2fbedb416/pyproject.toml#L3
- create a release in github with the same name and tag (1.0.0a4 ), so that it tags the dev branch and publishes the package and docker image ?
normally it is done with make major/minor/patch
but I'm not sure that it will work with a3/a4 :/
I don't understand what has been done so far in dev branch. For me it would be much more simple to do Trunk Based Development i.e. commit/PR always on main/master. And so the main branch should always be releasable (CI is the indicator for it ; we could add GH actions) .
Right now to release a docker container you have to :
- build the deliverables
make dist
but it is broken now (and probably it has a link with the broken docker image) - make the docker with
docker build -t <docker-tag-name-with-repository> --build-arg <boaviztapi-version> .
- then push the docker image to the docker repository (
docker push <docker-tag-name-with-repository>
)
I will add makefile target(s) to do it. But tests/build shoud be green before :)
Then the simplest thing would be also to make the CI build/release/push automatically when tagging the branch. That would avoid in the future those kind of issue and make the release easy for every one with tag access right on the repo. I can do this also.
I can have a look tomorrow if it is not too late.
Thank you for you answers @bamthomas.
I commited a small fix yesterday to the makefile (just passing the version to the docker build command): https://github.com/Boavizta/boaviztapi/commit/b468a4e9d075ed2b334576f3158802b2fbedb416
Locally, this flow works for me
- Update version in pyproject.toml (manual edit of the file)
-
poetry build
-
make docker-build
We have a Github action that builds the package and publishes docker image when a github release is published. See https://github.com/Boavizta/boaviztapi/blob/main/.github/workflows/release.yml But it does not uses the makefile (!) for all steps so there is a risk of diverging.
=> our best course of action may be to use the makefile everywhere (local dev and CI). => ideally automate the version bump when a release or tag is applied, but it may be a bit complicated.
And yes green tests should be the prerequisite ;-) (and they are passing right now 👍)
Thank you again for proposing to help and do not worry if you cannot immediately, it is not an urgent topic.
The pre-release 1.0.0a4 solved the original issue, so is this possible to close this issue since the docker image is usable now ?