2
3

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してみた

Posted at

環境

OS:Windows10

手順

  1. 下記手順に従ってGitLab-Runnerをインストールする

    ほぼ公式ガイド通りに行えばOK。ただし、サービス登録時にユーザーを指定しなかった。

    https://docs.gitlab.com/runner/install/windows.html

  2. Runnersがアクティブか確認。
    GitLabのプロジェクトのSettings>CI/CD>Runners settingsを開き、Runners activated for this project を確認。インジケーターが緑色になっていればアクティブになっている。

  3. gitlab-ci.yml を記述して、gitリポジトリにプッシュ。
    このファイルがCIの手順書らしい。Windowsばかりやっってたので、この辺の仕組みがなかなか、すんなりと理解できない。サンプルを参考に次のようなスクリプトを記述した。

job1:
  script:
    - echo "this is shell"

実行結果の確認

  1. 実行結果の確認
    GitLabのCI/CDを開くと実行結果が表示される。
    ci-fail.png

  2. 文字コードの設定
    ジョブは失敗しているのは分かったけど、出力結果が文字化けして原因が良く分からなかった。
    mojibake1.png

https://qiita.com/yufu/items/86a455f948a3e1c0ef97 を参考に、コマンドプロンプトの文字コードをUTF-8に変更すると、文字化けが直った。
mojibake2.png

  1. Gitが見つからないというエラーメッセージ。環境変数のPATHにgit.exeのディレクトリを追加。その後、git-runnerサービスを再起動。(ここも、パスを通した直後にJOBを実行したけど、gitが見つからないというエラーで悩んだ。)https://gitlab.com/gitlab-org/gitlab-runner/issues/2743で解決。
  2. やっと成功
    ci-success.png

参考

https://muunyblue.github.io/2d5b53f80151aea5fef0722f8b1edf99.html
https://qiita.com/enomotok_/items/83935c1137203e1c2c0f

2
3
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?