GitLab為程式碼管理倉庫,且從8.0開始提供CI/CD。
sudo apt update
sudo apt install ca-certificates curl openssh-server postfix
cd /tmp/
curl -LO https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh
sudo bash /tmp/script.deb.sh
sudo apt install gitlab-ce
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
GitLab Runner可以安裝在不同機器上,在執行建構時,才不會影響到GitLab。
sudo apt-get install gitlab-runner
vim /etc/gitlab/gitlab.rb
修改“external_url”為自己的網址,並保存關閉設定檔。
sudo gitlab-ctl recofigure
sudo gitlab-ctl restart
sudo systemctl enable gitlab-runsvdir.service
vim /etc/gitlab/gitlab.rb
需要修改的項目如下,並保存關閉設定檔。
gitlab_rails['gitlab_email_enable']
gitlab_rails['gitlab_email_from']
gitlab_rails['gitlab_email_display_name']
gitlab_rails['smtp_enable']
gitlab_rails['smtp_address']
gitlab_rails['smtp_port']
gitlab_rails['smtp_user_name']
gitlab_rails['smtp_password']
gitlab_rails['smtp_domain']
gitlab_rails['smtp_authentication']
gitlab_rails['smtp_enable_starttls_auto']
gitlab_rails['smtp_tls']
sudo gitlab-ctl recofigure
sudo gitlab-rails console
sudo systemctl enable gitlab-runner
systemctl start gitlab-runner
Group首頁 -> Settings -> CI/CD -> Runners Expand
sudo gitlab-ci-multi-runner register
接著依指示輸入”GitLab網址“、”gitlab-ci的Token“、”Runner的描述“、”Runner的tag“和”選擇執行器“