pycontribs / jenkinsapi

A Python API for accessing resources and configuring Hudson & Jenkins continuous-integration servers
http://pypi.python.org/pypi/jenkinsapi
MIT License
857 stars 485 forks source link

build.get_revision_branch() raising exception as get_scm_type() is returning None #860

Open krutcha opened 4 months ago

krutcha commented 4 months ago
ISSUE TYPE

Bug Report

Jenkinsapi VERSION

0.3.13

Jenkins VERSION

2.440.3

SUMMARY

on Build class, get_revision() works, however get_revision_branch() fails in get_revision_type() with jenkinsapi.custom_exceptions.NotSupportSCM: SCM class "None" not supported by API

EXPECTED RESULTS

get_scm__branch returns a branch name from github

ACTUAL RESULTS

jenkinsapi.custom_exceptions.NotSupportSCM: SCM class "None" not supported by API

USEFUL INFORMATION

pipeline type is 'pipeline script from SCM' SCM:git (a gitub instance)

krutcha commented 4 months ago

just incase it helps, I am able to get the branch name as follows w/o throwing an exception:

            element_tree = job._get_config_element_tree()
            #ET.dump(element_tree)
            for property in element_tree.iter():
                if property.tag == "hudson.plugins.git.BranchSpec":
                    branch = property.find("name").text