vagrant - 使用 Vagrant 配置 Gitlab CI VirtualBox Runner
问题描述
1) 上下文
我正在使用 Gitlab 的 VirtualBox 运行器(Gitlab 版本 10.6.3)运行构建管道。当我手动创建一个基本映像(例如my-base-vm
)时,构建在1-n
Gitlab-CI 创建的克隆上完美运行。
2) 观察到的错误
但是,当我想使用 Vagrant(版本 2.2.2)配置基本映像时,我的工作的 Gitlab CI 构建输出显示以下内容:
Running with gitlab-runner 11.2.0 (35e8515d)
on myproject-build-machine 1c8ab769
Using VirtualBox version 5.2.18_Ubuntur123745 executor...
Creating new VM...
ERROR: Preparation failed: ssh: handshake failed: read tcp 127.0.0.1:35542->127.0.0.1:34963: read: connection reset by peer
Will be retried in 3s ...
Using VirtualBox version 5.2.18_Ubuntur123745 executor...
Creating new VM...
ERROR: Job failed: execution took longer than 1h0m0s seconds
该图像基于基本图像ubuntu/bionic64
。
3) 配置
跑步者(从 克隆my-base-vm
)似乎具有正确的 NAT 规则(输出VBoxManage showvminfo my-base-vm-runner-1c8ab769-concurrent-0
):
NIC 1 Rule(0): name = guestssh, protocol = tcp, host ip = 127.0.0.1, host port = 32805, guest ip = , guest port = 22
NIC 1 Rule(1): name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 2222, guest ip = , guest port = 22
Gitlabconfig.toml
配置了正确的用户名 +密码vagrant:vagrant
(Vagrantfile
config.vm.provision "shell", inline: <<-SHELL
sed -i 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
service ssh restart
SHELL
解决方案
推荐阅读
- c# - 如何制作带瞄准的射击技工?
- java - 在模拟上调用 void 静态方法
- c - 使用 _mm_cmpeq_epi8 返回 0 查找下一个 Ascii 空间
- mysql - 字段 'category_id' 没有默认值 MySQL
- zsh - `scons run` 目标完成 zsh
- c# - 在索引视图页面中显示插入和更新数据的消息
- html - 在带有图像、标题和描述的 (html, css) 容器中;为什么描述不会在标题下方开始?
- javascript - Ajax 响应看起来未定义
- x86-64 - 看到 0 后将掩码设置为 0?
- date - 更正格式字符串以在 Haskell 中解析日期时间