如何使用gitlab ci将项目同时部署到i686和x86_64机器上? [英] how to use gitlab ci to deploy the project to i686 and x86_64 machine at the same time?
问题描述
我是一个使用 gitlab-CI 的新手,我的英语不是很好.
I am a Newbie using gitlab-CI and my english is not very good.
我想用 gitlab ci 将一个项目分别部署到 i686、x86_64 linux 机器上.这样我就可以在不同类型的linux centos上生成更新包了.
I want to use gitlab ci to deploy one project to i686, x86_64 linux machine respectively. So I can generate an update package on different types linux centos.
现在我使用 gitlab-server(192.168.1.240),gitlab runner (192.168.1.184)生产服务器1(192.168.1.162) 生产服务器2(192.168.1.163);
Now I use gitlab-server(192.168.1.240), gitlab runner (192.168.1.184) production server1(192.168.1.162) production server2(192.168.1.163);
gitlab-server(240) --> runner(184)
^ ^
product_s1(162) product_s2(163)
/etc/gitlab-runner/config.toml:
/etc/gitlab-runner/config.toml:
concurrent = 1
[[runners]]
url = "http://192.168.1.240/ci"
token = "fb8b064e53e31159e268853af6f8ea"
name = "production162"
executor = "ssh"
[runners.ssh]
user = "root"
host = "192.168.1.162"
port = "22"
identity_file = "/home/user/.ssh/id_rsa"
[[runners]]
url = "http://192.168.1.240/ci"
token = "18795ba96cfe74478ee63ff7decedd"
name = "production163"
executor = "ssh"
[runners.ssh]
user = "root"
host = "192.168.1.250"
port = "22"
identity_file = "/home/user/.ssh/id_rsa"
.gitlab-ci.yml:
.gitlab-ci.yml:
job:
script:
- "make install"
- "./ci.sh"
然后我将 .gitlab-ci.yml
添加到 gitlab 并执行 git push
;
Then I add .gitlab-ci.yml
to gitlab and execute git push
;
为什么项目只安装在 production162 上;我希望它分别安装到 production162 和 production163 中.
Why the project was installed only on production162; I want it to be installed into production162 and production163 respectively.
所以我搜索并阅读了 gitlab-ci-multi-runner 文档,上面写着
So I searched and read the gitlab-ci-multi-runner document, it said
如果您想使用 GitLab CI 部署到多个服务器,您可以创建一个部署到多个服务器的脚本,也可以创建多个脚本.这取决于你想做什么.
If you'd like to deploy to multiple servers using GitLab CI, you can create a single script that deploys to multiple servers or you can create many scripts. It depends on what you'd like to do.
上面的脚本是什么?.gitlab-ctl.yml?
我可以使用一个 GitLab CI 部署到多台服务器吗?
what is the scripts above? .gitlab-ctl.yml?
Can I use one GitLab CI deploy to multiple servers?
推荐答案
我解决问题;
.gitlab-ci.yml:
I solve the problem;
.gitlab-ci.yml:
162deploy: # 162
stage: deploy
tags:
- deploy162
script:
- "make && make install"
only:
- master
163deploy: # 163
stage: deploy
tags:
- deploy163
script:
- "make && make install"
only:
- master
- tags
设置production162 runner的标签是deploy162,production163 runner的标签是deploy163
set the production162 runner's tag is deploy162, production163 runner's tag is deploy163
这篇关于如何使用gitlab ci将项目同时部署到i686和x86_64机器上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!