LoginSignup
17
14

More than 5 years have passed since last update.

Rancher2.1で、GitLabとの連携が簡単になったみたいなので、試してみた。

Last updated at Posted at 2018-10-25

Rancher2.1でGitLabとの連携が簡単になったみたいなので、使い勝手を試してみました。

※今回はGoogle Cloud Platform(GCP)上に環境を構築しています。

  1. Google Compute Engine上のVMにUbuntu16.04を入れてベース環境を構築します。
  2. ベース環境にDockerを導入します。
  3. ベース環境にRancherを導入します。
    docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest
    Screen Shot 2018-10-25 at 23.47.32.png
  4. RancherからClusterを追加 Screen Shot 2018-10-25 at 23.55.14.png Screen Shot 2018-10-25 at 23.55.45.png 3つのNodeを持つ環境が構築されました。 Screen Shot 2018-10-26 at 0.00.09.png
  5. GitLabのプロジェクト情報を取り込みます。
    DefaultのNamespaceでPiplelinesを選択し、Configure Repositoriesを選択します。 Screen Shot 2018-10-26 at 0.03.46.png Authorize & Fetch Your Own Repositoriesを選択します。 Screen Shot 2018-10-26 at 0.05.32.png GitLabを選択します。 Screen Shot 2018-10-26 at 0.07.10.png GitLabにRancherの画面に表示されていた情報を設定します。
    最初、「Redirect URIって何を設定するんだ?」と思いましたが、Rancherの画面で表示されているRedirect URIをそのまま貼るだけでした。楽ちん。
    必要なScopesはapiだけのようです。 Screen Shot 2019-01-25 at 10.19.21.png Screen Shot 2019-01-25 at 10.22.05.png 取得できたApplication IDとSecretをRancherに設定し、Authenticateを押します。 Screen Shot 2018-10-26 at 0.13.08.png GitLabの認証画面が出ますので、Authorizeを押します。 Screen Shot 2018-10-26 at 0.15.19.png 使用できるRepositoriesが表示されますので、使用するRepositoryを選択してEnabledにします。 Screen Shot 2018-10-26 at 0.18.51.png
  6. Piplelineを編集します。 Screen Shot 2018-10-26 at 0.20.17.png
  7. Pipelineを実行(Run)します。 Screen Shot 2018-10-26 at 0.21.34.png 実際に内部で実行されるのはJenkinsです。 Screen Shot 2018-10-26 at 0.40.40.pngScreen Shot 2018-10-26 at 0.48.52.png Screen Shot 2018-10-26 at 0.39.54.png

Kubernetesクラスタを作成した後の動作を動画にまとめましたので、合わせてご参照ください。
https://www.youtube.com/watch?v=xEi4Waonno4

17
14
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
17
14