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

相關問題