public class GitToIspwUtils extends Object
Constructor and Description |
---|
GitToIspwUtils() |
Modifier and Type | Method and Description |
---|---|
static hudson.util.ListBoxModel |
buildContainerPrefItems(jenkins.model.Jenkins context,
String containerPref,
hudson.model.Item project) |
static hudson.util.ListBoxModel |
buildStandardCredentialsIdItems(jenkins.model.Jenkins context,
String credentialsId,
hudson.model.Item project) |
static List<CustomGitChangeSetList> |
calculateGitSCMChanges(hudson.model.Run<?,?> run,
hudson.FilePath workspace,
hudson.model.TaskListener listener,
hudson.EnvVars envVars,
IGitToIspwPublish publishStep) |
static boolean |
callCli(hudson.Launcher launcher,
hudson.model.Run<?,?> build,
PrintStream logger,
hudson.EnvVars envVars,
RefMap refMap,
IGitToIspwPublish publishStep)
Calls the IspwCLI and returns whether the execution was successful.
|
static String |
escapeArgument(String args)
Escapes the string argument passed in to conform with CLI standards
|
static List<? extends hudson.scm.ChangeLogSet<? extends hudson.scm.ChangeLogSet.Entry>> |
getChangeSets(hudson.model.Run<?,?> run,
PrintStream logger)
Get the changed log
|
static hudson.FilePath |
getFilePathInVirtualWorkspace(hudson.EnvVars envVars,
String fileName)
Get file path in virtual workspace
|
static hudson.plugins.git.Revision |
getRevision(org.jenkinsci.plugins.workflow.job.WorkflowRun run,
hudson.plugins.git.GitSCM gitSCM)
get the Git revision of the specific build of the multibranch pipeline project
|
static boolean |
isReCalculateChangesRequired(org.jenkinsci.plugins.workflow.job.WorkflowRun run,
hudson.model.TaskListener listener) |
static boolean |
isSameRevision(hudson.plugins.git.Revision firstRevision,
hudson.plugins.git.Revision secondBuildRevision)
Check if the same revision is used between two runs for a multibranch pipeline project
|
static boolean |
isSameRevisionUsedbyLastBuild(org.jenkinsci.plugins.workflow.job.WorkflowRun run,
hudson.plugins.git.GitSCM gitSCM,
PrintStream logger)
check if the same revision is used by requested build and its previous build
|
static Map<String,RefMap> |
parse(String branchMapping) |
static void |
trimEnvironmentVariables(hudson.EnvVars envVars)
Gets the ref, refId, fromHash, and toHash environment variables and trims them to empty.
|
public static hudson.util.ListBoxModel buildStandardCredentialsIdItems(@AncestorInPath jenkins.model.Jenkins context, @QueryParameter String credentialsId, @AncestorInPath hudson.model.Item project)
public static hudson.util.ListBoxModel buildContainerPrefItems(@AncestorInPath jenkins.model.Jenkins context, @QueryParameter String containerPref, @AncestorInPath hudson.model.Item project)
public static void trimEnvironmentVariables(hudson.EnvVars envVars)
envVars
- the EnvVars for Jenkinspublic static hudson.FilePath getFilePathInVirtualWorkspace(hudson.EnvVars envVars, String fileName)
envVars
- the jenkins envfileName
- the file inside virtual workspacepublic static boolean callCli(hudson.Launcher launcher, hudson.model.Run<?,?> build, PrintStream logger, hudson.EnvVars envVars, RefMap refMap, IGitToIspwPublish publishStep) throws InterruptedException, IOException
launcher
- the launcherbuild
- the Jenkins Runlogger
- the loggerenvVars
- the environment variables including ref, refId, fromHash, and toHashrefMap
- the ref mappublishStep
- publish stepInterruptedException
- the exceptionIOException
- the exceptionpublic static List<? extends hudson.scm.ChangeLogSet<? extends hudson.scm.ChangeLogSet.Entry>> getChangeSets(hudson.model.Run<?,?> run, PrintStream logger)
run
- the Jenkins buildlogger
- logging the messagepublic static boolean isSameRevisionUsedbyLastBuild(org.jenkinsci.plugins.workflow.job.WorkflowRun run, hudson.plugins.git.GitSCM gitSCM, PrintStream logger)
run
- the requested buildgitSCM
- the Git SCM used by the buildlogger
- logger for logging the messagepublic static boolean isSameRevision(hudson.plugins.git.Revision firstRevision, hudson.plugins.git.Revision secondBuildRevision)
firstRevision
- first revision to comparesecondBuildRevision
- second revision to comparepublic static hudson.plugins.git.Revision getRevision(org.jenkinsci.plugins.workflow.job.WorkflowRun run, hudson.plugins.git.GitSCM gitSCM)
run
- the current build of the multibranch pipeline projectgitSCM
- the Git SCM of the multibranch pipeline projectpublic static boolean isReCalculateChangesRequired(org.jenkinsci.plugins.workflow.job.WorkflowRun run, hudson.model.TaskListener listener)
run
- the workflow run instancelistener
- the task listenerpublic static List<CustomGitChangeSetList> calculateGitSCMChanges(hudson.model.Run<?,?> run, hudson.FilePath workspace, hudson.model.TaskListener listener, hudson.EnvVars envVars, IGitToIspwPublish publishStep)
Copyright © 2016–2025. All rights reserved.