在codecov中通过docker传递报告给出了错误

我试图设置codecov作为代码覆盖的工具在我的信息库。 我提到这个链接通过docker集装箱通过报告 –

链接 – https://github.com/codecov/support/wiki/Testing-with-Docker

但特拉维斯彗星失败,并给出这个错误 –

docker: Error parsing reference: "..." is not a valid repository/tag.

这是我的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 

我应该如何解决这个问题? 谢谢!

我假设你参考Codecov Outside Docker 。 目前的错误信息已经告诉你,这三个点需要被一个真正的Docker仓库名replace,例如node:6-alpine

你仍然缺less的是在Docker容器中运行testing(包括报告)的一部分,这样你就可以将testing报告mv到共享文件夹。 您可以通过添加一个基于节点的自定义Dockerfile来实现这一点,类似于下面的。 我select了一个或多或less的完整的基础图像,包括Chrome和其他工具,使您的用例工作:

 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 

该自定义图像需要被build立,然后像这样运行(假设Dockerfile在您的项目根目录中):

 docker build -t ci-build . docker run --rm -v "$(pwd):/proj" ci-build 

我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 

另外一个注意事项: coala/base图像的工作原理是相似的