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

VSTS Build: Write to Docker volume under hosted linux agent failing #7528

Closed
1 task done
erewok opened this issue Jun 20, 2018 · 4 comments
Closed
1 task done

VSTS Build: Write to Docker volume under hosted linux agent failing #7528

erewok opened this issue Jun 20, 2018 · 4 comments
Assignees

Comments

@erewok
Copy link

erewok commented Jun 20, 2018

Troubleshooting

Environment

  • Server - VSTS

  • Agent: Hosted

    • Agent queue name: Hosted Linux Preview

Issue Description

Hello, I may be misunderstanding something and apologies if I'm asking for help in the wrong place, but I have been attempting to mount a volume with docker and then write to that volume from inside a container. All attempts at writing to a mounted docker volume are failing. I haven't found any other useful guidelines for this elsewhere on the internet.

I used the build definition editor to set-up/edit my build, so I'm not running these commands directly. However, I've tried variations on the following:

/usr/local/bin/docker run --name lendio-testing --rm -v /opt/vsts/work/1/a:/app/htmlcov container-repo.azurecr.io/lendio-testing:build.master-23

/usr/local/bin/docker run --name lendio-testing --rm -v /tmp:/app/htmlcov container-repo.azurecr.io/lendio-testing:build.master-23

I always get permission denied errors when my test suite attempts to write to the volume.

What I'm actually trying to do is run a test suite inside a docker container (to benefit from the project-build dockerfile used to deploy the project) and then write a coverage.xml file to the mounted volume, which I would like to publish afterward.

Error logs

******************************************************************************
Starting: Run Lendio test image
******************************************************************************
==============================================================================
Task         : Docker
Description  : Build, tag, push, or run Docker images, or run a Docker command. Task can be used with Docker or Azure Container registry.
Version      : 0.3.12
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=848006)
==============================================================================
/usr/local/bin/docker run --name lendio-testing --rm -v /opt/vsts/work/1/a:/app/htmlcov mfcloudacr.azurecr.io/lendio-testing:build.master-23
============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-3.6.1, py-1.5.3, pluggy-0.6.0
rootdir: /app, inifile: setup.cfg
plugins: pep8-1.0.6, cov-2.5.1
collected 70 items
run.py .                                                                 [  1%]
setup.py .                                                               [  2%]
shell.py .                                                               [  4%]
lendio/__init__.py .                                                     [  5%]
lendio/client.py .                                                       [  7%]
lendio/config.py .                                                       [  8%]
lendio/constants.py .                                                    [ 10%]
lendio/core.py .                                                         [ 11%]
lendio/email.py .                                                        [ 12%]
lendio/http.py .                                                         [ 14%]
lendio/loggers.py .                                                      [ 15%]
lendio/webhooks/__init__.py .                                            [ 17%]
lendio/webhooks/endpoints.py .                                           [ 18%]
test/conftest.py .                                                       [ 20%]
test/test_client.py ...................................                  [ 70%]
test/test_config.py ....                                                 [ 75%]
test/test_email.py .....                                                 [ 82%]
test/test_loggers.py ..                                                  [ 85%]
test/test_webhooks/test_endpoints.py ..........                          [100%]
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/_pytest/main.py", line 178, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/_pytest/main.py", line 215, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/pluggy/__init__.py", line 617, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/pluggy/__init__.py", line 222, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/pluggy/__init__.py", line 216, in <lambda>
INTERNALERROR>     firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/pluggy/callers.py", line 196, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/pytest_cov/plugin.py", line 235, in pytest_runtestloop
INTERNALERROR>     self.cov_controller.finish()
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/pytest_cov/engine.py", line 115, in summary
INTERNALERROR>     total = self.cov.html_report(ignore_errors=True, directory=self.cov_report['html'])
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/coverage/control.py", line 1095, in html_report
INTERNALERROR>     return reporter.report(morfs)
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/coverage/html.py", line 139, in report
INTERNALERROR>     self.report_files(self.html_file, morfs, self.config.html_dir)
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/coverage/report.py", line 91, in report_files
INTERNALERROR>     report_fn(fr, self.coverage._analyze(fr))
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/coverage/html.py", line 286, in html_file
INTERNALERROR>     write_html(html_path, html)
INTERNALERROR>   File "/home/lendio/.local/lib/python3.6/site-packages/coverage/html.py", line 69, in write_html
INTERNALERROR>     with open(fname, "wb") as fout:
INTERNALERROR> PermissionError: [Errno 13] Permission denied: 'htmlcov/lendio___init___py.html'
========================== 70 passed in 7.08 seconds ===========================
/usr/local/bin/docker failed with return code: 3
@vithati
Copy link
Member

vithati commented Jun 21, 2018

Hi, Copy build aritifact data on your local linux machine and can you try running docker image on your local linux machine and see is it running or not?

@erewok
Copy link
Author

erewok commented Jun 21, 2018

Hi, I have no problems running this image locally and having it write to a mounted volume (such as /tmp or others that are writeable by the process owner that launches the docker run process. Does that answer the question?

@vithati
Copy link
Member

vithati commented Jun 27, 2018

Hi, From build docker image logs script running with user lendio (i see USER lendio in build docker images log). Voulme mounted with root user inside container and lendio user not able to write to volume. Can you comment 'USER lendio' in docker file and check run docker image working or not.

@erewok
Copy link
Author

erewok commented Jun 27, 2018

That did work. I was able to write to /tmp on the host while running the image under root. Thanks.

@erewok erewok closed this as completed Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants