目前我的 .gitlab-ci.yml 文件中有这一行:
if (( $coverage < $MIN_COVERAGE )) ; then echo "$coverage% of code coverage below threshold of $MIN_COVERAGE%" && exit 1 ; else exit 0 ; fi
Run Code Online (Sandbox Code Playgroud)
$coverage是代码的测试覆盖率,由 pytest-cov 确定
$MIN_COVERAGE是指定的最低测试覆盖率水平,$coverage 不应低于该水平
目前,如果覆盖率为 70% 并且 min_coverage 为 80%,这会导致管道失败。一条消息也会打印到终端:“代码覆盖率的 $coverage% 低于 $MIN_COVERAGE% 的阈值”
但是,此消息仅显示在 gitlab 作业的终端中,因此如果有人想了解管道失败的原因以及失败的程度,他们需要进入作业终端并查看输出。
有没有办法让此消息输出到 gitlab UI 上的某个位置,而不是在作业终端上显示此回显?
假设我在 Gitlab 上有存储库并遵循以下部署方案:
.gitlab-ci.yml设置 docker-compose 中,与依赖项一起构建和建立我的服务。production。正如Gitlab 指南中建议的那样,我放置了/etc/gitlab-runner/config.toml以下几行:
executor = "docker"
[runners.docker]
image = "alpine"
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
Run Code Online (Sandbox Code Playgroud)
但我的书docker-compose.yml完全被忽略了。假设我有具有以下结构的 git 存储库:
.gitlab-ci.yml
docker-compose.yml
user_conf.d/app.conf
Run Code Online (Sandbox Code Playgroud)
并有卷:./user_conf.d:/etc/nginx/user_conf.d. 当我检查/etc/nginx/user_conf.d容器内部时,我发现一个空文件夹而不是app.conf里面的文件夹。
所以问题是:如何正确地将卷传递到从 Gitlab runner 的 docker 执行器启动的 docker 容器。
PS配置如下:
.gitlab-ci.yml:
.gitlab-ci.yml
docker-compose.yml
user_conf.d/app.conf
Run Code Online (Sandbox Code Playgroud)
docker-compose.yml:
image:
name: docker/compose:latest
services:
- docker:dind
stages:
- deploy
deploy:
stage: deploy
only:
- …Run Code Online (Sandbox Code Playgroud) 我一直在试图找出 gitlab-runner 的问题是什么,我已经在 unix 上安装了 gitlab-runner 。它突然显示错误“分段错误(核心转储)”。我尝试重新安装 gitlab-runner,或检查状态。我尝试的每个命令都会生成一个错误。如何修复这个错误?
我在虚拟机(Ubuntu 20.04.5 lts)中有一个 Gitlab-Runner (版本:15.5.1)。docker版本是22.06.0-beta.0。我正在尝试运行使用节点:最新图像的管道,但运行管道时出现以下错误消息。
配置(config.toml)是:
[[runners]]
name = "runner-web"
url = "my url here"
id = 8
token = "Q_9sEzj9y2sPPJTLnGpL"
token_obtained_at = 2022-12-01T14:09:45Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "docker:latest"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock","/cache"]
shm_size = 0
Run Code Online (Sandbox Code Playgroud)
有一个项目有很多测试,运行它们大约需要20分钟.不幸的是,它们不可能在一个gitlab运行器中并行.我想知道是否有任何良好的实践来启动具有相同环境但不同的测试套件的多个gitlab运行器?
我的工作正在等待并得到以下信息:
此作业卡住了,因为您没有任何可以运行此作业的活动跑步者.
但我确实为这个项目提供了一个激活的跑步者:
跑步者在我的一个vps中作为docker安装:
以下是此跑步者的配置:
concurrent = 1 check_interval = 0
[[runners]]
name = "ansible"
url = "https://gitlab.com/"
token = "xxx"
executor = "docker"
[runners.docker]
tls_verify = false
image = "registry.cn-hangzhou.aliyuncs.com/artwater/ansible:latest"
privileged = false
disable_cache = false
volumes = ["/cache"]
[runners.cache]
Run Code Online (Sandbox Code Playgroud)
下面是我的gitlab-ci.yml:
stages:
- build
- production
job_build:
stage: build
script:
- ansible-playbook -i ./ansible/hosts/production.yml --extra-vars "version=$CI_BUILD_TAG" ./ansible/build.yml
only:
- tags
job_production:
stage: production
script:
- ansible-playbook -i ./ansible/hosts/production.yml --extra-vars "version=$CI_BUILD_TAG" ./ansible/deploy.yml
only:
- tags
when: on_success
Run Code Online (Sandbox Code Playgroud)
谁能告诉我怎么能让这个跑步者工作?非常感谢!
我在gitlab.com上使用共享运行器。此处的指南显示了有关工件的部分。但是当我运行我的工作并查看我的工作页面时,我只会看到以下内容:
没有关于工件的章节。
我该怎么办?
这是我的.gitlab-ci.yml:
image: node:7.9
stages:
- lint
- test
cache:
paths:
- node_modules/
before_script:
- npm install
- npm install -g grunt-cli
lint:
stage: lint
script:
- grunt lint
test:
stage: test
script:
- grunt
- grunt test
- grunt coveralls
artifacts:
paths:
- dist/project*.min.js*
Run Code Online (Sandbox Code Playgroud) 我有一个利用GitLab CI的GitLab项目。该项目还使用子模块,该项目及其子模块都在同一个GitLab帐户下。
这是我的.gitmodules档案
[submodule "proto_contracts"]
path = proto_contracts
url = https://gitlab.com/areller/proto_contracts.git
Run Code Online (Sandbox Code Playgroud)
我在.gitlab-ci.yml文件中也有这部分
variables:
GIT_SUBMODULE_STRATEGY: recursive
Run Code Online (Sandbox Code Playgroud)
但是,当我运行配置项时,出现此错误
fatal: could not read Username for 'https://gitlab.com': No such device or address
Run Code Online (Sandbox Code Playgroud)
项目和子模块都在私有存储库中,因此您会被提示进行身份验证,但是正如我已经提到的,项目和子模块在同一帐户下,运行者的工作之一是克隆原始存储库
因此,奇怪的是它无法到达子模块。有没有解决的办法?
我们如何配置gitlab以仅保留最后10个CI作业/内部版本,并继续删除其余部分?
例如,在Jenkins中,我们可以将作业配置为仅保留最后的X版本。
concurrent = 3
[[runners]]
..
executor = "shell"
Run Code Online (Sandbox Code Playgroud)
和
concurrent = 3
[[runners]]
...
executor = "shell"
[[runners]]
...
executor = "shell"
[[runners]]
...
executor = "shell"
Run Code Online (Sandbox Code Playgroud)
在具有global的单个运行程序上有3个相同类型的执行程序(workers)?或者具有全局性的单个执行者可以安全地并行执行多个作业吗?concurrent = 3concurrent = 3
runners.limit与runners.request_concurrency和concurrent
谢谢
gitlab-ci-runner ×10
gitlab ×9
gitlab-ci ×7
cicd ×2
deployment ×2
docker ×2
bash ×1
volumes ×1