Class BitBucketPPRPipelineLibrarySCMAction

java.lang.Object
hudson.model.InvisibleAction
io.jenkins.plugins.bitbucketpushandpullrequest.action.BitBucketPPRPipelineLibrarySCMAction
All Implemented Interfaces:
Action, ModelObject

public class BitBucketPPRPipelineLibrarySCMAction extends InvisibleAction
Records, on a Run, the Git remotes seen by the build, split by the role they played:
  • libraryRemotes — checkouts done under a Pipeline shared-library workspace (<job-workspace>@libs/<dir>, recognised by BitBucketPPRSCMCheckoutListener).
  • nonLibraryRemotes — every other Git checkout the build performed (the job's main source SCM, explicit checkout steps, etc.).

The probe consults classify(GitSCM) to decide whether to skip a webhook match. The result is tri-state (BitBucketPPRPipelineLibrarySCMAction.Classification.ONLY_LIBRARY, BitBucketPPRPipelineLibrarySCMAction.Classification.NON_LIBRARY_OR_MIXED, BitBucketPPRPipelineLibrarySCMAction.Classification.UNKNOWN) so the probe can distinguish "this build proves the SCM is exclusively a library" from "this build has no opinion" — the latter is what enables the scan-window logic to fall back to an older build without having a newer build's NON_LIBRARY verdict silently shadowed by an older ONLY_LIBRARY verdict.

Stored URIs are sanitized to host + path: that is the only subset GitStatus.looselyMatches(URIish, URIish) actually consults, and we deliberately do not duplicate scheme/user/password into a separate action on the Run.

Thread-safety: writes happen from build executor threads (parallel-stage library/checkout steps fire concurrently) while reads happen from the webhook HTTP dispatch thread; all methods that touch the internal lists are synchronized on the action instance.

  • Constructor Details

    • BitBucketPPRPipelineLibrarySCMAction

      public BitBucketPPRPipelineLibrarySCMAction()
  • Method Details

    • recordLibrary

      public void recordLibrary(Iterable<org.eclipse.jgit.transport.URIish> uris)
      Records the given URIs as Pipeline shared-library checkouts.
    • recordNonLibrary

      public void recordNonLibrary(Iterable<org.eclipse.jgit.transport.URIish> uris)
      Records the given URIs as non-library (explicit) checkouts.
    • classify

      public BitBucketPPRPipelineLibrarySCMAction.Classification classify(hudson.plugins.git.GitSCM scm)
      Returns this build's verdict on scm:

      This three-valued return is what allows the probe to honour the most-recent build's verdict instead of OR-ing across the window: a more recent build that returns NON_LIBRARY_OR_MIXED must shadow an older build that returned ONLY_LIBRARY.

      Scoping: the multi-remote shortcut returns NON_LIBRARY_OR_MIXED unconditionally, including when none of the queried URIs is actually in either recorded list. That is intentional but only meaningful in the probe's call chain — classify is consulted AFTER BitBucketPPRJobProbe.matchGitScm has already established that scm's URL overlaps the webhook payload, so an irrelevant multi-remote SCM never reaches this method in production. The shortcut is what lets the probe's scan stop at the most recent "this is a real source" verdict instead of regressing to an older library-only entry for one of the multi-remote URIs.