Package hudson.plugins.repo
Class RepoScm
java.lang.Object
hudson.scm.SCM
hudson.plugins.repo.RepoScm
- All Implemented Interfaces:
ExtensionPoint,Describable<SCM>,Serializable
The main entrypoint of the plugin. This class contains code to store user
configuration and to check out the code using a repo binary.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA DescriptorImpl contains variables used server-wide.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG -
Constructor Summary
ConstructorsConstructorDescriptionThe constructor takes in user parameters and sets them.RepoScm(String manifestRepositoryUrl, String manifestBranch, String manifestFile, String manifestGroup, String mirrorDir, int jobs, int depth, String localManifest, String destinationDir, String repoUrl, boolean currentBranch, boolean resetFirst, boolean quiet, boolean trace, boolean showAllChanges) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildEnvironment(Run<?, ?> build, Map<String, String> env) Adds environmental variables for the builds to the given map.calcRevisionsFromBuild(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) voidcheckout(Run<?, ?> build, Launcher launcher, FilePath workspace, TaskListener listener, File changelogFile, SCMRevisionState baseline) compareRemoteRevisionWith(Job<?, ?> job, Launcher launcher, FilePath workspace, TaskListener listener, SCMRevisionState baseline) intgetDepth()Returns the depth used for sync.Returns the destination directory.Returns the value of extraEnvVars.returns list of ignore projects.intgetJobs()Returns the number of jobs used for sync.getKey()Returns the contents of the local_manifests/local.xml.Returns the manifest branch name.Returns the initial manifest file name.Returns the group of projects to fetch.Returns the platform of projects to fetch.Returns the manifest repository URL.Returns the name of the mirror directory.Returns the repo branch.Returns the repo url.booleanReturns the value of cleanFirst.booleanReturns the value of currentBranch.booleanReturns the value of fetchSubmodules.booleanReturns the value of forceSync.booleanisGitLfs()Returns the value of gitLfs.booleanReturns the value of manifestSubmodules.booleanReturns the value of noCloneBundle.booleanisNoSync()Returns the value of noSync.booleanisNoTags()Returns the value of noTags.booleanisQuiet()Returns the value of quiet.booleanReturns the value of resetFirst.booleanReturns the value of showAllChanges.booleanisTrace()Returns the value of trace.booleanReturns the value of isWorktree.voidsetCleanFirst(boolean cleanFirst) Set cleanFirst.voidsetCurrentBranch(boolean currentBranch) Set currentBranch.voidsetDepth(int depth) Set the depth used for sync.voidsetDestinationDir(String destinationDir) Set the destination directory.voidsetExtraEnvVars(Map<String, String> extraEnvVars) Set additional environment variables to use.voidsetFetchSubmodules(boolean fetchSubmodules) Set fetchSubmodules.voidsetForceSync(boolean forceSync) Enables --force-sync option on repo sync command.voidsetGitLfs(boolean gitLfs) Set gitLfs.final voidsetIgnoreProjects(String ignoreProjects) Sets list of projects which changes will be ignored when calculating whether job needs to be rebuild.voidsetJobs(int jobs) Set the number of jobs used for sync.voidsetLocalManifest(String localManifest) Set the content of the local manifest.voidsetManifestBranch(String manifestBranch) Set the manifest branch name.voidsetManifestFile(String manifestFile) Set the initial manifest file name.voidsetManifestGroup(String manifestGroup) Set the group of projects to fetch.voidsetManifestPlatform(String manifestPlatform) Set the platform of projects to fetch.voidsetManifestSubmodules(boolean manifestSubmodules) Set manifestSubmodules.voidsetMirrorDir(String mirrorDir) Set the name of the mirror directory.voidsetNoCloneBundle(boolean noCloneBundle) Set noCloneBundle.voidsetNoSync(boolean noSync) disables -sync option on repo command.final voidsetNoTags(boolean noTags) Set noTags.voidsetQuiet(boolean quiet) Set quiet.voidsetRepoBranch(String repoBranch) Set the repo branch.voidsetRepoUrl(String repoUrl) Set the repo url.voidsetResetFirst(boolean resetFirst) Set resetFirst.voidsetShowAllChanges(boolean showAllChanges) Set showAllChanges.voidsetTrace(boolean trace) Set trace.voidsetWorktree(boolean worktree) Set worktree.Methods inherited from class hudson.scm.SCM
_calcRevisionsFromBuild, _for, _for, all, buildEnvVars, calcRevisionsFromBuild, checkout, compareRemoteRevisionWith, createEmptyChangeLog, createEmptyChangeLog, getApi, getBrowser, getEffectiveBrowser, getModuleRoot, getModuleRoot, getModuleRoots, getModuleRoots, getType, guessBrowser, nullify, poll, pollChanges, postCheckout, postCheckout, processWorkspaceBeforeDeletion, processWorkspaceBeforeDeletion, requiresWorkspaceForPolling, supportsPolling
-
Constructor Details
-
RepoScm
@Deprecated public RepoScm(String manifestRepositoryUrl, String manifestBranch, String manifestFile, String manifestGroup, String mirrorDir, int jobs, int depth, String localManifest, String destinationDir, String repoUrl, boolean currentBranch, boolean resetFirst, boolean quiet, boolean trace, boolean showAllChanges) Deprecated.The constructor takes in user parameters and sets them. Each job using the RepoSCM will call this constructor.- Parameters:
manifestRepositoryUrl- The URL for the manifest repository.manifestBranch- The branch of the manifest repository. Typically this is null or the empty string, which will cause repo to default to "master".manifestFile- The file to use as the repository manifest. Typically this is null which will cause repo to use the default of "default.xml"manifestGroup- The group name for the projects that need to be fetched. Typically, this is null and all projects tagged 'default' will be fetched.mirrorDir- The path of the mirror directory to reference when initializing repo.jobs- The number of concurrent jobs to use for the sync command. If this is 0 or negative the jobs parameter is not specified.depth- This is the depth to use when syncing. By default this is 0 and the full history is synced.localManifest- May be null, a string containing XML, or an URL. If XML, this string is written to .repo/local_manifests/local.xml If an URL, the URL is fetched and the content is written to .repo/local_manifests/local.xmldestinationDir- If not null then the source is synced to the destinationDir subdirectory of the workspace.repoUrl- If not null then use this url as repo base, instead of the default.currentBranch- If this value is true, add the "-c" option when executing "repo sync".resetFirst- If this value is true, do "repo forall -c 'git reset --hard'" before syncing.quiet- If this value is true, add the "-q" option when executing "repo sync".trace- If this value is true, add the "--trace" option when executing "repo init" and "repo sync".showAllChanges- If this value is true, add the "--first-parent" option to "git log" when determining changesets.
-
RepoScm
The constructor takes in user parameters and sets them. Each job using the RepoSCM will call this constructor.- Parameters:
manifestRepositoryUrl- The URL for the manifest repository.
-
-
Method Details
-
getManifestRepositoryUrl
Returns the manifest repository URL. -
getManifestBranch
Returns the manifest branch name. By default, this is null and repo defaults to "master". -
getManifestFile
Returns the initial manifest file name. By default, this is null and repo defaults to "default.xml" -
getManifestGroup
Returns the group of projects to fetch. By default, this is null and repo will fetch the default group. -
getManifestPlatform
Returns the platform of projects to fetch. By default, this is null and repo will automatically fetch the appropriate platform. -
getRepoUrl
Returns the repo url. by default, this is null and repo is fetched from aosp -
getRepoBranch
Returns the repo branch. by default, this is null and repo is used from the default branch -
getMirrorDir
Returns the name of the mirror directory. By default, this is null and repo does not use a mirror. -
getJobs
@Exported public int getJobs()Returns the number of jobs used for sync. By default, this is null and repo does not use concurrent jobs. -
getDepth
@Exported public int getDepth()Returns the depth used for sync. By default, this is null and repo will sync the entire history. -
getLocalManifest
Returns the contents of the local_manifests/local.xml. By default, this is null and a local_manifests/local.xml is neither created nor modified. -
getDestinationDir
Returns the destination directory. By default, this is null and the source is synced to the root of the workspace. -
getIgnoreProjects
returns list of ignore projects. -
isCurrentBranch
@Exported public boolean isCurrentBranch()Returns the value of currentBranch. -
isResetFirst
@Exported public boolean isResetFirst()Returns the value of resetFirst. -
isCleanFirst
@Exported public boolean isCleanFirst()Returns the value of cleanFirst. -
isShowAllChanges
@Exported public boolean isShowAllChanges()Returns the value of showAllChanges. -
isQuiet
@Exported public boolean isQuiet()Returns the value of quiet. -
isForceSync
@Exported public boolean isForceSync()Returns the value of forceSync. -
isTrace
@Exported public boolean isTrace()Returns the value of trace. -
isNoTags
@Exported public boolean isNoTags()Returns the value of noTags. -
isNoCloneBundle
@Exported public boolean isNoCloneBundle()Returns the value of noCloneBundle. -
isWorktree
@Exported public boolean isWorktree()Returns the value of isWorktree. -
isManifestSubmodules
@Exported public boolean isManifestSubmodules()Returns the value of manifestSubmodules. -
isFetchSubmodules
public boolean isFetchSubmodules()Returns the value of fetchSubmodules. -
isGitLfs
public boolean isGitLfs()Returns the value of gitLfs. -
getExtraEnvVars
Returns the value of extraEnvVars. -
isNoSync
public boolean isNoSync()Returns the value of noSync. -
setManifestBranch
Set the manifest branch name.- Parameters:
manifestBranch- The branch of the manifest repository. Typically this is null or the empty string, which will cause repo to default to "master".
-
setManifestFile
Set the initial manifest file name.- Parameters:
manifestFile- The file to use as the repository manifest. Typically this is null which will cause repo to use the default of "default.xml"
-
setManifestGroup
Set the group of projects to fetch.- Parameters:
manifestGroup- The group name for the projects that need to be fetched. Typically, this is null and all projects tagged 'default' will be fetched.
-
setManifestPlatform
Set the platform of projects to fetch.- Parameters:
manifestPlatform- The platform for the projects that need to be fetched. Typically, this is null and only projects for the current platform will be fetched.
-
setMirrorDir
Set the name of the mirror directory.- Parameters:
mirrorDir- The path of the mirror directory to reference when initializing repo.
-
setJobs
@DataBoundSetter public void setJobs(int jobs) Set the number of jobs used for sync.- Parameters:
jobs- The number of concurrent jobs to use for the sync command. If this is 0 or negative the jobs parameter is not specified.
-
setDepth
@DataBoundSetter public void setDepth(int depth) Set the depth used for sync.- Parameters:
depth- This is the depth to use when syncing. By default this is 0 and the full history is synced.
-
setLocalManifest
Set the content of the local manifest.- Parameters:
localManifest- May be null, a string containing XML, or an URL. If XML, this string is written to .repo/local_manifests/local.xml If an URL, the URL is fetched and the content is written to .repo/local_manifests/local.xml
-
setDestinationDir
Set the destination directory.- Parameters:
destinationDir- If not null then the source is synced to the destinationDir subdirectory of the workspace.
-
setCurrentBranch
@DataBoundSetter public void setCurrentBranch(boolean currentBranch) Set currentBranch.- Parameters:
currentBranch- If this value is true, add the "-c" option when executing "repo sync".
-
setResetFirst
@DataBoundSetter public void setResetFirst(boolean resetFirst) Set resetFirst.- Parameters:
resetFirst- If this value is true, do "repo forall -c 'git reset --hard'" before syncing.
-
setCleanFirst
@DataBoundSetter public void setCleanFirst(boolean cleanFirst) Set cleanFirst.- Parameters:
cleanFirst- If this value is true, do "repo forall -c 'git clean -fdx'" before syncing.
-
setQuiet
@DataBoundSetter public void setQuiet(boolean quiet) Set quiet.- Parameters:
quiet- * If this value is true, add the "-q" option when executing "repo sync".
-
setTrace
@DataBoundSetter public void setTrace(boolean trace) Set trace.- Parameters:
trace- If this value is true, add the "--trace" option when executing "repo init" and "repo sync".
-
setShowAllChanges
@DataBoundSetter public void setShowAllChanges(boolean showAllChanges) Set showAllChanges.- Parameters:
showAllChanges- If this value is true, add the "--first-parent" option to "git log" when determining changesets.
-
setNoCloneBundle
@DataBoundSetter public void setNoCloneBundle(boolean noCloneBundle) Set noCloneBundle.- Parameters:
noCloneBundle- If this value is true, add the "--no-clone-bundle" option when running the "repo init" and "repo sync" commands.
-
setWorktree
@DataBoundSetter public void setWorktree(boolean worktree) Set worktree.- Parameters:
worktree- If this value is true, add the "--worktree" option when running the "repo init" command.
-
setRepoUrl
Set the repo url.- Parameters:
repoUrl- If not null then use this url as repo base, instead of the default
-
setRepoBranch
Set the repo branch.- Parameters:
repoBranch- If not null then use this as branch for repo itself instead of the default.
-
setForceSync
@DataBoundSetter public void setForceSync(boolean forceSync) Enables --force-sync option on repo sync command.- Parameters:
forceSync- If this value is true, add the "--force-sync" option when executing "repo sync".
-
setNoSync
@DataBoundSetter public void setNoSync(boolean noSync) disables -sync option on repo command.- Parameters:
noSync- If this value is true, do not add the "-sync" option when executing "repo ".
-
setNoTags
@DataBoundSetter public final void setNoTags(boolean noTags) Set noTags.- Parameters:
noTags- If this value is true, add the "--no-tags" option when executing "repo sync".
-
setManifestSubmodules
@DataBoundSetter public void setManifestSubmodules(boolean manifestSubmodules) Set manifestSubmodules.- Parameters:
manifestSubmodules- If this value is true, add the "--submodules" option when executing "repo init".
-
setFetchSubmodules
@DataBoundSetter public void setFetchSubmodules(boolean fetchSubmodules) Set fetchSubmodules.- Parameters:
fetchSubmodules- If this value is true, add the "--fetch-submodules" option when executing "repo sync".
-
setGitLfs
@DataBoundSetter public void setGitLfs(boolean gitLfs) Set gitLfs.- Parameters:
gitLfs- If this value is true, add the "--git-lfs" option when executing "repo init".
-
setIgnoreProjects
Sets list of projects which changes will be ignored when calculating whether job needs to be rebuild. This field corresponds to serverpath i.e. "name" section of the manifest.- Parameters:
ignoreProjects- String representing project names separated by " ".
-
setExtraEnvVars
Set additional environment variables to use. These variables will override any parameter from the project or variable set in environment already.- Parameters:
extraEnvVars- Additional environment variables to set.
-
calcRevisionsFromBuild
public SCMRevisionState calcRevisionsFromBuild(@Nonnull Run<?, ?> build, @Nullable FilePath workspace, @Nullable Launcher launcher, @Nonnull TaskListener listener) throws IOException, InterruptedException- Overrides:
calcRevisionsFromBuildin classSCM- Throws:
IOExceptionInterruptedException
-
compareRemoteRevisionWith
public PollingResult compareRemoteRevisionWith(@Nonnull Job<?, ?> job, @Nullable Launcher launcher, @Nullable FilePath workspace, @Nonnull TaskListener listener, @Nonnull SCMRevisionState baseline) throws IOException, InterruptedException- Overrides:
compareRemoteRevisionWithin classSCM- Throws:
IOExceptionInterruptedException
-
checkout
public void checkout(@Nonnull Run<?, ?> build, @Nonnull Launcher launcher, @Nonnull FilePath workspace, @Nonnull TaskListener listener, @CheckForNull File changelogFile, @CheckForNull SCMRevisionState baseline) throws IOException, InterruptedException- Overrides:
checkoutin classSCM- Throws:
IOExceptionInterruptedException
-
buildEnvironment
Adds environmental variables for the builds to the given map.- Overrides:
buildEnvironmentin classSCM
-
createChangeLogParser
- Specified by:
createChangeLogParserin classSCM
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<SCM>- Overrides:
getDescriptorin classSCM
-
getKey
-