• Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • shelve-project-plugin
    • None

      It would be nice if there was a bulk API for shelving projects in batch.

      This would be used by seed jobs (via the job-dsl plugin) when unneeded jobs are automatically discarded and shelved. The bulk API would avoid avoid flooding the build queue with shelve tasks when there are many jobs to be discarded.

      See https://github.com/jenkinsci/job-dsl-plugin/pull/1174#discussion_r292322461 for the request.

          [JENKINS-58929] Bulk API for shelving projects

          It would be great if this bulk mode would transparently handle jobs as well as folders. That way, the jobdsl plugin would not need to take care to first shelve jobs, wait for that to finish and then delete the folders, for example.

          Carsten Pfeiffer added a comment - It would be great if this bulk mode would transparently handle jobs as well as folders. That way, the jobdsl plugin would not need to take care to first shelve jobs, wait for that to finish and then delete the folders, for example.

          Now that shelving of plain {{hudson.model.Item}}s is possible in 5dc264b, it would be great to have an API for shelving a bunch of Item-instances in one go. This would take care of resolving the minimum set of items to shelve (e.g. if a parent item shall be shelved, do not shelve the child items as well).

          Currently, the job-dsl-plugin invokes the shelving like this:

          jenkins.getQueue().schedule(new ShelveProjectTask(item), 0);
          

          The new API might be something as simple as this:

          List<Item> items = ...;
          List<Item> itemsToBeShelved = new ShelveItemResolver().resolve(items);
          jenkins.getQueue().schedule(new ShelveItemsTask(itemsToBeShelved), 0);
          

          WDYT?

          Carsten Pfeiffer added a comment - Now that shelving of plain {{hudson.model.Item}}s is possible in 5dc264b, it would be great to have an API for shelving a bunch of Item-instances in one go. This would take care of resolving the minimum set of items to shelve (e.g. if a parent item shall be shelved, do not shelve the child items as well). Currently, the job-dsl-plugin invokes the shelving like this: jenkins.getQueue().schedule( new ShelveProjectTask(item), 0); The new API might be something as simple as this: List<Item> items = ...; List<Item> itemsToBeShelved = new ShelveItemResolver().resolve(items); jenkins.getQueue().schedule( new ShelveItemsTask(itemsToBeShelved), 0); WDYT?

          Pierre Beitz added a comment -

          capf first sorry for the delay in answering you on this one...

          The bulk API would avoid avoid flooding the build queue with shelve tasks when there are many jobs to be discarded.

          I'm not really convinced of the added value of what you suggest as the shelve plugin is using lightweight executors therefore it should not be an issue to send multiple items to the queue.

           This would take care of resolving the minimum set of items to shelve (e.g. if a parent item shall be shelved, do not shelve the child items as well).

          This part is interesting indeed, this would address one of the fear I had on the JENKINS-27734 development. It would require quite some work though

          I cannot currently commit on this development, happy to help/review if somebody want to take a shot at it. I'm not sure yet when I'll have enough bandwidth to work on this :/

          Pierre Beitz added a comment - capf  first sorry for the delay in answering you on this one... The bulk API would avoid avoid flooding the build queue with shelve tasks when there are many jobs to be discarded. I'm not really convinced of the added value of what you suggest as the shelve plugin is using lightweight executors therefore it should not be an issue to send multiple items to the queue.  This would take care of resolving the minimum set of items to shelve (e.g. if a parent item shall be shelved, do not shelve the child items as well). This part is interesting indeed, this would address one of the fear I had on the  JENKINS-27734  development. It would require quite some work though I cannot currently commit on this development, happy to help/review if somebody want to take a shot at it. I'm not sure yet when I'll have enough bandwidth to work on this :/

            Unassigned Unassigned
            capf Carsten Pfeiffer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: