Include placeholder tasks in get_running_builds

Pipeline jobs in in Jenkins 2.x appear as placeholder tasks for their
entire lifetime when queried via the API. The fix for #1659787
introduced completly ignoring placeholder tasks. Thus pipeline jobs are
never included in the list returned by get_running_builds.

This commit will change the behaviour of get_running_builds as follows:
  - Placeholder tasks will be included: So running pipeline jobs
    will be included.
  - Builds which do not have a build number yet will be ignored:
    This prevents the exception described in #1659787.

Change-Id: I30351ec78d6186b0674e3c08be00076b0ce2333e
Closes-Bug: #1750372
Related-Bug: #1659787
This commit is contained in:
Pascal Hofmann
2019-12-20 17:08:26 +01:00
parent 36c99d3436
commit 19e7f7395a
2 changed files with 3 additions and 9 deletions

View File

@@ -1461,7 +1461,7 @@ class Jenkins(object):
raise
for executor in info['executors']:
executable = executor['currentExecutable']
if executable and 'PlaceholderTask' not in executable.get('_class', ''):
if executable and 'number' in executable:
executor_number = executor['number']
build_number = executable['number']
url = executable['url']