๐ jenkins: EntityLatestJenkinsRunCard shows a TypeError for Multibranch Pipeline without any builds
Plugin Name
jenkins
๐ Description
When using Jenkins plugin with Multibranch Pipeline that haven't been built yet plugin displays a TypeError with following message:
D.lastBuild is null
This is how the affected Jenkins Pipeline looks like:
Following error at Entity Overview Page where we are using EntityLatestJenkinsRunCard:
๐ Expected behavior
It should display an information that no builds have been found instead of an error which looks like there was some problem with the plugin or connection with Jenkins instance.
On the other hand for one of the sub-pages for the same component we are using EntityJenkinsContent which displays information this way:
Something similar to the screenshot above would be nice.
๐ Actual Behavior with Screenshots
It actually displays following error at Entity Overview Page where we are using EntityLatestJenkinsRunCard:
๐ Reproduction steps
- Add a
EntityLatestJenkinsRunCardto overviewPage. - Register an Entity with a jenkins annotation pointing to a Multibranch Pipeline which haven't been built yet.
- Check the Entity overview page.
๐ Provide the context for the Bug.
Error:
TypeError
Message:
D.lastBuild is null
Stack Trace:
ge@https://backstage.url/static/vendor.6d116308.js:1:10294
Ei@https://backstage.url/static/module-react-dom.9141fc70.js:14:19476
Ti@https://backstage.url/static/module-react-dom.9141fc70.js:16:3147
ta@https://backstage.url/static/module-react-dom.9141fc70.js:16:44462
qs@https://backstage.url/static/module-react-dom.9141fc70.js:16:39491
Jc@https://backstage.url/static/module-react-dom.9141fc70.js:16:39422
Hr@https://backstage.url/static/module-react-dom.9141fc70.js:16:39279
Gs@https://backstage.url/static/module-react-dom.9141fc70.js:16:36449
Je@https://backstage.url/static/module-react-dom.9141fc70.js:14:3259
xe@https://backstage.url/static/module-react-dom.9141fc70.js:16:33775
Ic@https://backstage.url/static/module-react-dom.9141fc70.js:14:24759
aa</66088/a/g</<@https://backstage.url/static/vendor.6d116308.js:120:34549
promise callback*aa</66088/a/g<@https://backstage.url/static/vendor.6d116308.js:120:34505
aa</4812/n/<@https://backstage.url/static/vendor.6d116308.js:120:34060
Or@https://backstage.url/static/module-react-dom.9141fc70.js:16:24168
Gn@https://backstage.url/static/module-react-dom.9141fc70.js:16:42059
Gs@https://backstage.url/static/module-react-dom.9141fc70.js:16:36390
Je@https://backstage.url/static/module-react-dom.9141fc70.js:14:3259
Xi@https://backstage.url/static/module-react-dom.9141fc70.js:16:36756
Lu@https://backstage.url/static/module-react-dom.9141fc70.js:13:9031
Xl@https://backstage.url/static/module-react-dom.9141fc70.js:13:33157
Tl@https://backstage.url/static/module-react-dom.9141fc70.js:13:17381
ja@https://backstage.url/static/module-react-dom.9141fc70.js:13:17167
EventListener.handleEvent*No@https://backstage.url/static/module-react-dom.9141fc70.js:13:32666
Yl@https://backstage.url/static/module-react-dom.9141fc70.js:13:32066
52967/kt/<@https://backstage.url/static/module-react-dom.9141fc70.js:13:32232
kt@https://backstage.url/static/module-react-dom.9141fc70.js:13:32177
af@https://backstage.url/static/module-react-dom.9141fc70.js:16:52888
Gr@https://backstage.url/static/module-react-dom.9141fc70.js:16:53105
52967/oe.render@https://backstage.url/static/module-react-dom.9141fc70.js:16:56650
77970@https://backstage.url/static/main.6d116308.js:20:5867
a@https://backstage.url/static/runtime.6d116308.js:1:147
S@https://backstage.url/static/main.6d116308.js:20:7312
@https://backstage.url/static/main.6d116308.js:20:7445
a.O@https://backstage.url/static/runtime.6d116308.js:1:543
@https://backstage.url/static/main.6d116308.js:20:7462
s@https://backstage.url/static/runtime.6d116308.js:3:232
@https://backstage.url/static/main.6d116308.js:1:55
@https://backstage.url/static/main.6d116308.js:20:7471
Response from API Call to Jenkins
Backstage API Call URL:
https://backstage.url/api/jenkins/v1/entity/component-namespace/Component/component-name/projects?branch=main,master
Response:
{
"projects": [
{
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
"actions": [
{},
{},
{},
{},
{},
{},
{},
{
"_class": "jenkins.scm.api.metadata.ObjectMetadataAction",
"objectDescription": null,
"objectDisplayName": null,
"objectUrl": "https://bitbucket.url/projects/PROJECT/repos/repo-name/compare/commits?sourceBranch=refs%2Fheads%2Fmaster"
},
{
"_class": "jenkins.scm.api.metadata.PrimaryInstanceMetadataAction"
},
{},
{},
{
"_class": "org.jenkinsci.plugins.displayurlapi.actions.JobDisplayAction",
"displayUrl": "https://jenkins.url/blue/organizations/jenkins/Folder%2Fmultibranch-pipeline-name/"
},
{},
{
"_class": "com.cloudbees.plugins.credentials.ViewCredentialsAction",
"stores": {}
}
],
"displayName": "master",
"fullDisplayName": "Folder ยป multibranch-pipeline-name ยป master",
"fullName": "Folder/multibranch-pipeline-name/master",
"name": "master",
"url": "https://jenkins.url/job/Folder/job/multibranch-pipeline-name/job/master/",
"lastBuild": null,
"inQueue": false,
"status": "build not found"
}
]
}
๐ Have you spent some time to check if this bug has been raised before?
- [X] I checked and didn't find similar issue
๐ข Have you read the Code of Conduct?
- [X] I have read the Code of Conduct
Are you willing to submit PR?
None