【发布时间】:2019-02-13 03:12:45
【问题描述】:
我有一个私有 gitlab ce 综合实例,带有以下 .gitlab-ci.yml :
image: python:3.6
stages:
- lint
- test
before_script:
- python -V
- pip install pipenv
- pipenv install --dev
lint:
stage: lint
script:
- pipenv run pylint --output-format=text --load-plugins pylint_django project/ | tee pylint.txt
- score=$(sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' pylint.txt)
- echo "Pylint score was $score"
- ls
- pwd
- pipenv run anybadge --value=$score --file=pylint.svg pylint
artifacts:
paths:
- pylint.svg
test:
stage: test
script:
- pipenv run python manage.py test
所以我想我会将图像存储在 lint 作业的工件中,并通过徽章功能显示它。
但我遇到以下问题:当我浏览 https://example.com/[group]/[project]/-/jobs/[ID]/artifacts/file/pylint.svg 时,我没有看到徽章,而是收到以下消息:
The image could not be displayed because it is stored as a job artifact. You can download it instead.
无论如何,我觉得这是错误的方式,因为即使我可以获取图像,似乎也没有办法从上一份工作中获取图像,因为徽章图像的 gitlab URL 仅支持 @ 987654326@
那么如何根据 gitlab 管道中的结果生成的 svg 将徽章添加到 gitlab 项目?
我的猜测是我可以推送到 .badge 文件夹,但这听起来不是一个干净的解决方案。
【问题讨论】: