Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jenkins - Multibranch Pipeline -> Error on retrieving builds #106

Open
yoshgoodman opened this issue Feb 16, 2018 · 9 comments
Open

Jenkins - Multibranch Pipeline -> Error on retrieving builds #106

yoshgoodman opened this issue Feb 16, 2018 · 9 comments

Comments

@yoshgoodman
Copy link

TypeError: Cannot read property 'slice' of undefined at /build-mon/app/services/Jenkins.js:58:46 at Request._callback (/build-mon/app/services/Jenkins.js:31:17) at Request.self.callback (/build-mon/node_modules/request/request.js:186:22) at emitTwo (events.js:106:13) at Request.emit (events.js:194:7) at Request.<anonymous> (/build-mon/node_modules/request/request.js:1163:10) at emitOne (events.js:96:13) at Request.emit (events.js:191:7) at IncomingMessage.<anonymous> (/build-mon/node_modules/request/request.js:1085:12) at Object.onceWrapper (events.js:293:19)

@yoshgoodman yoshgoodman changed the title Jenkins Error on retrieving builds Jenkins - Multibranch Pipeline -> Error on retrieving builds Feb 16, 2018
@marcells
Copy link
Owner

Multibranch pipelines were not tested.

What Jenkins Server version do you use? I can try to reproduce it, but it could take a while, cause I'm off for serval days.

If you want to, you can also take a look at app/services/Jenkins.js and make a pull request.

@yoshgoodman
Copy link
Author

Thanks, @marcells we currently on Jenkins ver. 2.104

I will try to look at app/services/Jenkins.js but I have not had any node experience so don't expect much.

@yoshgoodman
Copy link
Author

Hi @marcells been trying to look at app/services/Jenkins.js

Seems as if Multibranch pipelines is a completely new build type.

In requestBuildsForJobByUrl Jenkins is not returning builds but rather jobs

You would need to refactor the whole file going forward. From my side, I don't have the knowledge to do so. So won't be making a PR.

Thanks for the awesome build monitor.

@dickschoeller
Copy link
Contributor

dickschoeller commented Feb 23, 2018

I was using curl to look at the returns from Jenkins with multibranch pipelines. If I give curl a path like https://node/job/my-group/job/my-job/job/master/api/json I get back response that looks like what you get from a traditional job. If you give one of the intermediate job names, like my-job, you get a list of jobs as the original problem statement describes. So, it would seem 2 things ought to be supported.

  1. Specify the top level and recurse in finding recent jobs.
  2. Specify the path to a specific job.

Note that master in the above URL is a specific branch. What I've seen in the Jenkins UI is that since each pull request is potentially on a new branch, the list of branches changes as those come and go. That's why the recursive approach is attractive, you could have a single config which reports on the active branches.

@dickschoeller
Copy link
Contributor

I just found a typo in my own configuration file. So, specifying the path down to the specific branch build works. The only issue would be then, to support recursing from a parent to show recent builds on all of the branches.

@marcells marcells removed the bug label Feb 25, 2018
@marcells
Copy link
Owner

marcells commented Feb 25, 2018

Alright. I'll take a look at it, if I find some time.

Do you think something like this would be a good configuration?

job: myjob
job: mygroup/myjob
job: mygroup/myjob/branch
job: mygroup/myjob/*
job: mygroup/*

I could then parse the job config with a regex or string split and make the appropriate api calls.

@dickschoeller
Copy link
Contributor

Sounds workable to me.

@marcells
Copy link
Owner

marcells commented Mar 3, 2018

@dickschoeller or @yoshgoodman Do you want to make the implementation?

It will take some time until I can take a look at it in detail. I also have to setup and configure Jenkins first.

@enigmatic
Copy link

enigmatic commented Mar 5, 2018

@dickschoeller I'm not sure if this works for your case, but I updated my fork by adding a new "jobs" option for a job that contains more jobs

My server is Enterprise version 2.89.4.2 and the jobs are structured: /job/<github organization>/job/<repo>/job/<branch>

Thus my config looks like:

"services": [
    {
      "name": "Jenkins",
      "configuration": {
        "url": "<server>",
        "jobs": "<github organization>/job/<repo>",
        "numberOfBuildsPerJob": 1,
        "options": {
          "strictSSL": false
        }
      }
    }
  ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants