Skip to content

Commit

Permalink
Support remote execution by removing jth.jenkins-war.path
Browse files Browse the repository at this point in the history
Including the war on the classpath  does not require local path access
  • Loading branch information
sghill committed Jun 29, 2024
1 parent 558ff45 commit 09d0d06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ open class JpiTestingPlugin : Plugin<Project> {
companion object {
fun Test.useJenkinsRule(dir: Provider<Directory>) {
doFirst {
val war = project.configurations.getByName("declaredJenkinsWar").resolvedConfiguration.resolvedArtifacts.single()
systemProperty("jth.jenkins-war.path", war.file.absolutePath)
systemProperty("java.awt.headless", "true")
// set build directory for Jenkins test harness, JENKINS-26331
// this is the directory the war will be exploded to
Expand All @@ -29,7 +27,7 @@ open class JpiTestingPlugin : Plugin<Project> {
}
}
override fun apply(target: Project) {
target.configurations.create("declaredJenkinsWar") {
val declaredJenkinsWar = target.configurations.create("declaredJenkinsWar") {
isVisible = false
isCanBeConsumed = false
isCanBeResolved = true
Expand Down Expand Up @@ -109,6 +107,9 @@ open class JpiTestingPlugin : Plugin<Project> {
testClassesDirs = generatedSourceSet.output.classesDirs
classpath = project.files(generatedJenkinsPluginsDir.get().asFile.parentFile) + generatedSourceSet.runtimeClasspath
}
target.configurations.getByName("generatedJenkinsTestRuntimeOnly") {
extendsFrom(declaredJenkinsWar)
}
target.tasks.named("check").configure {
dependsOn(generatedJenkinsTest)
}
Expand All @@ -128,5 +129,8 @@ open class JpiTestingPlugin : Plugin<Project> {
inputs.files(copyPluginsForTest)
classpath += project.files(testPluginsDir.get().asFile.parentFile)
}
target.configurations.getByName("testRuntimeOnly") {
extendsFrom(declaredJenkinsWar)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class JpiPublishingAndConsumptionTest extends IntegrationSpec {
'display-url-api-0.2.hpi',
'junit-1.3.hpi',
'script-security-1.13.hpi',
'jenkins-war-1.580.1.war',
] as Set
}

Expand Down Expand Up @@ -219,7 +220,9 @@ class JpiPublishingAndConsumptionTest extends IntegrationSpec {
resolveConsumer('jenkinsRuntime') == [ 'producer-1.0.hpi', 'ant-1.2.hpi' ] as Set
resolveConsumer('jenkinsTestRuntime') == [
'producer-1.0.hpi',
'ant-1.2.hpi' ] as Set
'ant-1.2.hpi',
'jenkins-war-1.580.1.war',
] as Set

when:
consumerBuild << """
Expand All @@ -246,7 +249,9 @@ class JpiPublishingAndConsumptionTest extends IntegrationSpec {
resolveConsumer('jenkinsTestRuntime') ==
[ 'producer-1.0.hpi',
'ant-1.2.hpi',
'credentials-1.9.4.hpi' ] as Set
'credentials-1.9.4.hpi',
'jenkins-war-1.580.1.war',
] as Set

manifestEntry('consumer', 'Plugin-Dependencies') ==
'producer:1.0,credentials:1.9.4'
Expand Down Expand Up @@ -281,7 +286,7 @@ class JpiPublishingAndConsumptionTest extends IntegrationSpec {
resolveConsumer('compile') == JENKINS_CORE_DEPS + [ 'producer-1.0.jar' ] as Set
resolveConsumer('runtime') == [ 'producer-1.0.jar' ] as Set
resolveConsumer('jenkinsRuntime') == [ 'producer-1.0.hpi' ] as Set
resolveConsumer('jenkinsTestRuntime') == [ 'producer-1.0.hpi' ] as Set
resolveConsumer('jenkinsTestRuntime') == [ 'producer-1.0.hpi', 'jenkins-war-1.580.1.war' ] as Set
}

private void publishProducer() {
Expand Down

0 comments on commit 09d0d06

Please sign in to comment.