We're updating the issue view to help you get more done. 

Most jobs are marked as deleted directly after sync, although they are not deleted in jenkins

Description

After creating a new Jenkins site in Jira a full sync is made. The sync finds all jenkins jobs, but most of the jobs (251 of 263) are marked as deleted in the Jira Jobs Database Table and shown as inactive in the Jira Jenkins Site view.

This issue looks like  but I don't see any pattern which jobs are marked or not marked as deleted. For example there are two jenkins jobs "XCore - Web" and "XCore - Core". One is ok and one is marked as deleted.

 

Environment

current version of jira and plugin

Activity

Show:
Mark Rekveld
November 5, 2018, 11:47 AM

Jobs are only marked as deleted is the API request for the Job's JSON data returns a 404 error indicating that the Job can't be found by Jenkins.

Do you have any logs (preferably with debug enabled) on this issue.

Horst Krause
November 5, 2018, 12:26 PM

I did not find any request to a job (pattern: /job/<jobname>/api/json/) with a 404.

But I find many 404 for job build requests (pattern: /job/<jobname>/<buildnumber>/api/json/).

I checked in detail for two jobs. In both there are builds requested which do not exist any more and which are not reported in the job json. But there are archived older builds.

Perhaps this triggers JJI to request more builds? And then the 404 of build request triggers deletion of job?

Log for one job:

 

After some 200 requests to existing builds then we get this 404: 

 

Mark Rekveld
November 7, 2018, 9:34 AM

But I find many 404 for job build requests (pattern: /job/<jobname>/<buildnumber>/api/json/).

That will only mark the build as deleted and not the job.

I checked in detail for two jobs. In both there are builds requested which do not exist any more and which are not reported in the job json. But there are archived older builds.

Perhaps this triggers JJI to request more builds? And then the 404 of build request triggers deletion of job?

This could be, with it was identified that Jenkins uses paging to limited the builds returned to a max of 100 when asking for job details. Instead of adding multiple requests to get the complete list of jobs the solution was picked to simple backfill the list of builds using the older build number. For example, if you job returns builds 51 - 150 but has a older build number of 1, then the add-on would schedule synchronization of builds 1 - 150, to make sure all builds get synchronized. This can result in additional requests to Jenkins to get these builds, some may even be deleted already, but this method was deemed to be the simplest way to get this working reliably.

You can impose a limit by configuring to only synchronize unknown builds, then builds are only synchronized once limiting the impact on Jenkins.

Assignee

Unassigned

Reporter

Horst Krause

Labels

None

Epic/Theme (migrated)

None

Patch submitted

None

Testcase(s) included

None

Components

Affects versions

Priority

Major
Configure