Giter Site home page Giter Site logo

gitlab-systemhook-receiver's Introduction

gitlab-systemhook-receiver

gitlabのリポジトリ作成とJenkins側のジョブ作成およびアクセス制御をシームレスにするためのツール
GitlabとJenkinsには同じアカウントが存在している前提

仕様

  • gitlabのsystem-hookを受け取ってJSONをパースする
  • 受け取るJSON情報は以下のような感じ
{
          "created_at": "2012-07-21T07:30:54Z",
          "event_name": "project_create",
                "name": "StoreCloud",
         "owner_email": "[email protected]",
          "owner_name": "John Smith",
                "path": "storecloud",
 "path_with_namespace": "jsmith/storecloud",
          "project_id": 74,
  "project_visibility": "private",
}
  • gitlabから来るやつはヘッダーにX-Gitlab-Event: System Hookがつく
  • パースした結果をもとにJenkins側でごにょごにょやる
  • ジョブ作成、アクセス制御
  • Jenkins側はCLIとWebAPIがあるみたい。とりあえず、javaコマンドを実行する?WebAPIの仕様次第
  • WebAPIってbasic認証かな?簡単かつCLIとやれること一緒ならWebAPIで実装する
  • エラー通知はログ出力+管理者にメール程度で
  • portは開発系のOSSとバッティングしないような適当なポート(8090とか)で待ち受ける

機能

  1. Gitlabにリポジトリを作成するとJenkins上に対応するジョブを作成する
  • reponame-push-hook ・・・プッシュのフックを受け取って実行させるやつ
  • reponame-master-UT,reponame-develop-UT ・・・↑のジョブから実行される子ジョブ
  • reponame-master-IT ・・・結合テスト用のジョブ、環境依存なのでGit以外は空のジョブ
  1. Gitlabのリポジトリにメンバを追加するとJenkins側のアクセス権も反映する
  • guest→read権限、master,developer→admin権限
  • reponame始まりのジョブに対して設定する

使い方イメージ

とりあえず動かす方法

$ gitlab-systemhook-receiver -p 8090

TODO

  • デーモンで起動させる。(systemd前提でgitlab-systemhook-receiver.serviceでもいいかな)

gitlab-systemhook-receiver's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.