Class RepoScm

java.lang.Object
hudson.scm.SCM
hudson.plugins.repo.RepoScm
All Implemented Interfaces:
ExtensionPoint, Describable<SCM>, Serializable

@ExportedBean public class RepoScm extends SCM implements 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:
  • 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.xml
      destinationDir - 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

      @DataBoundConstructor public RepoScm(String manifestRepositoryUrl)
      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

      @Exported public String getManifestRepositoryUrl()
      Returns the manifest repository URL.
    • getManifestBranch

      @Exported public String getManifestBranch()
      Returns the manifest branch name. By default, this is null and repo defaults to "master".
    • getManifestFile

      @Exported public String getManifestFile()
      Returns the initial manifest file name. By default, this is null and repo defaults to "default.xml"
    • getManifestGroup

      @Exported public String getManifestGroup()
      Returns the group of projects to fetch. By default, this is null and repo will fetch the default group.
    • getManifestPlatform

      @CheckForNull public String getManifestPlatform()
      Returns the platform of projects to fetch. By default, this is null and repo will automatically fetch the appropriate platform.
    • getRepoUrl

      @Exported public String getRepoUrl()
      Returns the repo url. by default, this is null and repo is fetched from aosp
    • getRepoBranch

      @Exported public String getRepoBranch()
      Returns the repo branch. by default, this is null and repo is used from the default branch
    • getMirrorDir

      @Exported public String 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

      @Exported public String 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

      @Exported public String getDestinationDir()
      Returns the destination directory. By default, this is null and the source is synced to the root of the workspace.
    • getIgnoreProjects

      @Exported public String 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

      @Exported public Map<String,String> getExtraEnvVars()
      Returns the value of extraEnvVars.
    • isNoSync

      public boolean isNoSync()
      Returns the value of noSync.
    • setManifestBranch

      @DataBoundSetter public void setManifestBranch(@CheckForNull String manifestBranch)
      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

      @DataBoundSetter public void setManifestFile(@CheckForNull String manifestFile)
      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

      @DataBoundSetter public void setManifestGroup(@CheckForNull String manifestGroup)
      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

      @DataBoundSetter public void setManifestPlatform(@CheckForNull String manifestPlatform)
      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

      @DataBoundSetter public void setMirrorDir(@CheckForNull String mirrorDir)
      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

      @DataBoundSetter public void setLocalManifest(@CheckForNull String localManifest)
      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

      @DataBoundSetter public void setDestinationDir(@CheckForNull String destinationDir)
      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

      @DataBoundSetter public void setRepoUrl(@CheckForNull String repoUrl)
      Set the repo url.
      Parameters:
      repoUrl - If not null then use this url as repo base, instead of the default
    • setRepoBranch

      @DataBoundSetter public void setRepoBranch(@CheckForNull String repoBranch)
      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

      @DataBoundSetter public final void setIgnoreProjects(String ignoreProjects)
      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

      @DataBoundSetter public void setExtraEnvVars(@CheckForNull Map<String,String> extraEnvVars)
      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:
      calcRevisionsFromBuild in class SCM
      Throws:
      IOException
      InterruptedException
    • compareRemoteRevisionWith

      public PollingResult compareRemoteRevisionWith(@Nonnull Job<?,?> job, @Nullable Launcher launcher, @Nullable FilePath workspace, @Nonnull TaskListener listener, @Nonnull SCMRevisionState baseline) throws IOException, InterruptedException
      Overrides:
      compareRemoteRevisionWith in class SCM
      Throws:
      IOException
      InterruptedException
    • 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:
      checkout in class SCM
      Throws:
      IOException
      InterruptedException
    • buildEnvironment

      public void buildEnvironment(@Nonnull Run<?,?> build, @Nonnull Map<String,String> env)
      Adds environmental variables for the builds to the given map.
      Overrides:
      buildEnvironment in class SCM
    • createChangeLogParser

      public ChangeLogParser createChangeLogParser()
      Specified by:
      createChangeLogParser in class SCM
    • getDescriptor

      public RepoScm.DescriptorImpl getDescriptor()
      Specified by:
      getDescriptor in interface Describable<SCM>
      Overrides:
      getDescriptor in class SCM
    • getKey

      @Nonnull public String getKey()
      Overrides:
      getKey in class SCM