Fix panic against with pipeline-multibranch-defaults-plugin

Signed-off-by: rick <rick@jenkins-zh.cn>
This commit is contained in:
rick
2020-11-25 15:38:07 +08:00
parent 75e0cf27e4
commit 00e8b0e5ef

View File

@@ -902,7 +902,12 @@ func parseMultiBranchPipelineConfigXml(config string) (*devopsv1alpha3.MultiBran
}
}
pipeline.ScriptPath = project.SelectElement("factory").SelectElement("scriptPath").Text()
scriptPathEle := project.SelectElement("factory").SelectElement("scriptPath")
if scriptPathEle != nil {
// There's no script path if current pipeline using a default Jenkinsfile
// see also https://github.com/jenkinsci/pipeline-multibranch-defaults-plugin
pipeline.ScriptPath = scriptPathEle.Text()
}
return pipeline, nil
}