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 Download Artifacts Multibranch Pipeline Query Failure #10691

Closed
ZachLarum opened this issue Jun 18, 2019 · 6 comments
Closed

Jenkins Download Artifacts Multibranch Pipeline Query Failure #10691

ZachLarum opened this issue Jun 18, 2019 · 6 comments

Comments

@ZachLarum
Copy link

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: Jenkins Download Artifacts

Environment

Server - Azure Pipelines

  • Account name: Ivanti
  • Build definition name/build number: builddefinitionId=9952, buildId=289813

Issue Description

We are using Azure Pipelines to processes a series of tasks

  • Queue Jenkins Job
  • Publish Test Results
  • Publish Artifact

Publish Artifacts is the failing task. We are running a multibranch pipeline job in Jenkins. A sample JSON response returned by the Jenkins query issued by the Azure Pipeline task is below in task logs. There are branches that do not build, ExampleBranchA and master. The only branch that builds is ExampleSuccessfulBranch.

We believe the bug lays in the following query because lastSuccessfulBuild.timestamp does not exist for each job.

{{#with (selectMaxOf jobs 'lastSuccessfulBuild.timestamp') as |job|}}{ "branchName": "{{job.name}}", "buildId": "{{job.lastSuccessfulBuild.id}}" }{{/with}} on the result

Task logs

Formatted for easier reading

##[debug]Content received from server

{
	"_class": "org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject",
	"jobs": [{
		"_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
		"name": "ExampleBranchA",
		"lastSuccessfulBuild": null
	}, {
		"_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
		"name": "master",
		"lastSuccessfulBuild": null
	}, {
		"_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
		"name": "ExampleSuccessfulBranch",
		"lastSuccessfulBuild": {
			"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
			"displayName": "#34",
			"id": "34",
			"timestamp": 1560871823671
		}
	}]
}
##[debug]Applying the handlebar source {{#with (selectMaxOf jobs 'lastSuccessfulBuild.timestamp') as |job|}}{ "branchName": "{{job.name}}", "buildId": "{{job.lastSuccessfulBuild.id}}" }{{/with}} on the result
##[error]Error: Getting last successful build number failed with an error: SyntaxError: Unexpected end of JSON input

Error logs

Log Snippet

##[error]Error: Getting last successful build number failed with an error: SyntaxError: Unexpected end of JSON input
@ZachLarum
Copy link
Author

Any update on this bug would be appreciated.

@kasubram
Copy link

kasubram commented Jul 1, 2019

I am looking into it.

@kasubram
Copy link

kasubram commented Jul 2, 2019

We have pushed a fix for this. As you pointed out selectMaxOf function was having trouble dealing with null values. This is fixed here

This might take a week or two to get deployed to production. Please wait for Jenkins download artifact task version greater than 1.154.0 (1.1.54.1 or 1.155.0...)

@kasubram kasubram closed this as completed Jul 2, 2019
@ZachLarum
Copy link
Author

Thank you very much for this fix!

@Beakster
Copy link

Beakster commented Aug 2, 2019

Hi, Running Azure Devops Server on Premesis. How do I depliy this fix? I have the same issue

@Lovakumar
Copy link
Contributor

@Beakster you can follow the below steps to deploy this fix on your OnPremise server.

  1. Checkout this repo
  2. Follow steps mentioned here to build the you are interested in.
  3. Follows steps mentioned here to update the task.

Please try above steps on a testing server before trying out on production server.

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

5 participants