我有一个 java - maven 项目。
我的目标是能够在我的 gitlab 合并请求过程中运行 junit
我将文件 - .gitlab-ci.yml 添加到我的项目中,内容如下:
build:
stage: build
script:
- mvn complie
test:
stage: test
script: mvn clean test
但是当管道在 gitlab 中运行时,我得到了下一个错误:
这个作业卡住了,因为项目没有任何跑者在线 分配给它。转到项目 CI 设置
所以我在我的 linux 机器上安装了一个带有标签 maven 和自定义执行器的运行器。 /etc/gitlab-runner/config.toml 内容如下所示:
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "test-runner"
url = <gitlab_url>
id = 69
token = <gitlab_token>
token_obtained_at = 2023-05-01T10:58:44Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "custom"
builds_dir = "/builds"
cache_dir = "/cache"
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.custom]
run_exec = "/gitlab/scripts/run.sh"
run_args = [ "SomeArg" ]
run_exec_timeout = 200
graceful_kill_timeout = 200
force_kill_timeout = 200
run.sh的内容就是:
#!/usr/bin/env bash
echo "run_exec"
我在我的 .gitlab-ci.yml 中添加了一个新标签给跑步者,所以内容现在看起来像这样:
default:
tags:
- maven
build:
stage: build
script:
- mvn complie
test:
stage: test
script: mvn clean test
现在管道正在通过,但没有执行 maven 命令。 这是构建作业的输出
Running with gitlab-runner 15.11.0 (436955cb)
on test-runner SYVEZXAT, system ID: s_a82b2a00f42b
Resolving secrets
00:00
Preparing the "custom" executor
00:00
Using Custom executor...
Preparing environment
00:00
run_exec
Getting source from Git repository
00:00
run_exec
Executing "step_script" stage of the job script
00:00
WARNING: Starting with version 17.0 the 'build_script' stage will be replaced with 'step_script': https://gitlab.com/groups/gitlab-org/-/epics/6112
run_exec
Cleaning up project directory and file based variables
00:00
run_exec
Job succeeded
我错过了什么或者我应该做一些完全不同的事情来运行我的 junit 作为合并请求过程的一部分?