public abstract class Plugins extends Object
Modifier and Type | Field and Description |
---|---|
protected Node |
node
Node block from which the properties are to be read and converted.
|
protected Transformer |
transformer
Transformer instance whose variables need to be read and written to.
|
Constructor and Description |
---|
Plugins()
Default constructor.
|
Plugins(Transformer transformer,
Node node)
Parameterized constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
appendBuildSteps(String string)
Helper method to append string to buildSteps in transformer.
|
protected void |
appendPublishSteps(String string)
Helper method to append string to publishSteps in transformer.
|
protected Element |
getElementByTag(Node node,
String tag)
Helper method to extract Element from given node by tag name.
|
protected Element |
getElementByTag(String tag)
Helper method to extract Element by tag name from node initialised by constructor.
|
static Class |
getPluginClass(String nodeName)
Returns Class that matches nodeName.
|
void |
pushJenkinsfile(File workSpace,
String script,
String url,
String branchName,
String commitMessage,
org.eclipse.jgit.transport.CredentialsProvider credentialsProvider)
Method to be overridden by subclass when pushing Jenkinsfile.
|
void |
transformBuild()
Method to be overridden by subclass when transforming build steps.
|
void |
transformBuildWrapper()
Method to be overridden by subclass when transforming build-wrappers.
|
void |
transformPublisher()
Method to be overridden by subclass when transforming post-build actions.
|
void |
transformSCM()
Method to be overridden by subclass when transforming SCM.
|
Element |
writeCPSFlow(Document dest,
String scmURL,
String branchName,
String scmCredentialsId)
Write CPS Flow XML structure for SCM type defined.
|
protected Transformer transformer
protected Node node
public Plugins(Transformer transformer, Node node)
transformer
- Transformer instance whose variables need to be read and written to.node
- Node block from which the properties are to be read and converted.public Plugins()
public void transformBuild()
public void transformPublisher()
public void transformBuildWrapper()
public void transformSCM()
public void pushJenkinsfile(File workSpace, String script, String url, String branchName, String commitMessage, org.eclipse.jgit.transport.CredentialsProvider credentialsProvider)
workSpace
- The temporary workspace where the repo will be cloned.script
- Groovy script to be written in Jenkinsfile.url
- URL of SCM repository where Jenkinsfile is to be pushed.branchName
- Branch of SCM where Jenkinsfile is to be pushed.commitMessage
- Commit message to be included in commit when pushing Jenkinsfile.credentialsProvider
- Credentials to use for clone and push operations.public Element writeCPSFlow(Document dest, String scmURL, String branchName, String scmCredentialsId)
dest
- Document object in which the new XML elements are to be defined.scmURL
- URL of SCM where new pipeline job will point for Jenkinsfile.branchName
- Branch name of SCM where new pipeline job will point for Jenkinsfile.scmCredentialsId
- Credentials id to use to checkout Jenkinsfile by new pipeline job.protected final Element getElementByTag(String tag)
tag
- Tag name to find in node.protected final Element getElementByTag(Node node, String tag)
node
- Node from which the Element needs to be extracted.tag
- Tag name to find in node.protected final void appendBuildSteps(String string)
string
- String to be appended to build steps.protected final void appendPublishSteps(String string)
string
- String to be appended to publish steps.public static final Class getPluginClass(String nodeName)
nodeName
- The node name whose plugin class needs to be found.Copyright © 2016–2017. All rights reserved.