Interface PipelineMavenPluginDao

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
AbstractPipelineMavenPluginDaoDecorator, CustomTypePipelineMavenPluginDaoDecorator, MonitoringPipelineMavenPluginDaoDecorator, PipelineMavenPluginNullDao

public interface PipelineMavenPluginDao extends Closeable
Author:
Cyrille Le Clerc
  • Method Details

    • recordDependency

      void recordDependency(@NonNull String jobFullName, int buildNumber, @NonNull String groupId, @NonNull String artifactId, @NonNull String version, @NonNull String type, @NonNull String scope, boolean ignoreUpstreamTriggers, String classifier)
      Record a Maven dependency of a build.
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      groupId - Maven dependency groupId
      artifactId - Maven dependency artifactId
      version - Maven dependency version
      type - Maven dependency type (e.g. "jar", "war", "pom", hpi"...)
      scope - Maven dependency scope ("compile", "test", "provided"...)
      ignoreUpstreamTriggers - see PipelineGraphPublisher#isIgnoreUpstreamTriggers()
      classifier - Maven dependency classifier
    • recordParentProject

      void recordParentProject(@NonNull String jobFullName, int buildNumber, @NonNull String parentGroupId, @NonNull String parentArtifactId, @NonNull String parentVersion, boolean ignoreUpstreamTriggers)
      Record a Maven parent project of a pom processed by this build of a build.
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      parentGroupId - Maven dependency groupId
      parentArtifactId - Maven dependency artifactId
      parentVersion - Maven dependency version
      ignoreUpstreamTriggers - see PipelineGraphPublisher#isIgnoreUpstreamTriggers()
    • recordGeneratedArtifact

      void recordGeneratedArtifact(@NonNull String jobFullName, int buildNumber, @NonNull String groupId, @NonNull String artifactId, @NonNull String version, @NonNull String type, @NonNull String baseVersion, @Nullable String repositoryUrl, boolean skipDownstreamTriggers, String extension, String classifier)
      Record a Maven artifact generated in a build.
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      groupId - Maven artifact groupId
      artifactId - Maven artifact artifactId
      version - Maven artifact version, the "expanded version" for snapshots who have been "mvn deploy" or equivalent (e.g. "1.1-20170808.155524-66" for "1.1-SNAPSHOT" deployed to a repo)
      type - Maven artifact type (e.g. "jar", "war", "pom", hpi"...)
      baseVersion - Maven artifact version, the NOT "expanded version" for snapshots who have been "mvn deploy" or equivalent (e.g. baseVersion is "1.1-SNAPSHOT" for a "1.1-SNAPSHOT" artifact that has been deployed to a repo and expanded to "1.1-20170808.155524-66")
      repositoryUrl - URL of the Maven repository on which the artifact is deployed ("mvn deploy"). null if the artifact was not deployed
      skipDownstreamTriggers - see PipelineGraphPublisher#isSkipDownstreamTriggers()
      extension -
      classifier -
    • recordBuildUpstreamCause

      void recordBuildUpstreamCause(String upstreamJobName, int upstreamBuildNumber, String downstreamJobName, int downstreamBuildNumber)
      TODO add MavenArtifact as org.jenkinsci.plugins.pipeline.maven.cause.MavenDependencyUpstreamCause gives these details
      Parameters:
      upstreamJobName - Job that triggered the build. See Item.getFullName().
      upstreamBuildNumber - Job that triggered the build. See Run.getNumber().
      downstreamJobName - Job that is triggered. See Item.getFullName().
      downstreamBuildNumber - Job that is triggered. See Run.getNumber().
    • listDependencies

      @NonNull List<MavenDependency> listDependencies(@NonNull String jobFullName, int buildNumber)
      Return the dependencies registered by the given build.
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      Returns:
      sorted list of maven artifacts.
      See Also:
    • getGeneratedArtifacts

      @NonNull List<MavenArtifact> getGeneratedArtifacts(@NonNull String jobFullName, int buildNumber)
      Return the artifacts generated by the given build.
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      Returns:
      sorted list of generated maven artifacts.
    • renameJob

      void renameJob(@NonNull String oldFullName, @NonNull String newFullName)
      Sync database when a job is renamed (see ItemListener.onRenamed(Item, String, String))
      Parameters:
      oldFullName - see Item.getFullName()
      newFullName - see Item.getFullName()
      See Also:
    • deleteJob

      void deleteJob(@NonNull String jobFullName)
      Sync database when a job is deleted (see ItemListener.onDeleted(Item))
      Parameters:
      jobFullName - see Item.getFullName()
      See Also:
    • deleteBuild

      void deleteBuild(@NonNull String jobFullName, int buildNumber)
      Sync database when a build is deleted (see RunListener.onDeleted(Run))
      Parameters:
      jobFullName - see Item.getFullName()
      See Also:
    • listDownstreamJobs

      @NonNull @Deprecated List<String> listDownstreamJobs(@NonNull String jobFullName, int buildNumber)
      List the downstream jobs who have a dependency on an artifact that has been generated by the given build (build identified by the given jobFullName, buildNumber). Doesn't return the passed job in case where a pipeline consumes an artifact it also produces
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      Returns:
      list of job full names (see Item.getFullName())
      See Also:
    • listDownstreamJobsByArtifact

      @NonNull Map<MavenArtifact,SortedSet<String>> listDownstreamJobsByArtifact(@NonNull String jobFullName, int buildNumber)
      List the downstream jobs who have a dependency on an artifact that has been generated by the given build (build identified by the given jobFullName, buildNumber). Doesn't return the passed job in case where a pipeline consumes an artifact it also produces
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      Returns:
      list of job full names (see Item.getFullName()) by MavenArtifact
      See Also:
    • listDownstreamJobs

      @NonNull default SortedSet<String> listDownstreamJobs(@NonNull String groupId, @NonNull String artifactId, @NonNull String version, @Nullable String baseVersion, @NonNull String type)
      List the downstream jobs who have a dependency on the given artifact.
      Parameters:
      groupId - Maven artifact group ID (see Artifact#getArtifactId())
      artifactId - Maven artifact id (see Artifact#getArtifactId())
      version - Maven artifact version (see Artifact#getVersion())
      baseVersion - Maven artifact (see Artifact#getBaseVersion())
      type - Maven artifact type (see Artifact#getType())
      Returns:
      list of job full names (see Item.getFullName()) by {MavenArtifact}
      See Also:
    • listDownstreamJobs

      @NonNull SortedSet<String> listDownstreamJobs(@NonNull String groupId, @NonNull String artifactId, @NonNull String version, @Nullable String baseVersion, @NonNull String type, @Nullable String classifier)
      List the downstream jobs who have a dependency on the given artifact.
      Parameters:
      groupId - Maven artifact group ID (see Artifact#getArtifactId())
      artifactId - Maven artifact id (see Artifact#getArtifactId())
      version - Maven artifact version (see Artifact#getVersion())
      baseVersion - Maven artifact (see Artifact#getBaseVersion())
      type - Maven artifact type (see Artifact#getType())
      classifier - Maven artifact classifier (see Artifact#getClassifier())
      Returns:
      list of job full names (see Item.getFullName()) by MavenArtifact
      See Also:
    • listUpstreamJobs

      @NonNull Map<String,Integer> listUpstreamJobs(@NonNull String jobFullName, int buildNumber)
      List the upstream jobs who generate an artifact that the given build depends on (build identified by the given jobFullName, buildNumber) Doesn't return the passed job in case where a pipeline consumes an artifact it also produces
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      Returns:
      list of builds : key Item.getFullName(), value: Run.getNumber()
      See Also:
    • listTransitiveUpstreamJobs

      @NonNull Map<String,Integer> listTransitiveUpstreamJobs(@NonNull String jobFullName, int buildNumber)
      List the upstream jobs who generate an artifact that the given build depends on, including transitive dependencies (build identified by the given jobFullName, buildNumber)
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      Returns:
      list of job full names (see Item.getFullName())
      See Also:
    • listTransitiveUpstreamJobs

      @NonNull Map<String,Integer> listTransitiveUpstreamJobs(@NonNull String jobFullName, int buildNumber, UpstreamMemory upstreamMemory)
      List the upstream jobs who generate an artifact that the given build depends on, including transitive dependencies (build identified by the given jobFullName, buildNumber) Use a memory for already known upstreams to boost performance
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      upstreamMemory - see UpstreamMemory - if called for several jobs in a loop we save the already known upstreams
      Returns:
      list of job full names (see Item.getFullName())
      See Also:
    • cleanup

      void cleanup()
      Routine task to cleanup the database and reclaim disk space (if possible in the underlying database).
    • toPrettyString

      String toPrettyString()
      Human readable toString
    • getDescription

      String getDescription()
    • updateBuildOnCompletion

      void updateBuildOnCompletion(@NonNull String jobFullName, int buildNumber, int buildResultOrdinal, long startTimeInMillis, long durationInMillis)
      Update the database with build result details.
      Parameters:
      jobFullName - see Item.getFullName()
      buildNumber - see Run.getNumber()
      buildResultOrdinal - see Result.ordinal
      startTimeInMillis - see Run.getStartTimeInMillis()
      durationInMillis - see Run.getDuration()
    • isEnoughProductionGradeForTheWorkload

      boolean isEnoughProductionGradeForTheWorkload()
      Indicates if the underlying database is production grade enough for the workload. H2 database is not enough for production grade workloads of the pipeline-maven-plugin.
      Returns:
      false if the underlying database is not production grade enough for the workload
    • getBuilder

    • getDefaultJdbcUrl

      default String getDefaultJdbcUrl()