久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      搭建Gitlab CI持續(xù)集成環(huán)境入門(mén)教程

      簡(jiǎn)單介紹Gitlab CI的功能

      • 從GitLab 8.X 開(kāi)始,GitLab CI就已經(jīng)集成在GitLab中,我們只要在項(xiàng)目中添加一個(gè).gitlab-ci.yml文件,然后添加一個(gè)Runner,開(kāi)啟Runner,即可進(jìn)行持續(xù)集成。而且隨著GitLab的升級(jí),GitLab CI變得越來(lái)越強(qiáng)大。

      GitLab Runner

      • 在沒(méi)使用過(guò)Gitlab之前,我也有一個(gè)困惑,到底Gitlab Runner是什么東西、它的作用是什么?GitLab Runner就是來(lái)執(zhí)行這些構(gòu)建任務(wù)的
      • 而此時(shí)又會(huì)多了一個(gè)困惑,Gitlab CI不是也是用來(lái)運(yùn)行構(gòu)建任務(wù)的嗎?一般來(lái)說(shuō),構(gòu)建任務(wù)都會(huì)占用很多的系統(tǒng)資源(譬如編譯代碼),而GitLab CI又是GitLab的一部分,如果由GitLab CI來(lái)運(yùn)行構(gòu)建任務(wù)的話,在執(zhí)行構(gòu)建任務(wù)的時(shí)候,GitLab的性能會(huì)大幅下降。GitLab CI最大的作用是管理各個(gè)項(xiàng)目的構(gòu)建狀態(tài),因此,運(yùn)行構(gòu)建任務(wù)這種浪費(fèi)資源的事情就交給GitLab Runner來(lái)做拉!因?yàn)镚itLab Runner可以安裝到不同的機(jī)器上,所以在構(gòu)建任務(wù)運(yùn)行期間并不會(huì)影響到GitLab的性能。

      1、首先部署安裝Gitlab

      首先安裝git

      yum install -y git

      安裝Gitlab依賴(lài)

      yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python

      啟動(dòng)ssh,postfix并設(shè)置開(kāi)機(jī)啟動(dòng)和配置防火墻規(guī)則

      sudo systemctl enable sshd
      sudo systemctl start sshd
      sudo yum install postfix
      sudo systemctl enable postfix
      sudo systemctl start postfix
      sudo firewall-cmd –permanent –add-service=http
      sudo systemctl reload firewalld

      下載安裝Gitlab

      curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
      yum install gitlab-ce

      修改Gitlab配置,將external_url變量地址改為自己域名或IP地址

      vim  /etc/gitlab/gitlab.rb

      ## GitLab URL
      ##! URL on which GitLab will be reachable.
      ##! For more details on configuring external_url see:
      ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
      external_url ‘http://gitlab.test.com’

      ## Roles for multi-instance GitLab

      重新啟動(dòng)加載配置文件

      gitlab-ctl reconfigure
      gitlab-ctl restart

      可以netstat -ntlp查看啟動(dòng)的服務(wù)及端口(可以看出已經(jīng)啟動(dòng)了nginx服務(wù)及端口為80端口,所以可以直接訪問(wèn)前面配置的域名或IP地址)

      搭建Gitlab CI持續(xù)集成環(huán)境入門(mén)教程

      在瀏覽器上訪問(wèn)地址(管理員賬號(hào)密碼在UI界面上進(jìn)行設(shè)置)

      2、接下來(lái)安裝與配置Gitlab Runner

      點(diǎn)開(kāi)Runners可以看到一個(gè)設(shè)置的manually![]搭建Gitlab CI持續(xù)集成環(huán)境入門(mén)教程
      點(diǎn)擊install GitLab Runner安裝Gitlab Runner

      # For Debian/Ubuntu
      $ curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash
      $ sudo apt-get install gitlab-ci-multi-runner
      # For CentOS
      $ curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash
      $ sudo yum install gitlab-ci-multi-runner

      注冊(cè)Runner(這里可以選擇注冊(cè)一個(gè)指定的Runner或者注冊(cè)一個(gè)共享的Runner)

      指定的Runner可以理解為只能對(duì)某個(gè)份代碼有效的一個(gè)Runner,共享Runner可以理解為所有的代碼都可以應(yīng)用得到同一個(gè)Runner,但是注冊(cè)共享Runner只有admin權(quán)限又才可。

      • 注冊(cè)一個(gè)共享的Runner(注冊(cè)指定Runner也是一樣的操作)</br>
        首先admin的賬號(hào)下看到Runner的設(shè)置manually的URL與token信息
        搭建Gitlab CI持續(xù)集成環(huán)境入門(mén)教程

      sudo gitlab-ci-multi-runner register

      搭建Gitlab CI持續(xù)集成環(huán)境入門(mén)教程

      • 輸入Gitlab CI地址
      • 輸入項(xiàng)目Gitlab CI token
      • 輸入Gitlab Runner描述
      • 輸入Gitlab Runner標(biāo)簽
      • 輸入Gitlab Runner執(zhí)行的語(yǔ)言

      可以查看在Gitlab 共享Runner上多了一條Runner記錄
      搭建Gitlab CI持續(xù)集成環(huán)境入門(mén)教程
      也可以使用list查看Runner的狀態(tài):

      gitlab-runner  list
      Listing configured runners                          ConfigFile=/etc/gitlab-runner/config.toml
      cml_test*.*.172.123                          Executor=shell Token=ece68d167647507d1aa61d80ca0f05 URL=http://gitlab.test.com/

      • 接下來(lái)編寫(xiě).gitlab-ci.yml文件,推送到遠(yuǎn)程代碼倉(cāng)庫(kù)。
        這里演示一個(gè)簡(jiǎn)單的git pull操作

      cat .gitlab-ci.yml
      # 定義 stages
      stages:
        – test

      # 測(cè)試
      test:
        stage: test
        script:
          # Deploy test
          – ansible cml_test*.*.172.123 -a “cd /home/www/test;git pull”

      (這里我使用了ansible去管理,更新代碼操作)
      最后推送到遠(yuǎn)程代碼倉(cāng)庫(kù)上去。

      git add .
      git commit -m “fix .gitlab-ci.yml”
      git push

      • 在相應(yīng)的代碼庫(kù)下開(kāi)啟的這個(gè)共享Runner。
        搭建Gitlab CI持續(xù)集成環(huán)境入門(mén)教程

      提交代碼觸發(fā)CI

      搭建Gitlab CI持續(xù)集成環(huán)境入門(mén)教程

      Docker的搭建Gitlab CI 全過(guò)程詳解  http://www.linuxidc.com/Linux/2013-12/93537.htm

      持續(xù)集成環(huán)境Gitlab CI的官方安裝過(guò)程解析  http://www.linuxidc.com/Linux/2013-12/93535.htm

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)