Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update parent POM, update dependencies, test with Java 21 #87

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
19 changes: 11 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Builds a module using https://github.com/jenkins-infra/pipeline-library
// Requirements:
// - agents with label 'linux' and 'windows'
// - tools with label 'jdk8' and 'mvn'
// - latest Pipeline plugins, 'Timestamper' plugin
// - recommended to use this Jenkinsfile with 'Multibranch Pipeline' plugin

buildPlugin()
/*
See the documentation for more options:
https://github.com/jenkins-infra/pipeline-library/
*/
buildPlugin(
forkCount: '1C', // run this number of tests in parallel for faster feedback. If the number terminates with a 'C', the value will be multiplied by the number of available CPU cores
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
])
33 changes: 19 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.50</version>
<version>4.74</version>
<relativePath />
</parent>

<properties>
<jenkins.version>2.346.3</jenkins.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<revision>3.2.1</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.361.4</jenkins.version>
<!-- https://wiki.jenkins-ci.org/display/JENKINS/Marking+a+new+plugin+version+as+incompatible+with+older+versions -->
<hpi.compatibleSinceVersion>3.1.6</hpi.compatibleSinceVersion>
</properties>

<artifactId>Parameterized-Remote-Trigger</artifactId>
<version>3.2.1-SNAPSHOT</version>
<version>${revision}${changelist}</version>
<packaging>hpi</packaging>
<name>Parameterized Remote Trigger Plugin</name>
<description>This plugin gives you the ability to trigger parameterized builds on a remote Jenkins server as part of your build.</description>
Expand Down Expand Up @@ -51,10 +51,10 @@
</build>

<scm>
<connection>scm:git:git://github.com/jenkinsci/parameterized-remote-trigger-tlugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/parameterized-remote-trigger-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/parameterized-remote-trigger-plugin</url>
<tag>HEAD</tag>
<connection>scm:git:https://github.com/jenkinsci/${gitHubRepo}.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/${gitHubRepo}.git</developerConnection>
<url>https://github.com/jenkinsci/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</scm>

<repositories>
Expand All @@ -75,8 +75,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.346.x</artifactId>
<version>1742.vb_70478c1b_25f</version>
<artifactId>bom-2.361.x</artifactId>
<version>2102.v854b_fec19c92</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down Expand Up @@ -105,19 +105,24 @@
<groupId>io.jenkins.plugins</groupId>
<artifactId>opentelemetry</artifactId>
<optional>true</optional>
<version>2.10.0</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.18.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-junit-rule</artifactId>
<version>5.14.0</version>
<version>5.15.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.workflow.graph.FlowNode;
import org.jenkinsci.plugins.workflow.steps.StepContext;
import org.jetbrains.annotations.NotNull;
import edu.umd.cs.findbugs.annotations.NonNull;

import java.util.Optional;

Expand Down Expand Up @@ -52,21 +52,21 @@ public static AutoCloseable activeSpanIfAvailable(Run run) {
.orElseGet(OtelUtils::noop);
}

@NotNull
@NonNull
public static AutoCloseable noop() {
return () -> {
};
}

@NotNull
@NonNull
public static boolean isOpenTelemetryAvailable() {
return Optional.ofNullable(Jenkins.get().getPlugin("opentelemetry"))
.map(Plugin::getWrapper)
.map(PluginWrapper::isActive)
.orElse(false);
}

@NotNull
@NonNull
private static String genTraceParent(Span span) {
return TRACE_PARENT_VERSION + "-" + span.getSpanContext().getTraceId() + "-" + span.getSpanContext().getSpanId() + "-" + TRACE_PARENT_TRACE_FLAG;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import hudson.security.SecurityRealm;
import io.jenkins.plugins.opentelemetry.OpenTelemetryConfiguration;
import io.jenkins.plugins.opentelemetry.OpenTelemetrySdkProvider;
import org.jetbrains.annotations.NotNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
Expand Down Expand Up @@ -55,7 +55,7 @@ public void testRemoteBuild() throws Exception {
mockServerClient.verify(allExpectation);
}

@NotNull
@NonNull
private FreeStyleProject createProjectTriggerFrom() throws IOException {
FreeStyleProject project = jenkinsRule.createFreeStyleProject();
RemoteBuildConfiguration configuration = new RemoteBuildConfiguration();
Expand All @@ -73,7 +73,7 @@ private FreeStyleProject createProjectTriggerFrom() throws IOException {
return project;
}

@NotNull
@NonNull
private String[] setupRemoteJenkinsMock() {
Expectation[] metaExp = mockServerClient.when(
request()
Expand Down Expand Up @@ -166,7 +166,7 @@ private String[] setupRemoteJenkinsMock() {
return allExp;
}

@NotNull
@NonNull
private String createJobUrl() {
return "http://localhost:" + mockServerClient.getPort() + "/job/remote1";
}
Expand Down
Loading