Class BuildData

java.lang.Object
hudson.plugins.git.util.BuildData
All Implemented Interfaces:
Action, ModelObject, Serializable, Cloneable

@ExportedBean(defaultVisibility=999) public class BuildData extends Object implements Action, Serializable, Cloneable
Captures the Git related information for a build.

This object is added to Actionable.getActions(). This persists the Git related information of that build.

See Also:
  • Field Details

    • buildsByBranchName

      public Map<String,Build> buildsByBranchName
      Map of branch name -> build (Branch name to last built SHA1).

      This map contains all the branches we've built in the past (including the build that this BuildData is attached to)

    • lastBuild

      public Build lastBuild
      The last build that we did (among the values in buildsByBranchName.)
    • scmName

      public String scmName
      The name of the SCM as given by the user.
    • remoteUrls

      public Set<String> remoteUrls
      The URLs that have been referenced.
  • Constructor Details

  • Method Details

    • getDisplayName

      public String getDisplayName()
      Returns the build data display name, optionally with SCM name. This string needs to be relatively short because it is displayed in a column with other short links. If it is lengthened, it causes the other data on the page to shift right. The page is then difficult to read.
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
      Returns:
      build data display name
    • getIconFileName

      public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
    • getUrlName

      public String getUrlName()
      Specified by:
      getUrlName in interface Action
    • setIndex

      public void setIndex(Integer index)
      Sets an identifier used to disambiguate multiple BuildData actions attached to a Run
      Parameters:
      index - the index, indexes less than or equal to 1 will be discarded.
    • getIndex

      @CheckForNull public Integer getIndex()
      Gets the identifier used to disambiguate multiple BuildData actions attached to a Run.
      Returns:
      the index.
    • getOwningRun

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @CheckForNull public Run<?,?> getOwningRun()
    • readResolve

      public Object readResolve()
    • hasBeenBuilt

      public boolean hasBeenBuilt(org.eclipse.jgit.lib.ObjectId sha1)
      Return true if the history shows this SHA1 has been built. False otherwise.
      Parameters:
      sha1 - SHA1 hash of commit
      Returns:
      true if sha1 has been built
    • getLastBuild

      public Build getLastBuild(org.eclipse.jgit.lib.ObjectId sha1)
    • saveBuild

      public void saveBuild(Build build)
    • getLastBuildOfBranch

      public Build getLastBuildOfBranch(String branch)
    • getLastBuiltRevision

      @Exported @CheckForNull public hudson.plugins.git.Revision getLastBuiltRevision()
      Gets revision of the previous build.
      Returns:
      revision of the last build. May be null will be returned if nothing has been checked out (e.g. due to wrong repository or branch)
    • getBuildsByBranchName

      @Exported public Map<String,Build> getBuildsByBranchName()
    • setScmName

      public void setScmName(String scmName)
    • getScmName

      @Exported public String getScmName()
    • addRemoteUrl

      public void addRemoteUrl(String remoteUrl)
    • getRemoteUrls

      @Exported public Set<String> getRemoteUrls()
    • hasBeenReferenced

      public boolean hasBeenReferenced(String remoteUrl)
    • clone

      public BuildData clone()
      Overrides:
      clone in class Object
    • getApi

      public Api getApi()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • similarTo

      public boolean similarTo(BuildData that)
      Like equals(Object) but doesn't check the URL as strictly, since those can vary while still representing the same remote repository.
      Parameters:
      that - the BuildData to compare with.
      Returns:
      true if the supplied BuildData is similar to this BuildData.
      Since:
      3.2.0
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object