12
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GitlabでCI Mac編

Posted at

最小コマンド

$ brew install gitlab-ci-multi-runner
$ gitlab-ci-multi-runner install
$ gitlab-ci-multi-runner start
$ gitlab-ci-multi-runner register 

register のあとはいつもの登録のURLやtokenを入力します。これで動いた方は後は読まなくても大丈夫です。

手こずったMac

runner を使っていままではすんなり動いていたのでこのMac編で意外と手こずりました。Linuxに近いコマンドも多いのですんなり行くと思っていたのですが甘かったです。
以下いくつかエラーがでたのでそれも残しておきます。

インストール

まずはインストールですが、公式のドキュメントにはcurlでとありますが・・・
おもむろにbrewでサーチしてみるw

$ brew search gitlab-ci-multi-runner
gitlab-ci-multi-runner

あれ?あるっぽいw

$ brew install gitlab-ci-multi-runner

==> Installing dependencies for gitlab-ci-multi-runner: docker
==> Installing gitlab-ci-multi-runner dependency: docker
==> Downloading https://homebrew.bintray.com/bottles/docker-1.12.1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring docker-1.12.1.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/docker
Target /usr/local/bin/docker
already exists. You may want to remove it:
  rm '/usr/local/bin/docker'

To force the link and overwrite all conflicting files:
  brew link --overwrite docker

To list all files that would be deleted:
  brew link --overwrite --dry-run docker

Possible conflicting files are:
/usr/local/bin/docker -> /Users/Gitlab/Library/Group Containers/group.com.docker/bin/docker
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completion has been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/docker/1.12.1: 10 files, 10.8M
==> Installing gitlab-ci-multi-runner
==> Downloading https://homebrew.bintray.com/bottles/gitlab-ci-multi-runner-1.6.0.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gitlab-ci-multi-runner-1.6.0.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/gitlab-ci-multi-runner/1.6.0: 6 files, 55.8M

コマンドが入ったことを確認

ちゃんとはいっていますね。この前のdebian編より新しいバージョンが入っているw

$ gitlab-ci-multi-runner --version
Version:      1.6.0
Git revision: 01b3ea1
Git branch:   1-6-stable
GO version:   go1.7.1
Built:        Mon, 26 Sep 2016 20:07:14 +0900
OS/Arch:      darwin/amd64

サービスが起動しているか確認

$ gitlab-ci-multi-runner status
gitlab-runner: Service is not installed.

あらま、サービスすらインストールされていないとお叱りをうけます。

サービスインストール

サービスインストールは無言・・・
再度ステータスを見ると動いてないとメッセージが変わってる。

$ gitlab-ci-multi-runner install
$ gitlab-ci-multi-runner status
gitlab-runner: Service is not running.

サービス起動

スタートして、再度ステータスを見ると動いていると表示されます。

$ gitlab-ci-multi-runner start
$ gitlab-ci-multi-runner status
gitlab-runner: Service is running!

いつも通りに登録

gitlab-ci-multi-runner register
Password:
Running in system-mode.                            
                                                   
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://gitlab/ci
Please enter the gitlab-ci token for this runner:
$ gitlab-ci-multi-runner start
$ gitlab-ci-multi-runner status
gitlab-runner: Service is running!Please enter the gitlab-ci description for this runner:
[Diamond.local]: Please enter the gitlab-ci tags for this runner (comma separated):
$ sudo gitlab-ci-multi-runner register
Running in system-mode.                            
                                                   
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://gitlab/ci
Please enter the gitlab-ci token for this runner:
52h1HW-mgqwFCFrDwT4K
Please enter the gitlab-ci description for this runner:
[mac.local]: mac-runner
Please enter the gitlab-ci tags for this runner (comma separated):

WARNING: No TLS connection state                   
Registering runner... succeeded                     runner=52h1HW-m
Please enter the executor: docker-ssh, docker+machine, kubernetes, docker, parallels, shell, ssh, virtualbox, docker-ssh+machine:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! 

スクリーンショット 2016-09-26 20.17.02.png

WARNING: No TLS connection state とでて上図の通り登録が上手く動きません。これは数週間なんで動かないか分からず悩みました。
いろいろググりやっと下記にある参考サイトを見るとどうやら以下の条件で動かないらしい。

  • macOS 10.12 Sierra
  • Go 1.6
  • Runner version 1.7.

MacOS も関わってるのか・・・なんか敷居高いな・・・
とりあえず、コマンド確認!!

$ gitlab-ci-multi-runner -v
Version:      1.6.0
Git revision: 01b3ea1
Git branch:   1-6-stable
GO version:   go1.7.1
Built:        Fri, 28 Oct 2016 08:15:17 +0900
OS/Arch:      darwin/amd64

GO のバージョンは良さそうだけど、runnerのバージョンはアウトですね。:cry:

gitlab-runner のバージョンアップ

# gitlab-ci-multi-runner stop
# sudo gitlab-ci-multi-runner uninstall
FATAL: Failed to uninstall gitlab-runner: remove /Library/LaunchDaemons/gitlab-runner.plist: no such file or directory 
# gitlab-ci-multi-runner status
gitlab-runner: Service is not installed.
$ brew uninstall gitlab-ci-multi-runner
Uninstalling /usr/local/Cellar/gitlab-ci-multi-runner/1.6.0... (6 files, 55.8M)

brew をアップデート。

$ brew update
Updated 3 taps (caskroom/cask, caskroom/versions, homebrew/core).
==> New Formulae
amqp-cpp             csvtomd              hostess              modd                 pyinvoke             sqldiff              typescript
archi-steam-farm     dbhash               jumanpp              nmh                  questdb              ssh-audit            yarn
  :
 <中略>
  :  
==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local

その後、バージョンを確認。
この悩んでる間にバージョンアップしたんですねorz

$ brew info gitlab-ci-multi-runner
gitlab-ci-multi-runner: stable 1.7.1 (bottled), HEAD
The official GitLab CI runner written in Go
https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gitlab-ci-multi-runner.rb
==> Dependencies
Build: go ✘
Recommended: docker ✘
==> Requirements
Build: git ✔
==> Options
--without-docker
    Build without docker support
--HEAD
    Install HEAD version

インストール開始。

$ brew install gitlab-ci-multi-runner
==> Installing dependencies for gitlab-ci-multi-runner: docker
==> Installing gitlab-ci-multi-runner dependency: docker
==> Downloading https://homebrew.bintray.com/bottles/docker-1.12.2.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring docker-1.12.2.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/docker
Target /usr/local/bin/docker
already exists. You may want to remove it:
  rm '/usr/local/bin/docker'

To force the link and overwrite all conflicting files:
  brew link --overwrite docker

To list all files that would be deleted:
  brew link --overwrite --dry-run docker
  :
 <中略>
  :  
successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/gitlab-ci-multi-runner
Target /usr/local/bin/gitlab-ci-multi-runner
already exists. You may want to remove it:
  rm '/usr/local/bin/gitlab-ci-multi-runner'

To force the link and overwrite all conflicting files:
  brew link --overwrite gitlab-ci-multi-runner

To list all files that would be deleted:
  brew link --overwrite --dry-run gitlab-ci-multi-runner

Possible conflicting files are:
/usr/local/bin/gitlab-ci-multi-runner
==> Summary
🍺  /usr/local/Cellar/gitlab-ci-multi-runner/1.7.1: 7 files, 55.7M

無事バージョンアップ。

$ gitlab-ci-multi-runner -v
Version:      1.7.1
Git revision: f896af7
Git branch:   1-7-stable
GO version:   go1.7.3
Built:        Tue, 08 Nov 2016 09:00:53 +0900
OS/Arch:      darwin/amd64

やっぱりコマンドだけでは動かない

TLS などのエラーはでなくなったのですが、やはり動きません。
やっぱりOSのアップグレードも必要なんですね。

OSもアップグレードしてSierraへ

OS をアップグレードしたら動きました。
うーん。OSも必要らしいですね。
何時もの登録を実行すると、以下のように正常に登録。

スクリーンショット 2016-11-08 8.31.41.png

関連

参考サイト

12
12
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
12
12

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?