public final class GitUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isCommitInfoAlreadyCreated(Run<?,?> run,
String gitCommit)
Check if the GitCommitAction has been already created and populated.
|
static boolean |
isRepositoryInfoAlreadyCreated(Run<?,?> run,
String gitRepositoryUrl)
Check if the GitRepositoryAction has been already created and populated.
|
static boolean |
isUserSuppliedGit(Map<String,String> envVars)
Check if the env vars map contains any environment variable with Git information supplied by the user manually.
|
static boolean |
isValidCommit(String gitCommit)
Check if the git commit is a valid commit.
|
static boolean |
isValidRepositoryURL(String gitRepositoryURL)
Check if the git repository URL is a valid repository
|
static org.jenkinsci.plugins.gitclient.GitClient |
newGitClient(TaskListener listener,
EnvVars envVars,
FilePath workspace)
Creates a new instance of a
GitClient . |
static String |
resolveGitBranch(Map<String,String> envVars)
Resolve the value for the git branch based
1: Check user supplied env var
2: Check Jenkins env var
3: Check BuildData already calculated
|
static String |
resolveGitCommit(Map<String,String> envVars)
Resolve the value for the git commit sha based
1: Check user supplied env var
2: Check Jenkins env var
3: Check BuildData already calculated
|
static String |
resolveGitRepositoryUrl(Map<String,String> envVars)
Resolve the value for the git repository url based
1: Check user supplied env var
2: Check Jenkins env var
3: Check BuildData already calculated
|
static String |
resolveGitTag(Map<String,String> envVars)
Resolve the value for the git tag based
1: Check user supplied env var
3: Check BuildData already calculated
|
static RepositoryInfo |
searchRepositoryInfo(org.jenkinsci.plugins.gitclient.GitClient gitClient)
Return the
RepositoryInfo for a certain Git repository. |
static org.eclipse.jgit.revwalk.RevCommit |
searchRevCommit(org.jenkinsci.plugins.gitclient.GitClient gitClient,
String gitCommit)
Return the RevCommit for a certain commit based on the information
stored in a certain workspace of a certain node.
|
public static org.eclipse.jgit.revwalk.RevCommit searchRevCommit(@Nullable org.jenkinsci.plugins.gitclient.GitClient gitClient, String gitCommit)
gitCommit
- the Git commit SHA to search info.gitClient
- the Git client used.public static RepositoryInfo searchRepositoryInfo(@Nullable org.jenkinsci.plugins.gitclient.GitClient gitClient)
RepositoryInfo
for a certain Git repository.gitClient
- The Git client to use to obtain the repository information@Nullable public static org.jenkinsci.plugins.gitclient.GitClient newGitClient(TaskListener listener, EnvVars envVars, FilePath workspace)
GitClient
.listener
- the task listenerenvVars
- the env vars availableworkspace
- the workspace to use to build the Git clientpublic static boolean isValidCommit(String gitCommit)
gitCommit
- the git commit to evaluatepublic static boolean isValidRepositoryURL(String gitRepositoryURL)
gitRepositoryURL
- the current git repositorypublic static boolean isRepositoryInfoAlreadyCreated(Run<?,?> run, String gitRepositoryUrl)
run
- the current rungitRepositoryUrl
- the current git respositorypublic static boolean isCommitInfoAlreadyCreated(Run<?,?> run, String gitCommit)
run
- the current rungitCommit
- the git commit to check forpublic static String resolveGitBranch(Map<String,String> envVars)
envVars
- the user supplied env varspublic static String resolveGitCommit(Map<String,String> envVars)
envVars
- the user supplied env varspublic static String resolveGitRepositoryUrl(Map<String,String> envVars)
envVars
- the user supplied env varspublic static String resolveGitTag(Map<String,String> envVars)
envVars
- the user supplied environment variablesCopyright © 2016–2024. All rights reserved.