通过Codecov中的Docker传递报告会出错 [英] Passing reports through docker in codecov gives error
问题描述
我正试图在我的存储库中将codecov设置为代码覆盖率工具。我引用了此链接以通过Docker容器传递报告-
I'm trying to setup codecov as code coverage tool in my repository. I referred to this link to pass reports through docker container -
链接- https://github.com/codecov/support/wiki/Testing-with-Docker
但是travis ci失败并给出此错误-
But travis ci fails and gives this error -
docker:分析引用时出错: ...不是有效的存储库/标签。
这是我的travis.yml
Here is my travis.yml
sudo: required
dist: trusty
language: node_js
node_js:
- 6
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- docker run -v "$PWD/shared:/shared" ...
before_script:
- ng build
script:
- ng test --watch=false
- ng lint
- >
docker run -ti -v $(pwd):/app --workdir=/app coala/base coala --version
after_success:
- bash ./deploy.sh
- bash <(curl -s https://codecov.io/bash)
- mv -r coverage/ shared
cache:
bundler: true
directories:
- node_modules
- .coala-cache
services: docker
branches:
only:
- angular
我该如何解决?谢谢!
推荐答案
我假设您是指 Docker外部的Codecov 。当前错误消息已经告诉您,三个点 ...
需要替换为真实的Docker存储库名称,例如 node:6-alpine
。
I assume you refer to Codecov Outside Docker. The current error message already tells you that the three dots ...
need to be replaced with a real Docker repository name, e.g. node:6-alpine
.
您仍然缺少的是运行测试的部分(包括报告) ) 放置在Docker容器中,这样您就可以 mv
将测试报告发送到共享文件夹。您可以通过添加基于节点的自定义Dockerfile来实现,类似于以下示例。我选择了包括Chrome和其他工具在内的或多或少完整的基本图像,以使您的用例正常工作:
What you're still missing is the part of running the tests (including reports) inside the Docker container, so that you can mv
the test reports to the shared folder. You could achieve that by adding a custom Dockerfile based on node, similar to the one below. I chose a more or less full base image including Chrome and other tools to make your use case work:
FROM markadams/chromium-xvfb-js:7
WORKDIR /proj
CMD npm install && \
node_modules/.bin/ng build && \
node_modules/.bin/ng test --watch=false && \
node_modules/.bin/ng lint && \
mkdir -p shared && \
mv coverage.txt shared
需要构建然后运行该自定义图像像这样(假设Dockerfile位于您的项目根目录中):
That custom image needs to be built and then run like this (assuming the Dockerfile to be in your project root directory):
docker build -t ci-build .
docker run --rm -v "$(pwd):/proj" ci-build
我建议如下更改 .travis.yml
:
sudo: required
dist: trusty
language: node_js
node_js:
- 6
before_install:
- docker build -t ci-build .
script:
- >
docker run --rm -v $(pwd):/proj ci-build
- >
docker run -ti -v $(pwd):/app --workdir=/app coala/base coala --version
after_success:
- bash ./deploy.sh
- bash <(curl -s https://codecov.io/bash)
cache:
bundler: true
directories:
- node_modules
- .coala-cache
services: docker
branches:
only:
- angular
另一点注意:可乐/基础
图像的工作原理与此类似。
Another note: the coala/base
image works similarly.
这篇关于通过Codecov中的Docker传递报告会出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!