Skip to content
7 changes: 7 additions & 0 deletions jenkinsapi/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,13 @@ def get_scm_type(self):
if scm_element:
# multibranch pipeline.
self._scm_prefix = multibranch_scm_prefix
if not scm_element:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we change this to be an else for line 539?
Would you add test coverage for this?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clintonsteiner, I have updated the alternate scm_element fetch mechanism. Please check. As per the test coverage, I have added the test case for the change, but it seems like the Jenkins instance used in the tests does not have the Pipeline suite. Please advise on how to proceed.

pipeline_scm_prefix = "definition/"
_pipeline_scm_path = pipeline_scm_prefix + "scm"
scm_element = element_tree.find(_pipeline_scm_path)
if scm_element:
# standard pipeline.
self._scm_prefix = pipeline_scm_prefix
scm_class = scm_element.get("class") if scm_element else None
scm = self._scm_map.get(scm_class)
if not scm:
Expand Down
Loading