tox --parallel - безопасная сборка не работает с параллельным конвейером Jenkins - PullRequest
0 голосов
/ 13 февраля 2019

Я хочу вызывать tox с версиями Python 2.7 и 3.6 параллельно в конвейере jenkins.

Проблема в том, что tox не потокобезопасен, а является опцией (--parallel - safe-build)кажется, это решить, но не в моем случае.Кажется, что он не имеет никаких эффектов.

Он может быть воспроизведен локально с помощью:

tox --parallel-safe-build -e py27 & tox --parallel-safe-build -e py36 &

, что приведет к сбою одного из двух.

Этап Jenkinsfile

stage("Compatibility") {
    steps {
        parallel(
            "Python 2.7": {
                sh "venv/bin/tox --parallel--safe-build -e py27"
            },
            "Python 3.6": {
                sh "venv/bin/tox --parallel--safe-build -e py36"
            }
        )
    }
}

tox.ini

[tox]
envlist = py27,py36

[testenv]
deps =
    pytest
commands =
    pytest

Stacktrace

Traceback (most recent call last):
  File "/home/th/.local/lib/python3.7/site-packages/py/_error.py", line 66, in checked_call
    return func(*args, **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: '/home/th/dev/commons/.tox/log/tox-0.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/th/.local/bin/tox", line 10, in <module>
    sys.exit(cmdline())
  File "/home/th/.local/lib/python3.7/site-packages/tox/session.py", line 47, in cmdline
    main(args)
  File "/home/th/.local/lib/python3.7/site-packages/tox/session.py", line 54, in main
    retcode = build_session(config).runcommand()
  File "/home/th/.local/lib/python3.7/site-packages/tox/session.py", line 467, in runcommand
    return self.subcommand_test()
  File "/home/th/.local/lib/python3.7/site-packages/tox/session.py", line 579, in subcommand_test
    venv.package = self.hook.tox_package(session=self, venv=venv)
  File "/home/th/.local/lib/python3.7/site-packages/pluggy/hooks.py", line 284, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/th/.local/lib/python3.7/site-packages/pluggy/manager.py", line 68, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/th/.local/lib/python3.7/site-packages/pluggy/manager.py", line 62, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/home/th/.local/lib/python3.7/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/home/th/.local/lib/python3.7/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/th/.local/lib/python3.7/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/th/.local/lib/python3.7/site-packages/tox/package/__init__.py", line 13, in tox_package
    session.package, session.dist = get_package(session)
  File "/home/th/.local/lib/python3.7/site-packages/tox/package/__init__.py", line 33, in get_package
    package = acquire_package(config, report, session)
  File "/home/th/.local/lib/python3.7/site-packages/tox/package/__init__.py", line 46, in acquire_package
    path = build_package(config, report, session)
  File "/home/th/.local/lib/python3.7/site-packages/tox/package/builder/__init__.py", line 7, in build_package
    return make_sdist(report, config, session)
  File "/home/th/.local/lib/python3.7/site-packages/tox/package/builder/legacy.py", line 26, in make_sdist
    returnout=True,
  File "/home/th/.local/lib/python3.7/site-packages/tox/session.py", line 255, in popen
    out = outpath.read()
  File "/home/th/.local/lib/python3.7/site-packages/py/_path/common.py", line 170, in read
    with self.open(mode) as f:
  File "/home/th/.local/lib/python3.7/site-packages/py/_path/local.py", line 361, in open
    return py.error.checked_call(open, self.strpath, mode)
  File "/home/th/.local/lib/python3.7/site-packages/py/_error.py", line 86, in checked_call
    raise cls("%s%r" % (func.__name__, args))
py.error.ENOENT: [No such file or directory]: open('/home/th/dev/commons/.tox/log/tox-0.log', 'r')
...