GitLab Runner CI 在 Windows 10 上非常慢
GitLabRunner CI very slow on Windows 10
我已将 GitLabRunner 14.4.0 (4b9e985a)
作为服务安装在 Windows Server
上,参数如下:
抱歉,非英语,但我想很清楚那里发生了什么。
除了GitLab-Runner,服务器上运行什么都没有,所以所有资源都是免费的。
这里是 config.toml
:
concurrent = 5
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "TorgovayaSystema"
url = "https://srvgitlab.maxi-net.ru/"
token = "xxxxxx_xxxxxxxxxxxxx"
executor = "shell"
shell = "cmd"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
我尝试了两个 shell - cmd
和 pwsh
。
我 运行 任务来自 CI
配置:
stages:
- build
build-modules-job:
stage: build
variables:
ErrorActionPreference: stop
script:
- .\gradlew.bat compile
tags:
- cpp
我运行gradlew.bat compile
单独在本机上的时候,需要一分钟,但是里面运行ner in goes timeout,是之前的一个小时。
所以,我的问题是 1 小时超时
我尝试使用 -d
标志,得到很多:
2021-11-12T18:21:33.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-11-12T18:21:33.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-11-12T18:21:33.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-11-12T18:21:33.778+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-11-12T18:21:33.778+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-11-12T18:21:33.778+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-11-12T18:21:43.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-11-12T18:21:43.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-11-12T18:21:43.778+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-11-12T18:21:43.779+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-11-12T18:21:43.779+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-11-12T18:21:43.780+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
我想这在 gradle 或 CI 配置中不是问题,因此 git 初始化也需要很多时间...
我想这是 gitlab-runner.exe
...
中的内容
有人有想法吗?
好的,所以首先,我要感谢在我post下写评论的人。
我实际上尝试了两种建议的方法:
- 运行
gitlab-runner.exe
使用我自己的帐户使用 gitlab-runner install --user user --password password
选项
- 运行
gradle task --no-daemon
另外,很重要的一点,当你在批处理脚本中使用gradle
或maven
时,你需要用call
语句来执行它,例如:
- 正在调用:
call gradle compile --no-daemon
这样,脚本就会继续。
但是系统还是挂了...
我尝试 运行 使用编译命令单独批处理所有这些,它们是相同的,gradle
插件用于构建 Borland CPP
:
- 使用
bpr2mak.exe
和 make.exe
手册 运行 的脚本
然后我发现了问题...当我从Gradle
插件中运行它时,它使用了这样一段代码:
Process process = Runtime.getRuntime().exec(command, envVars.toArray(new String[0]), cwd);
BufferedReader out = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = out.readLine()) != null) {
logger.log(line);
System.out.println(line);
}
process.waitFor();
return process.exitValue();
所以 Runtime.exec()
有一些特殊性,并且 out.readLine()
中有阻塞读取与 process.waitFor()
的相互阻塞。你可以在这里阅读 about.
所以这里进程挂了!它冻结了:
Loaded cached pre-compiled headers
DocAssImpl.cpp:
FmDocAss.cpp:
当我 ADDED stderr BEFORE stdout 时,它继续,并给我一个预期的消息。
完整代码:
Process process = Runtime.getRuntime().exec(command, envVars.toArray(new String[0]), cwd);
BufferedReader out = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader err = new BufferedReader(new InputStreamReader(process.getErrorStream()));
String line;
while ((line = err.readLine()) != null) {
logger.log(line);
System.out.println(line);
}
while ((line = out.readLine()) != null) {
logger.log(line);
System.out.println(line);
}
process.waitFor();
return process.exitValue();
结果消息;
BUILD FAILED in 3s
2 actionable tasks: 2 executed
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit status 1
所以毕竟,问题出在包含路径中......我们的构建系统广泛使用subst
,因此为了成功编译,有必要在构建脚本中添加以下命令:
subst L: C:\Work\projects\Library\
subst P: C:\Work\projects\TradingSystem\
我已将 GitLabRunner 14.4.0 (4b9e985a)
作为服务安装在 Windows Server
上,参数如下:
抱歉,非英语,但我想很清楚那里发生了什么。
除了GitLab-Runner,服务器上运行什么都没有,所以所有资源都是免费的。
这里是 config.toml
:
concurrent = 5
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "TorgovayaSystema"
url = "https://srvgitlab.maxi-net.ru/"
token = "xxxxxx_xxxxxxxxxxxxx"
executor = "shell"
shell = "cmd"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
我尝试了两个 shell - cmd
和 pwsh
。
我 运行 任务来自 CI
配置:
stages:
- build
build-modules-job:
stage: build
variables:
ErrorActionPreference: stop
script:
- .\gradlew.bat compile
tags:
- cpp
我运行gradlew.bat compile
单独在本机上的时候,需要一分钟,但是里面运行ner in goes timeout,是之前的一个小时。
所以,我的问题是 1 小时超时
我尝试使用 -d
标志,得到很多:
2021-11-12T18:21:33.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-11-12T18:21:33.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-11-12T18:21:33.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-11-12T18:21:33.778+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-11-12T18:21:33.778+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-11-12T18:21:33.778+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-11-12T18:21:43.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-11-12T18:21:43.777+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-11-12T18:21:43.778+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
2021-11-12T18:21:43.779+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2021-11-12T18:21:43.779+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2021-11-12T18:21:43.780+0300 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
我想这在 gradle 或 CI 配置中不是问题,因此 git 初始化也需要很多时间...
我想这是 gitlab-runner.exe
...
中的内容
有人有想法吗?
好的,所以首先,我要感谢在我post下写评论的人。
我实际上尝试了两种建议的方法:
- 运行
gitlab-runner.exe
使用我自己的帐户使用gitlab-runner install --user user --password password
选项 - 运行
gradle task --no-daemon
另外,很重要的一点,当你在批处理脚本中使用gradle
或maven
时,你需要用call
语句来执行它,例如:
- 正在调用:
call gradle compile --no-daemon
这样,脚本就会继续。
但是系统还是挂了...
我尝试 运行 使用编译命令单独批处理所有这些,它们是相同的,gradle
插件用于构建 Borland CPP
:
- 使用
bpr2mak.exe
和make.exe
手册 运行 的脚本
然后我发现了问题...当我从Gradle
插件中运行它时,它使用了这样一段代码:
Process process = Runtime.getRuntime().exec(command, envVars.toArray(new String[0]), cwd);
BufferedReader out = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = out.readLine()) != null) {
logger.log(line);
System.out.println(line);
}
process.waitFor();
return process.exitValue();
所以 Runtime.exec()
有一些特殊性,并且 out.readLine()
中有阻塞读取与 process.waitFor()
的相互阻塞。你可以在这里阅读 about.
所以这里进程挂了!它冻结了:
Loaded cached pre-compiled headers
DocAssImpl.cpp:
FmDocAss.cpp:
当我 ADDED stderr BEFORE stdout 时,它继续,并给我一个预期的消息。
完整代码:
Process process = Runtime.getRuntime().exec(command, envVars.toArray(new String[0]), cwd);
BufferedReader out = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader err = new BufferedReader(new InputStreamReader(process.getErrorStream()));
String line;
while ((line = err.readLine()) != null) {
logger.log(line);
System.out.println(line);
}
while ((line = out.readLine()) != null) {
logger.log(line);
System.out.println(line);
}
process.waitFor();
return process.exitValue();
结果消息;
BUILD FAILED in 3s
2 actionable tasks: 2 executed
Cleaning up project directory and file based variables 00:00
ERROR: Job failed: exit status 1
所以毕竟,问题出在包含路径中......我们的构建系统广泛使用subst
,因此为了成功编译,有必要在构建脚本中添加以下命令:
subst L: C:\Work\projects\Library\
subst P: C:\Work\projects\TradingSystem\