hygieia / hygieia-scm-gitlab-collector

Hygieia Collector for Gitlab SCM
https://github.com/capitalone/Hygieia/blob/gh-pages/pages/hygieia/collectors/scm/gitlab.md
Apache License 2.0
4 stars 13 forks source link

CI with GitLab #5

Open xpdable opened 7 years ago

xpdable commented 7 years ago

Hello Team,

We've setup our CI pipeline with GitLab CI -> https://about.gitlab.com/gitlab-ci/ Would it be possible for Hygieia to integrate with that? We'd like to integrate the gitlab ci pipeline right with Hygieia pipeline. Thanks in advance.

image

Best regards, Xiaopeng

mrpudn commented 7 years ago

Certainly! - We would need to build a new collector, though :)

Relevant: https://docs.gitlab.com/ee/api/ci/README.html

xpdable commented 7 years ago

Any plan which release we will have this function ? Thanks

mrpudn commented 7 years ago

It does not appear as though anyone has signed up to build this yet, so no plans as of yet

floer32 commented 7 years ago

(There is SCM integration with GitLab but it appears CI is not implemented yet. The SCM integration should provide a good starting point though.)

tabladrum commented 7 years ago

There can be two ways to do this: (1) Write a GitLabBuildCollector - need the API end points and can be started with copying the JenkinsCollector. (2) POST to Hygieia API from gitlab build: /api/build with a request body like this:

{
        "number" : "52",
        "buildUrl" : "http://localhost:8082/job/NewPipe/52/",
        "jobName" : "NewPipe",
        "buildStatus" : "Success",
        "startTime" : NumberLong(1482263151065),
        "jobUrl" : "http://localhost:8082/job/NewPipe/",
        "instanceUrl" : "http://localhost:8082/",
        "niceName" : "TestJenkins",
        "endTime" : NumberLong(1482263152117),
        "duration" : 1052,
        "codeRepos" : [ 
            {
                "url" : "https://github.com/owner/TestRepo",
                "branch" : "refs/remotes/origin/master",
                "type" : "GIT"
            }
        ],
        "sourceChangeSet" : [ 
            {
                "scmRevisionNumber" : "128f124ce1d90acafe0934ebea8d7bca54dcdbe6",
                "scmCommitLog" : "commit 5",
                "scmAuthor" : "Tapabrata.Pal",
                "scmCommitTimestamp" : NumberLong(1482262975000),
                "numberOfChanges" : 1
            }, 
            {
                "scmRevisionNumber" : "2a8c540a0cb477571eded1359ff80d2f7a7bd911",
                "scmCommitLog" : "commit 6",
                "scmAuthor" : "Tapabrata.Pal",
                "scmCommitTimestamp" : NumberLong(1482262990000),
                "numberOfChanges" : 1
            }, 
            {
                "scmRevisionNumber" : "1a49aa6426efecb18b18aaea23014722f38e2708",
                "scmCommitLog" : "commit 7",
                "scmAuthor" : "Tapabrata.Pal",
                "scmCommitTimestamp" : NumberLong(1482263005000),
                "numberOfChanges" : 1
            }
        ]
    }
xpdable commented 7 years ago

@tabladrum Thanks. From my point of view after a quick glance on the Gitlab api ( as well as Gitlab ci api ). Is that possible ?

  1. On UI we have the possibility to set the project ( as what we did in Gitlab collector for code repo)
  2. Synchronize the data with Build -> each git lab build ( somehow we could select the corresponding data source coming from the Gitlab ci api )
  3. The deploy then could be able to chose the stage/phase from gitlab ci
olsib commented 6 years ago

hey guys, did anyone make this work? If so would be great if you could share with the community :)

xpdable commented 6 years ago

@olsib We found it quite flexible with the usage of API, so now I am using the option (2)

hopenbr commented 5 years ago

Hello I have a interest in this same integration, yet it sounds like this might be stalled.

ralphavalon commented 5 years ago

Same here