如何使用gitlab ci将项目同时部署到i686和x86_64机器? [英] how to use gitlab ci to deploy the project to i686 and x86_64 machine at the same time?

查看:85
本文介绍了如何使用gitlab ci将项目同时部署到i686和x86_64机器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用gitlab-CI的新手,英语也不是很好。



我想使用gitlab ci将一个项目部署到i686,x86_64 linux机器上分别。
这样我就可以在不同类型的Linux centos上生成一个更新包。 )
生产服务器1(192.168.1.162)生产服务器2(192.168.1.163);

  gitlab-server(240) ->跑步者(184)
^ ^
product_s1(162)product_s2(163)

/etc/gitlab-runner/config.toml:

 并发= 1 

[[runners ]]
url = http://192.168.1.240/ci
令牌= fb8b064e53e31159e268853af6f8ea
名称= production162
执行者= ssh
[runners.ssh]
用户= root
主机= 192.168.1.162
端口= 22
identity_file = /home/user/.ssh/id_rsa

[[runners]]
url = http://192.168.1.240/ci
令牌= 18795ba96cfe74478ee63ff7decedd
名称= production163
执行者= ssh
[runners.ssh]
用户= root
主机= 192.168.1.250
端口= 22
identity_file = /home/user/.ssh/id_rsa

.gitlab-ci.yml:

 工作:
脚本:
-进行安装
- ./ci.sh

然后我添加 .gitlab-ci .yml 到gitlab并执行 git push ;



为什么仅在生产环境上安装该项目?我希望将其分别安装到production162和production163中。



所以我搜索并阅读了 gitlab-ci-multi-runner文件,它表示为


如果要使用GitLab CI部署到多个服务器,可以创建一个部署到多个服务器的脚本,也可以创建多个脚本。


上面的脚本是什么? .gitlab-ctl.yml?

我可以使用一个GitLab CI部署到多台服务器吗?

解决方案

我解决了这个问题;

.gitlab-ci.yml:

  162部署:#162 
阶段:部署
标签:
-deploy162
脚本:
-仅进行安装

-主

163部署:#163
阶段:部署
标签:
-deploy163
脚本:
- make&& make install $仅b $ b:
-主
-标签

设置production162赛跑者的标签是deploy162,production163跑步者的标签是deploy163


I am a Newbie using gitlab-CI and my english is not very good.

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.

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:

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:

job:
script:
    - "make install"
    - "./ci.sh"

Then I add .gitlab-ci.yml to gitlab and execute git push;

Why the project was installed only on production162; I want it to be installed into production162 and production163 respectively.

So I searched and read the gitlab-ci-multi-runner document, it said

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.

what is the scripts above? .gitlab-ctl.yml?
Can I use one GitLab CI deploy to multiple servers?

解决方案

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

set the production162 runner's tag is deploy162, production163 runner's tag is deploy163

这篇关于如何使用gitlab ci将项目同时部署到i686和x86_64机器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆