【发布时间】:2020-08-04 08:58:45
【问题描述】:
我正在尝试在 Gitlab CI 中配置自动构建。
我的项目有一个 git 子模块。
我正在使用 Linux docker 容器运行器。
Gitlab 无法检出子模块。
这是我的 .gitlab-ci.yml 文件。
stages:
- build
variables:
GIT_SUBMODULE_STRATEGY: recursive
build-backend:
image: mcr.microsoft.com/dotnet/core/sdk:3.1
stage: build
script:
- dotnet publish MyWebApp /p:PublishProfile="MyPublishProfile" /p:Password=1234
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
expire_in: 1 day
paths:
- MyWebApp/bin/Release
这里是 .gitmodules 文件
[submodule "MyWebApp/client"]
path = MyWebApp/client
url = git@git.mycompany.abc:company/client/myclient.git
branch = qa
错误信息包含这一行
error: cannot run ssh: No such file or directory
gitlab 中的完整错误信息
Running with gitlab-runner 13.1.0 (6214287e)
on runner-docker-builder-5.dev.nsynd.com t8cc1Yme
section_start:1596467453:prepare_executor
Preparing the "docker" executor
Using Docker executor with image mcr.microsoft.com/dotnet/core/sdk:3.1 ...
Pulling docker image mcr.microsoft.com/dotnet/core/sdk:3.1 ...
Using docker image sha256:abc123 for mcr.microsoft.com/dotnet/core/sdk:3.1 ...
section_end:1596467453:prepare_executor
section_start:1596467453:prepare_script
Preparing environment
Running on runner-t8cc1yme-project-440-concurrent-0 via runner-docker-builder-5.dev.nsynd.com...
section_end:1596467456:prepare_script
section_start:1596467456:get_sources
Getting source from Git repository
Fetching changes...
Reinitialized existing Git repository in /builds/company/client/MyWebApp/.git/
Checking out 0a9dd30c as qa...
Updating/initializing submodules recursively...
Synchronizing submodule url for 'MyWebApp/client'
Cloning into '/builds/company/client/MyWebApp/client'...
error: cannot run ssh: No such file or directory
fatal: unable to fork
fatal: clone of 'git@git.mycompany.abc:company/client/myclient.git' into submodule path '/builds/company/client/MyWebApp/client' failed
Failed to clone 'MyWebApp/client'. Retry scheduled
Cloning into '/builds/company/client/MyWebApp/client'...
error: cannot run ssh: No such file or directory
fatal: unable to fork
fatal: clone of 'git@git.mycompany.abc:company/client/myclient.git' into submodule path '/builds/company/client/MyWebApp/client' failed
Failed to clone 'MyWebApp/client' a second time, aborting
section_end:1596467459:get_sources
ERROR: Job failed: exit code 1
在父项目 (MyWebApp) 和子模块 (MyWebApp/client) 中,我都没有配置部署密钥和部署令牌。
【问题讨论】:
-
这个答案可能对你有用:stackoverflow.com/questions/58019082/…
标签: git continuous-integration gitlab gitlab-ci