3

我是一个使用gitlab-CI的新手,我的英语不太好。如何使用gitlab ci同时将项目部署到i686和x86_64机器?

我想用gitlab ci分别将一个项目部署到i686,x86_64 linux机器上。 因此,我可以在不同类型的linux centos上生成更新包。

现在我用gitlab服务器(192.168.1.240),gitlab亚军(192.168.1.184) 生产Server1上(192.168.1.162)生产服务器2(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" 

然后,添加到.gitlab-ci.yml和gitlab执行git push;

为什么该项目只安装在production162上;我希望它分别安装到production162和production163。

所以我搜索并阅读gitlab-ci-multi-runner document,故称

如果您想将其部署到使用GitLab CI多台服务器,你可以创建部署到多台服务器一个脚本或者您可以创建许多脚本。这取决于你想要做什么。

上面的脚本是什么? .gitlab-ctl.yml?
我可以使用一个GitLab CI部署到多个服务器吗?

+0

我解决这个问题: – michael

回答

3

我解决了这个问题;
.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亚军的标签deploy162,production163亚军的标签是deploy163

+0

这是我的[中国博客(https://开头o3o3o.github.io/2016/02/24/gitlabci/)关于gitlab CI。 – michael

相关问题