containerbuildsystem/atomic-reactor

'atomic-reactor build path' tracebacks with FileExistsError

Closed this issue · 2 comments

atomic-reactor tracebacks when trying to build an image from a local path. Reproducer:

$ cat ./Dockerfile
FROM fedora:latest
RUN dnf -y install docker-io git python-docker-py python-setuptools koji atomic-reactor && dnf clean all
CMD ["atomic-reactor", "-v", "inside-build", "--input", "path"]
$ docker build -t buildroot-hostdocker .

$ git clone https://github.com/OpenSCAP/openscap-daemon/
$ cd openscap-daemon/ && ./generate-dockerfile.py && cd ../
$ atomic-reactor -v build path --method hostdocker --build-image buildroot-hostdocker --image test/openscap --uri ./openscap-daemon/
2018-03-05 17:17:05,045 - atomic_reactor.outer - INFO - building image 'test/openscap'
2018-03-05 17:17:05,046 - atomic_reactor.core - INFO - building image 'buildroot-hostdocker' in container using docker from host
2018-03-05 17:17:05,046 - atomic_reactor.core - DEBUG - build input: image = 'buildroot-hostdocker', args = '{"image": "test/openscap", "source": {"provider_params": {}, "provider": "path", "uri": "./openscap-daemon/", "dockerfile_path": null}, "postbuild_plugins": [{"name": "tag_and_push", "args": {"registries": {}}}], "prebuild_plugins": [{"name": "pull_base_image", "args": {"parent_registry": null, "parent_registry_insecure": false}}]}'
2018-03-05 17:17:05,046 - atomic_reactor.core - INFO - checking whether image 'buildroot-hostdocker' exists
2018-03-05 17:17:05,046 - atomic_reactor.core - DEBUG - image_id = 'buildroot-hostdocker'
2018-03-05 17:17:05,049 - atomic_reactor.core - DEBUG - image exists: True
2018-03-05 17:17:05,050 - atomic_reactor.source - DEBUG - workdir is '/tmp/tmp_79hipxs'
2018-03-05 17:17:05,050 - atomic_reactor.source - DEBUG - source path is '/tmp/tmp_79hipxs/'
Traceback (most recent call last):
  File "/usr/bin/atomic-reactor", line 11, in <module>
    load_entry_point('atomic-reactor==1.6.23.2', 'console_scripts', 'atomic-reactor')()
  File "/usr/lib/python3.6/site-packages/atomic_reactor/cli/main.py", line 299, in run
    cli.run()
  File "/usr/lib/python3.6/site-packages/atomic_reactor/cli/main.py", line 282, in run
    args.func(args)
  File "/usr/lib/python3.6/site-packages/atomic_reactor/cli/main.py", line 133, in cli_build_with_source
    cli_build_image(args)
  File "/usr/lib/python3.6/site-packages/atomic_reactor/cli/main.py", line 52, in cli_build_image
    response = build_image_using_hosts_docker(args.build_image, **common_kwargs)
  File "/usr/lib/python3.6/site-packages/atomic_reactor/api.py", line 110, in build_image_using_hosts_docker
    build_response = m.build()
  File "/usr/lib/python3.6/site-packages/atomic_reactor/outer.py", line 139, in build
    partial(BuildContainerFactory.build_image_dockerhost, w))
  File "/usr/lib/python3.6/site-packages/atomic_reactor/outer.py", line 56, in _build
    self.build_container_id = build_method(self.build_image, self.temp_dir)
  File "/usr/lib/python3.6/site-packages/atomic_reactor/core.py", line 137, in build_image_dockerhost
    self._obtain_source_from_path_if_needed(json_args_path, CONTAINER_SHARE_PATH)
  File "/usr/lib/python3.6/site-packages/atomic_reactor/core.py", line 98, in _obtain_source_from_path_if_needed
    source = get_source_instance_for(build_json['source'], tmpdir=local_path)
  File "/usr/lib/python3.6/site-packages/atomic_reactor/source.py", line 138, in get_source_instance_for
    return klass(**args)
  File "/usr/lib/python3.6/site-packages/atomic_reactor/source.py", line 105, in __init__
    os.makedirs(self.source_path)
  File "/usr/lib64/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/tmp/tmp_79hipxs/'

The issue is reproducible on both Fedora 26 and 27:
atomic-reactor-1.6.23.2-1.fc26.noarch
atomic-reactor-1.6.25.1-4.fc27.noarch

I can reproduce with version 1.6.30.2

Actually, no. Forgot to actually create a buildroot with newest version of atomic-reactor. On a rhel based buildroot, this version works for me: atomic-reactor-1.6.30.2-1.el7eng.noarch

See #1015.