はじめに
GitLabにはGitLab-CIと言うCI機能が付属しています。
GitLabCIはリポジトリのrootにgitlab-ci.yml
を置いておくと、そこに記述された手順にしたがってCIを回してくれるというものです。
GitLab-CIの機能を使用するには、ジョブを実行する環境、Runner
を用意する必要があります。
ここでは、GitLabの公式が提供しているGitlab-Multi-RunnerをDockerでインストールする手順を残しています。
手順はこちらに従っています。
GitLab-CIの環境
- CentOS Linux release 7.2 (runnerをインストールする環境)
- Gitlab CE 8.7 (GitLab側のバージョン)
インストール手順
Gitlab-Multi-Runnerの公式リポジトリをyumに追加します。
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash
gitlab-multi-runner
をインストールします。
sudo yum install gitlab-ci-multi-runner
runnerを登録します。
sudo gitlab-ci-multi-runner register
Running in system-mode.
# gitlabサーバーのURL+/ciを入力します
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/ci):
# gitlab-ci tokenを入力します
# tokenはGitlabのAdminエリアのRunnersに表示されています
Please enter the gitlab-ci token for this runner:
# runnerの説明を入力
Please enter the gitlab-ci description for this runner:
# runnerにつけるタグです
# gitlab上でrunnerの見分けがつくように適当なタグを入力します
Please enter the gitlab-ci tags for this runner (comma separated):
Registering runner... succeeded
# runnerの実行環境を入力します
# ここではdockerを選択
Please enter the executor: docker+machine, docker-ssh+machine, docker, docker-ssh, parallels, shell, ssh, virtualbox:
docker
# デフォルトのビルド実行するDockerイメージを入力します
# ここではruby:2.1を選択
Please enter the default Docker image (eg. ruby:2.1):
ruby:2.1
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!