Looking at a script I wrote ages ago to parse a bunch of Jenkinsfiles, 
something like

FlowDefinition definition = job.getDefinition()
scriptPath = ((CpsScmFlowDefinition) definition).getScriptPath()

might point you in the right direction?

On Tuesday, February 12, 2019 at 4:54:30 PM UTC, pallen wrote:
>
> Hi Guys,
>
> With MultiBranch I can access the name of the Jenkinsfile script path from 
> SCMSourceOwner()  e.g.
>
> public String getScriptPathOrDefault() {
>    SCMSourceOwner owner = getOwner();
>    if (owner instanceof WorkflowMultiBranchProject) {
>       WorkflowMultiBranchProject branchProject = (WorkflowMultiBranchProject) 
> owner;
>       WorkflowBranchProjectFactory branchProjectFactory = 
> (WorkflowBranchProjectFactory) branchProject.getProjectFactory();
>       return branchProjectFactory.getScriptPath();
>    }
>    return "Jenkinsfile";
> }
>
>
> However from a Pipeline (workflow) I'm unable to find any way to access 
> the name of the Jenkinsfile Script.
>
> Ideally I would like to know the value during an SCM.checkout(...) perhaps 
> via Run<?,?> run, probably from WorkflowJob or something.
>
>
> Kind regards,
> Paul
>

-- 
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/3adde92f-3419-4ba4-9bfc-3e736b5b6ba9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to