tox-dev / tox-docker

A tox plugin to run one or more Docker containers during tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

issue when using tox-docker on bitbucket pipelines since 20.0.0

ifiddes opened this issue · comments

Hello,

My deployments stopped working today. I have traced it to something that changed between 20.0.0, and the pre-releases. It seems to not recognize the docker container, despite it being present:

+ tox -vv
using tox.ini: /opt/atlassian/pipelines/agent/build/tox.ini (pid 613)
Traceback (most recent call last):
  File "/opt/conda/bin/tox", line 8, in <module>
    sys.exit(cmdline())
  File "/opt/conda/lib/python3.7/site-packages/tox/session/__init__.py", line 44, in cmdline
    main(args)
  File "/opt/conda/lib/python3.7/site-packages/tox/session/__init__.py", line 65, in main
    config = load_config(args)
  File "/opt/conda/lib/python3.7/site-packages/tox/session/__init__.py", line 81, in load_config
    config = parseconfig(args)
  File "/opt/conda/lib/python3.7/site-packages/tox/config/__init__.py", line 283, in parseconfig
    pm.hook.tox_configure(config=config)  # post process config object
  File "/opt/conda/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/opt/conda/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/opt/conda/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/opt/conda/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/opt/conda/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/opt/conda/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/opt/conda/lib/python3.7/site-packages/tox_docker/__init__.py", line 108, in tox_configure
    raise ValueError(f"{container_name!r} is not a valid container name")
ValueError: '####' is not a valid container name

Hm, can you show the [docker:...] sections from your tox.ini? This error implies you have something like `[docker:####]'

What was the last version that worked? It looks like the lines causing that error have existed since 2.0.0a1, so I'm surprised if the 2.0 final release caused an issue

The docker section looks like this:

[docker:mycontainer:test]
ports = 5000:5000/tcp

Which is then included in the test sections:

[testenv]
docker =
    mycontainer:test

In regards to versions, I would need to do further testing. The error started happening yesterday, and the last successful build before the error was on January 26th. I had not been pegging the version of tox-docker, so this would be at the whim of whatever tox decided to install from pip. Looking at pypi now, it seems like the pre-release versions were tagged as such, and I believe that means that pip will ignore them unless asked specifically to install them.

Hm, OK. I assume test is a tag on the image?

In 2.0, the docker= directive in each testenv just gets a name that refers to another section; within the [docker:mycontainer] section, you can specify the image as image = mycontainer:test (or several other variations -- basically anything that docker pull would work with). This is a change from the 1.x series, and is one of the major reasons we cut a 2.x release.

If you pin your version of tox-docker to < 2.0, it probably will work, although you'll lose access to new features, like volumes/mounts and healthcheck support.

Got it, thanks