LoginSignup
9
5

More than 3 years have passed since last update.

ローカルで`.gitlab-ci.yaml`の動作確認をする

Last updated at Posted at 2020-01-09

背景

GitLab-CIを活用するために.gitlab-ci.ymlを修正するが、その動作確認のためにpushするのは面倒だし、logが汚れるので避けたい。

GitLabサーバへpushする前に、ローカル環境で.gitlab-ci.ymlの変更を動作確認する方法を調べた。

環境

  • CentOS 7.5.1804
  • gitlab-runner v12.6.0

ローカルにgitlab-runnerをインストール

あまり環境を汚したくないので、できればDockerコンテナ版で動かしたかったが、やり方を調べる時間がなかったので、通常版のgitlab-runnerを使用する。

# リポジトリを追加
curl -O https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh
sudo bash ./script.rpm.sh
# インストール可能なgitlab-runnerのバージョンを取得
yum list gitlab-runner --showduplicates | sort -r
# 指定したバージョンのgitlab-runnerをインストール
sudo yum install -y gitlab-runner-12.6.0-1

.gitlab-ci.ymlのあるパスに移動して動作確認

cd {your_local_repo_path}
# docker executor
gitlab-runner exec docker {your_job_name}
# shell executor
gitlab-runner exec docker {your_job_name}
9
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
5