backstage: Jenkins Plugin - a.jobs is not iterable

Jenkins plugin is unable to fetch job details from Jenkins and returns back an error: a.jobs is not iterable 2021-01-08_15-30-10

app-config.yaml:

proxy:
  '/jenkins/api':
    target: https://myjenkinsserver.com
    changeOrigin: true
    headers:
      Authorization: Basic XX--MY-USER-TOKENBASE64--XXX

Job resides in a folder and is using SCM > GIT pointing to a Bitbucket Repo, final Jenkins URL to job is:

https://myjenkinsserver.com/job/backstage/job/ci-backstage/

Log:

2021-01-08T20:26:22.143Z backstage info ::1 - - [08/Jan/2021:20:26:22 +0000] "GET /api/proxy/jenkins/api/job/backstage/job/ci-backstage/api/json?tree=jobs%5Bactions%5B*%5D%2Cbuilds%5Bnumber%2Curl%2CfullDisplayName%2Cbuilding%2Cresult%2Cactions%5B*%5B*%5B*%5B*%5D%5D%5D%5D%5D%7B0%2C1%7D%2Cjobs%7B0%2C1%7D%2Cname%5D%7B0%2C50%7D HTTP/1.1" 200 59 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, 
like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.57" type=incomingRequest

Current Behavior

Possible Solution

Steps to Reproduce

Register a API using the annotations: jenkins.io/github-folder:

Context

Your Environment

  • NodeJS Version (v12)
  • Windows 10
  • Chrome

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 27 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I think we should take this as a feature request to add broader support for Jenkins integration cases - Jenkins freestyle projects seems to be common.

I’m cool with closing this one, I’ll open a new enhancement request to see if this plugin can be re-worked to fully support the Jenkins SCM API for any GIT based SCM

The latest run card defaults to master but you can override it.

The plugin has only been tested by me with organisation folder jobs backed by GitHub, it probably needs some tweaks to make it more generic for other use cases

Have you tried after the last fix was merged?

it sounds like it didn’t find the job

I believe he means if you just hit that same API endpoint more simply like this:

http://localhost:7000/api/proxy/jenkins/api/job/Backstage/job/Backstage/api/json

What do you get back? Essentially, the plugin passes directly to the Jenkins API a Jenkins-defined filtering mechanism called “tree” which lets you do all sorts of filtering and tweaking (sort of similar to XML XPATH). So it’s possible the result you are getting is different than the plugin is expecting.