public class SCMUtil
extends java.lang.Object
Constructor and Description |
---|
SCMUtil() |
Modifier and Type | Method and Description |
---|---|
private void |
cleanWorkSpace(java.io.File workSpace)
Deletes temporary workspace if it exists.
|
private java.util.List<com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials> |
fetchAllCredentials()
List of all credentials in Jenkins against which credential matching will be performed.
|
private com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials |
getCredentials(java.lang.String credentialId)
Get Standard username and password credentials from credentials ID.
|
void |
pushJenkinsfile(java.lang.String script,
java.lang.String url,
java.lang.String branchName,
java.lang.String credentialsId,
java.lang.String commitMessage,
java.lang.String scmType)
Public method to create Jenkinsfile from script and push to given SCM repo.
|
static void |
writeJenkinsfile(java.io.File workSpace,
java.lang.String script)
Writes script to Jenkinsfile and adds to workspace.
|
public void pushJenkinsfile(java.lang.String script, java.lang.String url, java.lang.String branchName, java.lang.String credentialsId, java.lang.String commitMessage, java.lang.String scmType)
script
- Groovy script to be written in Jenkinsfileurl
- URL of SCM repository where Jenkinsfile is to be pushed.branchName
- Branch of SCM where Jenkinsfile is to be pushed.credentialsId
- Credentials to checkout, commit and push to SCM.commitMessage
- Commit message to be included in commit when pushing Jenkinsfile.scmType
- Type of SCM.public static void writeJenkinsfile(java.io.File workSpace, java.lang.String script)
workSpace
- Workspace in which the Jenkinsfile will be added.script
- Groovy script to be written in Jenkinsfile.private void cleanWorkSpace(java.io.File workSpace)
private com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials getCredentials(java.lang.String credentialId)
credentialId
- Credentials ID of repo.private java.util.List<com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials> fetchAllCredentials()