In one of my plugins I am using the GitSCM instance of a job to analyze the 
associated Git repository. This works for a lot of cases (input: a Jenkins run):

- For FreeStyle jobs I get the instance from AbstractProject.getSCM()
- For Pipelines jobs I get the instance from the job ((SCMTriggerItem) 
job).getSCMs()
- For Pipelines jobs with CpsScmFlowDefinition I get the instance from the 
definition ((CpsScmFlowDefinition) definition).getScm()

But when I use the following pipeline code in an integration test to check out 
a specific SHA-1 of a repository, then none of these options work to get the 
SCM. Is in such a case no SCM instance stored in the run or job? 
(I get called with a GitSCM instance in a CheckoutListener, thus the instance 
actually is created) 
checkout([$class: 'GitSCM', branches: [[name: 
'28af63def44286729e3b19b03464d100fd1d0587' ]], userRemoteConfigs: [[url: '" + 
REPOSITORY_URL + "']]])"
In the run I can find BuildData, GitTagAction and ScmRevisionState instances, 
but no one seems to link to the GitSCM.





-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/F3C48AB7-3CD8-430F-9FBF-D82784BA6C7A%40gmail.com.

Reply via email to