Verigreen / verigreen

Verigreen is a lightweight, server side solution for verification of git commits. It is a gated check-in process which will not allow any failed CI commit to go into an integration/release/any protected branch. We keep it green (hence the name).
Apache License 2.0
57 stars 19 forks source link

Verigreen doesnt get the status from jenkins Job #118

Closed rachant closed 8 years ago

rachant commented 8 years ago

This is the log we see after the jenkins job has been built. 21/09/16 15:11:02:002 INFO [com.verigreen.collector.common.log4j.VerigreenLogger] * com.verigreen.collector.jobs.CallJenkinsJob::createRestCall (tid: 22) * Sending REST call to Jenkins server...

soninob commented 8 years ago

@rachant just to make sure I understood correctly, you can trigger a build, but VG is not being notified of status change? please supply the Jenkins version you are using. is this happen in all statuses or just a specific status?

rachant commented 8 years ago

Yes the status change isn't being notified. We use enterprise cloudbees 1.625. We have just started with verigreen and this happened after we ran a test commit.

soninob commented 8 years ago

Are all status changes are not being reflected (including success and failure)? please run against your Jenkins the following call: api/json?depth=1&pretty=true&tree=builds[number,result,building,timestamp,actions[parameters[value]]] please paste your results

rachant commented 8 years ago

on OSS version of jenkins the results are coming up and verigreen works.

{ "builds" : [ { "actions" : [ { "parameters" : [ { "value" : "vg143c54b*****_new_1474541483468" } ] }, {

    },
    {

    },
    {

    },
    {

    },
    {

    }
  ],
  "building" : false,
  "number" : 3,
  "result" : "SUCCESS",
  "timestamp" : 1474541567149
},
{
  "actions" : [
    {
      "parameters" : [
        {
          "value" : "vg_dc07166_*****_new_1474536816440"
        }
      ]
    },
    {

    },
    {

    },
    {

    },
    {

    },
    {

    }
  ],
  "building" : false,
  "number" : 2,
  "result" : "SUCCESS",
  "timestamp" : 1474536906939
},
{
  "actions" : [
    {
      "parameters" : [
        {
          "value" : "vg_9cce9e9_*****_new_1474536457386"
        }
      ]
    },
    {

    },
    {

    },
    {

    },
    {

    },
    {

    }
  ],
  "building" : false,
  "number" : 1,
  "result" : "SUCCESS",
  "timestamp" : 1474536486916
}

] }

where as on cloudbees enterprise Jenkins it returns

{

}

soninob commented 8 years ago

It seems that Jenkins not supporting their API. So no support right now for Jenkins enterprise. In the spirit of open-source, do you want to contribute a fix?

soninob commented 8 years ago

I suggest you will check what is the equivalent to api/json?depth=1&pretty=true&tree=builds[number,result,building,timestamp,actions[parameters[value]]]");

And then you can add support to it, you can take a look at https://github.com/Verigreen/verigreen/blob/93e4efed4dd63e3c99a26785abad8e90d7fe1a89/verigreen-collector-impl/src/main/java/com/verigreen/collector/jobs/CallJenkinsJob.java Please check ‘calllingJenkinsForUpdate’ method.

Waiting to see your PR ☺

Barak Nisim Sonino Office +972-3-5398260 Yehud, M1 Engineering Excellence – DevOps Mobile +972-52-2343680 hpe.com Tech Lead

[HPE logo]http://www.hpe.com/

From: PKDSP [mailto:notifications@github.com] Sent: Friday, September 23, 2016 8:25 AM To: Verigreen/verigreen verigreen@noreply.github.com Cc: Sonino, Barak Nisim soninob@hpe.com; Comment comment@noreply.github.com Subject: Re: [Verigreen/verigreen] Verigreen doesnt get the status from jenkins Job (#118)

yes, we will contribute a fix . But what we have to do any idea ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Verigreen/verigreen/issues/118#issuecomment-249105808, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACj0zlELzGuzyxyYWw2FRnYTcXD7UIGuks5qs2KWgaJpZM4KDOn1.

rachant commented 8 years ago

this has been fixed by opening anonymous read access on jenkins instance. Also we had a '/" missing at the end in jenkins.url in config.propeties.

Thanks Barak for your help.

persiarash commented 8 years ago

Would like to reopen this issue. Attempting w/ Jenkins version 2.9, the endpoint (/api/json?depth=1&pretty=true&tree=builds[number,result,building,timestamp,actions[parameters[value]]]) returns:

{
  "_class" : "hudson.model.Hudson"
}

I of course assume this is a problem, but I don't know what the expected response needs to be, so that I may find an equivalent endpoint to call. Could you please provide what the reply should be, so that I may find a Jenkins REST API endpoint to provide it?

This is resulting in the Jenkins job running to completion, but the collector action stuck in the "RUNNING" state indefinitely, which prevents the verified/merged branch from being pushed to master.

Thank you.

soninob commented 8 years ago

Thanks, Jenkins 2 is not supported. You are right about the API. This is the problem. The result should be a Json response wit the list of builds and their statues. Will aprreciate if you would like to contribute the code. I would start with some simple way- upgrading the Jenkins client version. I know that offbytwo are supporting Jenkins 2 😀

soninob commented 8 years ago

@persiarash - I'm closing this one, please open a new issue for supporting Jenkins2, I will label it as an enhancement.