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

container image of pre-release v1.0.0a3 does not start #201

Open
demeringo opened this issue Jun 28, 2023 · 5 comments
Open

container image of pre-release v1.0.0a3 does not start #201

demeringo opened this issue Jun 28, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@demeringo
Copy link
Collaborator

demeringo commented Jun 28, 2023

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.

@demeringo demeringo added the bug Something isn't working label Jun 28, 2023
@demeringo demeringo self-assigned this Jun 28, 2023
@demeringo
Copy link
Collaborator Author

Cannot build docker image on dev branch, need to fix #202 first.

@demeringo
Copy link
Collaborator Author

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:

  1. manually update the version number to 1.0.0a4 in pyproject.toml ?
    version = "1.0.0a3"
  2. 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 ?

@bamthomas
Copy link
Collaborator

bamthomas commented Jun 29, 2023

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.

@demeringo
Copy link
Collaborator Author

demeringo commented Jun 29, 2023

Thank you for you answers @bamthomas.

I commited a small fix yesterday to the makefile (just passing the version to the docker build command): b468a4e

Locally, this flow works for me

  1. Update version in pyproject.toml (manual edit of the file)
  2. poetry build
  3. 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.

@valentinchaud
Copy link
Contributor

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants