community-plugins icon indicating copy to clipboard operation
community-plugins copied to clipboard

๐Ÿ› jenkins: EntityLatestJenkinsRunCard shows a TypeError for Multibranch Pipeline without any builds

Open knowacki23 opened this issue 1 year ago โ€ข 0 comments

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: Screenshot from 2024-09-03 08-48-19

Following error at Entity Overview Page where we are using EntityLatestJenkinsRunCard: Screenshot from 2024-09-03 08-42-54

๐Ÿ‘ 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: Screenshot from 2024-09-03 08-53-28

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: Screenshot from 2024-09-03 08-42-54

๐Ÿ‘Ÿ Reproduction steps

  1. Add a EntityLatestJenkinsRunCard to overviewPage.
  2. Register an Entity with a jenkins annotation pointing to a Multibranch Pipeline which haven't been built yet.
  3. 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?

Are you willing to submit PR?

None

knowacki23 avatar Sep 03 '24 07:09 knowacki23