SharedLibraryExtension

abstract class SharedLibraryExtension @Inject constructor(objects: ObjectFactory, project: Project, problems: Problems)

Extension for the com.mkobit.jenkins.pipelines.shared-library plugin.

All properties have sensible defaults (see SharedLibraryDefaults) and are optional.

sharedLibrary {
jenkins {
version = "2.492.3"
bomVersion = "3463.v23b_7bb_b_b_66d5"
}
pipelineUnitVersion = "1.29"
autoRegisterLibrary = true
implicit = true
plugins {
plugin("org.jenkins-ci.plugins.workflow:workflow-multibranch")
}
}

The built-in integrationTest suite is wired automatically. Additional suites opt in by setting JenkinsTestSuiteExtension.useTestHarness to true on the suite's extension:

testing {
suites {
register<JvmTestSuite>("integrationTestKotest") {
jenkins.useTestHarness = true
}
}
}

Constructors

Link copied to clipboard
@Inject
constructor(objects: ObjectFactory, project: Project, problems: Problems)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

When true (default), generates SharedLibraryAutoRegistrar.java and registers the SezPoz annotation processor so Jenkins auto-registers the shared library at embedded Jenkins startup. No explicit GlobalLibraries.get().setLibraries(...) call is needed in test code.

Link copied to clipboard

Peer shared library dependencies declared via dependencies.

Link copied to clipboard
val implicit: Property<Boolean>

implicit flag on the shared library registered in the embedded Jenkins test instance. When true (default), pipeline scripts can call vars without an explicit @Library declaration.

Link copied to clipboard
Link copied to clipboard
val libraryName: Property<String>

Name of the shared library injected into the embedded Jenkins test instance. Defaults to project.name.

Link copied to clipboard

Maximum number of Jenkins test suites that may execute concurrently within this project. Controls the JenkinsTestSuiteService build-service slot shared by all suites wired via JenkinsTestSuiteExtension.useTestHarness. Defaults to 1 (safe on any machine); increase on hosts with more RAM — allow roughly 4 GiB per additional parallel slot.

Link copied to clipboard

com.lesfurets:jenkins-pipeline-unit version used in the test suite.

Link copied to clipboard

Jenkins HPI/JPI plugin dependencies declared via plugins.

Functions

Link copied to clipboard
fun dependencies(action: Action<in SharedLibraryDependencies>)

Declares peer shared library dependencies — other shared libraries this project depends on. Each peer is registered with the embedded Jenkins as a Global Library.

Link copied to clipboard
fun jenkins(action: Action<in JenkinsVersions>)

Configures the Jenkins core and test-harness versions.

Link copied to clipboard
fun plugins(action: Action<in JenkinsPlugins>)

Declares Jenkins HPI/JPI plugin dependencies.

Link copied to clipboard
fun withJenkins(suite: JvmTestSuite)

Opts suite into full Jenkins test-harness wiring.