Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ then
```bash
kubectl krew install tunnel # as needed; install Krew first
kubectl tunnel expose jenkins 8000:8000 8001:8001 &
mvn test -Djenkins.host.address=jenkins.default.svc.cluster.local -Dport=8000 -DslaveAgentPort=8001 -Dtest=KubernetesPipelineTest#runInPod
mvn test -Pktunnel -Dtest=KubernetesPipelineTest#runInPod
```

Alternately, you can run everything like in CI:
Expand All @@ -1028,7 +1028,7 @@ export KIND_PRELOAD=true # optionally
You can also run interactively after setting up the tunnel:

```bash
mvn hpi:run -Djenkins.host.address=jenkins.default -Dport=8000 -Djenkins.model.Jenkins.slaveAgentPort=8001
mvn hpi:run -Pktunnel
```

# Docker image
Expand Down
4 changes: 1 addition & 3 deletions kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ ktunnel_pid=$!
mvn \
-B \
-ntp \
-Djenkins.host.address=jenkins.default \
-Dport=8000 \
-DslaveAgentPort=8001 \
-Pktunnel \
-Dmaven.test.failure.ignore \
verify \
"$@"
44 changes: 32 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@

<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.host.address />
<slaveAgentPort />
<jenkins.baseline>2.504</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
<no-test-jar>false</no-test-jar>
Expand Down Expand Up @@ -294,12 +292,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<hudson.slaves.NodeProvisioner.initialDelay>0</hudson.slaves.NodeProvisioner.initialDelay>
<hudson.slaves.NodeProvisioner.recurrencePeriod>3000</hudson.slaves.NodeProvisioner.recurrencePeriod>
Comment on lines -297 to -298
Copy link
Copy Markdown
Member Author

@jglick jglick Mar 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be necessary as of #598.

History: f3c43b7 357355f (from #217) #898

<org.jenkinsci.plugins.workflow.support.pickles.ExecutorPickle.timeoutForNodeMillis>60000</org.jenkinsci.plugins.workflow.support.pickles.ExecutorPickle.timeoutForNodeMillis>
<!-- have pods connect to this address for Jenkins -->
<jenkins.host.address>${jenkins.host.address}</jenkins.host.address>
<slaveAgentPort>${slaveAgentPort}</slaveAgentPort>
</systemPropertyVariables>
</configuration>
</plugin>
Expand All @@ -308,11 +301,6 @@
<artifactId>maven-hpi-plugin</artifactId>
<configuration>
<systemProperties>
<hudson.slaves.NodeProvisioner.initialDelay>0</hudson.slaves.NodeProvisioner.initialDelay>
<hudson.slaves.NodeProvisioner.MARGIN>50</hudson.slaves.NodeProvisioner.MARGIN>
<hudson.slaves.NodeProvisioner.MARGIN0>0.85</hudson.slaves.NodeProvisioner.MARGIN0>
Comment on lines -311 to -313
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

<jenkins.host.address>${jenkins.host.address}</jenkins.host.address>
<port>${port}</port>
<org.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.verbose>true</org.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.verbose>
</systemProperties>
</configuration>
Expand Down Expand Up @@ -388,6 +376,38 @@
</plugins>
</build>
</profile>
<profile>
<!-- kubectl tunnel expose jenkins 8000:8000 8001:8001 -->
<id>ktunnel</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<jenkins.host.address>jenkins.default.svc.cluster.local</jenkins.host.address>
<port>8000</port>
<slaveAgentPort>8001</slaveAgentPort>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note inconsistency:

// TODO could just use standard jenkins.model.Jenkins.slaveAgentPort and skip this code (also in SetupCloud):
Integer slaveAgentPort = Integer.getInteger("slaveAgentPort");
if (slaveAgentPort != null) {
Jenkins.get().setSlaveAgentPort(slaveAgentPort);
}

</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<configuration>
<defaultPort>8000</defaultPort>
<systemProperties>
<jenkins.host.address>jenkins.default.svc.cluster.local</jenkins.host.address>
<jenkins.model.Jenkins.slaveAgentPort>8001</jenkins.model.Jenkins.slaveAgentPort>
</systemProperties>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ public static void hpiRunInit() {
&& jenkins.clouds.getAll(KubernetesCloud.class).isEmpty()) {
KubernetesCloud cloud = new KubernetesCloud("kubernetes");
cloud.setJenkinsUrl(
"http://" + hostAddress + ":" + SystemProperties.getInteger("port", 8080) + "/jenkins/");
"http://" + hostAddress + ":" + SystemProperties.getInteger("port", 8000) + "/jenkins/");
jenkins.clouds.add(cloud);
}
}
Expand Down
Loading