Package io.jenkins.plugins.checks.github
Class SCMFacade
java.lang.Object
io.jenkins.plugins.checks.github.SCMFacade
Facade to
GitHubSCMSource
and GitSCM
in Jenkins.
Used for finding a supported SCM of a job.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionOptional<com.cloudbees.plugins.credentials.common.StandardUsernameCredentials>
findGitHubAppCredentials
(Job<?, ?> job, String credentialsId) FindGitHubAppCredentials
with thecredentialsId
used by thejob
.Optional<org.jenkinsci.plugins.github_branch_source.GitHubSCMSource>
findGitHubSCMSource
(Job<?, ?> job) FindGitHubSCMSource
(or GitHub repository) used by thejob
.Optional<hudson.plugins.git.GitSCM>
findGitSCM
(Job<?, ?> job) Finds theGitSCM
used by thejob
.Optional<hudson.plugins.git.GitSCM>
findGitSCM
(Run<?, ?> run) Finds theGitSCM
used by therun
.Optional<jenkins.plugins.git.GitSCMSource>
findGitSCMSource
(Job<?, ?> job) FindGitSCMSource
used by thejob
.findHash
(jenkins.scm.api.SCMRevision revision) Find the hash value inrevision
.Optional<jenkins.scm.api.SCMHead>
FindSCMHead
(or branch) used by thejob
.Optional<jenkins.scm.api.SCMRevision>
findRevision
(jenkins.scm.api.SCMSource source, jenkins.scm.api.SCMHead head) Fetch the currentSCMRevision
used by thehead
of thesource
.Optional<jenkins.scm.api.SCMRevision>
findRevision
(org.jenkinsci.plugins.github_branch_source.GitHubSCMSource source, Run<?, ?> run) Find the currentSCMRevision
of thesource
andrun
locally throughSCMRevisionAction
.jenkins.scm.api.SCMSource
findSCMSource
(Job<?, ?> job) FindGitHubSCMSource
(or GitHub repository) used by thejob
.Returns the SCM in a given job.Returns the SCM in a given build.
-
Constructor Details
-
SCMFacade
public SCMFacade()
-
-
Method Details
-
findSCMSource
FindGitHubSCMSource
(or GitHub repository) used by thejob
.- Parameters:
job
- the Jenkins project- Returns:
- the found GitHub SCM source used or empty
-
findGitHubSCMSource
public Optional<org.jenkinsci.plugins.github_branch_source.GitHubSCMSource> findGitHubSCMSource(Job<?, ?> job) FindGitHubSCMSource
(or GitHub repository) used by thejob
.- Parameters:
job
- the Jenkins project- Returns:
- the found GitHub SCM source used or empty
-
findGitSCMSource
FindGitSCMSource
used by thejob
.- Parameters:
job
- the Jenkins project- Returns:
- the found Git SCN source or empty
-
findGitSCM
Finds theGitSCM
used by therun
.- Parameters:
run
- the run to get the SCM from- Returns:
- the found GitSCM or empty
-
findGitSCM
Finds theGitSCM
used by thejob
.- Parameters:
job
- the job to get the SCM from- Returns:
- the found GitSCM or empty
-
findGitHubAppCredentials
public Optional<com.cloudbees.plugins.credentials.common.StandardUsernameCredentials> findGitHubAppCredentials(Job<?, ?> job, String credentialsId) FindGitHubAppCredentials
with thecredentialsId
used by thejob
.- Parameters:
job
- the Jenkins projectcredentialsId
- the id of the target credentials- Returns:
- the found GitHub App credentials or empty
-
findHead
FindSCMHead
(or branch) used by thejob
.- Parameters:
job
- the Jenkins project- Returns:
- the found SCM head or empty
-
findRevision
public Optional<jenkins.scm.api.SCMRevision> findRevision(jenkins.scm.api.SCMSource source, jenkins.scm.api.SCMHead head) Fetch the currentSCMRevision
used by thehead
of thesource
.- Parameters:
source
- the GitHub repositoryhead
- the branch- Returns:
- the fetched revision or empty
-
findRevision
public Optional<jenkins.scm.api.SCMRevision> findRevision(org.jenkinsci.plugins.github_branch_source.GitHubSCMSource source, Run<?, ?> run) Find the currentSCMRevision
of thesource
andrun
locally throughSCMRevisionAction
.- Parameters:
source
- the GitHub repositoryrun
- the Jenkins run- Returns:
- the found revision or empty
-
findHash
Find the hash value inrevision
.- Parameters:
revision
- the revision for a build- Returns:
- the found hash or empty
-
getScm
Returns the SCM in a given build. If no SCM can be determined, then aNullSCM
instance will be returned.- Parameters:
run
- the build to get the SCM from- Returns:
- the SCM
-
getScm
Returns the SCM in a given job. If no SCM can be determined, then aNullSCM
instance will be returned.- Parameters:
job
- the job to get the SCM from- Returns:
- the SCM
-