how to use gitlab ci to deploy the project to i686 and x86_64 machine at the same time?

纵饮孤独 提交于 2019-12-12 07:39:26

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/33535967/how-to-use-gitlab-ci-to-deploy-the-project-to-i686-and-x86-64-machine-at-the-sam

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!