jenkinsapi icon indicating copy to clipboard operation
jenkinsapi copied to clipboard

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

Open krutcha opened this issue 1 year ago • 2 comments

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 avatar Jun 19 '24 15:06 krutcha

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

krutcha avatar Jul 11 '24 20:07 krutcha

@krutcha What is the job type for which you are trying to fetch the Branch Names for? Is it a Pipeline Job with SCM?