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

Upgrade libraries and Jenkins version #441

Merged
merged 7 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
18 changes: 12 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
<cloverVersion>4.3.1</cloverVersion>
<disableTestInjection>true</disableTestInjection>
<hamcrest.version>2.2</hamcrest.version>
<jackson.version>2.15.3</jackson.version>
<jackson.version>2.17.2</jackson.version>
<!-- When updating the Jenkins version, also update io.jenkins.tools.bom dependency management and the README -->
<jenkins.version>2.401.3</jenkins.version>
<jenkins.version>2.414.3</jenkins.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<net.oauth.version>20100527</net.oauth.version>
<!-- exclude the upgrade tests by default, as they interact with external resources and should not be run frequently -->
Expand All @@ -43,8 +43,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.401.x</artifactId>
<version>2661.vb_b_60650f6d97</version>
<artifactId>bom-2.414.x</artifactId>
<version>2982.vdce2153031a_0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down Expand Up @@ -119,7 +119,7 @@
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>instance-identity</artifactId>
<version>142.v04572ca_5b_265</version>
<version>185.v303dc7c645f9</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -163,6 +163,12 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>junit</artifactId>
<!--<version>managed by bom</version>-->
<exclusions>
<exclusion>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down Expand Up @@ -342,7 +348,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.21.0</version>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The plugin streamlines the entire configuration process and removes the need for

## Requirements

- Jenkins 2.401.3+
- Jenkins 2.414.3+
- Bitbucket Server 7.4+

Note: Bitbucket Server 6.0 to 7.3 are also supported, but they're not recommended. This is because some plugin features are not available when using these versions. Instead, we recommend using Bitbucket Server 7.4+. With 7.0+ you can make use of pull request triggers for jobs. With 7.4+ you can set up an Application Link to have access to all plugin features.
Expand Down Expand Up @@ -222,6 +222,7 @@ Integration tests are run under the `it` profile with the Failsafe plugin using
## Changelog
### 4.0.1
- JENKINS-72280 Secret text credentials can no longer be selected as part of a Bitbucket SCM configuration
- Updated minimum supported version of Jenkins to 2.414.3

### 4.0.0
- JENKINS-66581 Implement ChangeRequestSCMHead2 for pull requests and introduced a pull request discovery trait enabling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public void verifyThatWhenOAuthParametersAreNotPresentWeLetTheRequestPassThru()

verify(chain).doFilter(isA(HttpServletRequest.class), isA(HttpServletResponse.class));
verify(response, never()).addHeader(eq("WWW-Authenticate"), startsWith("OAuth"));
verifyZeroInteractions(trustedUnderlyingSystemAuthorizerFilter);
verifyNoInteractions(trustedUnderlyingSystemAuthorizerFilter);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void testShouldContinueFilterOtherEndpoints() throws IOException, Servlet

assertFalse(crumbExclusion.process(request, response, chain));

verifyZeroInteractions(chain);
verifyNoInteractions(chain);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void testPerformCallsDeploymentPoster() throws IOException, InterruptedEx

step.perform(run, null, null, listener);

verifyZeroInteractions(listener);
verifyNoInteractions(listener);
verify(bitbucketDeploymentFactory).createDeployment(run, ENVIRONMENT);
verify(deploymentPoster).postDeployment(repo, commit, deployment, run, listener);
}
Expand Down Expand Up @@ -280,7 +280,7 @@ public void testPerformWhenExceptionDoesNotThrow() throws IOException, Interrupt
verify(listener).error("An error occurred when trying to post the deployment to Bitbucket Server: Some exception");
verifyNoMoreInteractions(listener);
verify(bitbucketDeploymentFactory).createDeployment(run, ENVIRONMENT);
verifyZeroInteractions(deploymentPoster);
verifyNoInteractions(deploymentPoster);
}

@Test
Expand All @@ -292,8 +292,8 @@ public void testPerformWhenNoBitbucketRevisionAction() throws IOException, Inter

verify(listener).error("Could not send deployment notification: DeploymentNotifier only works when using the Bitbucket SCM for checkout.");
verifyNoMoreInteractions(listener);
verifyZeroInteractions(bitbucketDeploymentFactory);
verifyZeroInteractions(deploymentPoster);
verifyNoInteractions(bitbucketDeploymentFactory);
verifyNoInteractions(deploymentPoster);
}

@Test
Expand All @@ -314,7 +314,7 @@ public void testPerformWithBlankEnvironmentUrlCallsDeploymentPoster() throws IOE

step.perform(run, null, null, listener);

verifyZeroInteractions(listener);
verifyNoInteractions(listener);
verify(bitbucketDeploymentFactory).createDeployment(run, expectedEnvironment);
verify(deploymentPoster).postDeployment(repo, commit, deployment, run, listener);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public void testPostDeploymentWithUnknownServerId() {
verify(pluginConfiguration).getServerById(SERVER_ID);
verify(taskListener).error(
"Could not send deployment notification to Bitbucket Server: Unknown serverId '" + SERVER_ID + "'");
verifyZeroInteractions(clientFactoryProvider);
verifyZeroInteractions(jenkinsToBitbucketCredentials);
verifyNoInteractions(clientFactoryProvider);
verifyNoInteractions(jenkinsToBitbucketCredentials);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void testDoCheckEnvironmentKeyBlank() {
FormValidation formValidation = helper.doCheckEnvironmentKey(context, " ");

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation, equalTo(FORM_VALIDATION_OK));
}

Expand All @@ -54,7 +54,7 @@ public void testDoCheckEnvironmentKeyTooLong() {
FormValidation formValidation = helper.doCheckEnvironmentKey(context, environmentKey);

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation.getMessage(), equalTo("The environment key must be shorter than 255 characters"));
}

Expand All @@ -66,7 +66,7 @@ public void testDoCheckEnvironmentKey() {
FormValidation formValidation = helper.doCheckEnvironmentKey(context, environmentKey);

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation, equalTo(FORM_VALIDATION_OK));
}

Expand All @@ -77,7 +77,7 @@ public void testDoCheckEnvironmentNameBlank() {
FormValidation formValidation = helper.doCheckEnvironmentName(context, " ");

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation.getMessage(), equalTo("The environment name is required"));
}

Expand All @@ -99,7 +99,7 @@ public void testDoCheckEnvironmentNameTooLong() {
FormValidation formValidation = helper.doCheckEnvironmentName(context, environmentName);

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation.getMessage(), equalTo("The environment name must be shorter than 255 characters"));
}

Expand All @@ -111,7 +111,7 @@ public void testDoCheckEnvironmentName() {
FormValidation formValidation = helper.doCheckEnvironmentName(context, environmentName);

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation, equalTo(FORM_VALIDATION_OK));
}

Expand All @@ -122,7 +122,7 @@ public void testDoCheckEnvironmentTypeBadEnvironmentType() {
FormValidation formValidation = helper.doCheckEnvironmentType(context, "not an environment type");

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation.getMessage(), equalTo("The environment type should be one of DEVELOPMENT, PRODUCTION, STAGING, TESTING"));
}

Expand All @@ -133,7 +133,7 @@ public void testDoCheckEnvironmentTypeBlank() {
FormValidation formValidation = helper.doCheckEnvironmentType(context, " ");

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation, equalTo(FORM_VALIDATION_OK));
}

Expand All @@ -152,7 +152,7 @@ public void testDoCheckEnvironmentType() {
FormValidation formValidation = helper.doCheckEnvironmentType(context, "PRODUCTION");

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation, equalTo(FORM_VALIDATION_OK));
}

Expand All @@ -163,7 +163,7 @@ public void testDoCheckEnvironmentUrlBlank() {
FormValidation formValidation = helper.doCheckEnvironmentUrl(context, " ");

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation, equalTo(FORM_VALIDATION_OK));
}

Expand All @@ -182,7 +182,7 @@ public void testDoCheckEnvironmentUrlInvalid() {
FormValidation formValidation = helper.doCheckEnvironmentUrl(context, "not a url");

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation.getMessage(), equalTo("The environment URL must be a valid URL"));
}

Expand All @@ -193,7 +193,7 @@ public void testDoCheckEnvironmentUrlNotAbsolute() {
FormValidation formValidation = helper.doCheckEnvironmentUrl(context, "/relative/url");

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation.getMessage(), equalTo("The deployment URI must be absolute"));
}

Expand All @@ -205,7 +205,7 @@ public void testDoCheckEnvironmentUrlTooLong() {
FormValidation formValidation = helper.doCheckEnvironmentUrl(context, environmentUrl);

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation.getMessage(), equalTo("The deployment URI must be shorter than 1024 characters"));
}

Expand All @@ -216,7 +216,7 @@ public void testDoCheckEnvironmentUrl() {
FormValidation formValidation = helper.doCheckEnvironmentUrl(context, "http://my-env");

verify(context).checkPermission(Item.EXTENDED_READ);
verifyZeroInteractions(jenkins);
verifyNoInteractions(jenkins);
assertThat(formValidation, equalTo(FORM_VALIDATION_OK));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public void testCallbackWhenNoTaskListener() throws Exception {
callback.onStart(context);

verify(context).get(TaskListener.class);
verifyZeroInteractions(deploymentFactory);
verifyZeroInteractions(deploymentPoster);
verifyNoInteractions(deploymentFactory);
verifyNoInteractions(deploymentPoster);
}

@Test
Expand All @@ -76,8 +76,8 @@ public void testCallbackWhenNoRun() throws Exception {

verify(context).get(TaskListener.class);
verify(context).get(Run.class);
verifyZeroInteractions(deploymentFactory);
verifyZeroInteractions(deploymentPoster);
verifyNoInteractions(deploymentFactory);
verifyNoInteractions(deploymentPoster);
}

@Test
Expand All @@ -89,8 +89,8 @@ public void testCallbackWhenNoBitbucketRevisionAction() throws Exception {
verify(context).get(TaskListener.class);
verify(context).get(Run.class);
verify(run).getAction(BitbucketRevisionAction.class);
verifyZeroInteractions(deploymentFactory);
verifyZeroInteractions(deploymentPoster);
verifyNoInteractions(deploymentFactory);
verifyNoInteractions(deploymentPoster);
}

@Test
Expand All @@ -101,8 +101,8 @@ public void testCallbackContinuesWhenException() throws Exception {

callback.onSuccess(context, result);

verifyZeroInteractions(deploymentFactory);
verifyZeroInteractions(deploymentPoster);
verifyNoInteractions(deploymentFactory);
verifyNoInteractions(deploymentPoster);
verify(context).onSuccess(result);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public void testStartEnvironmentUriBlank() throws Exception {
assertThat(environment.getName(), equalTo(environmentName));
assertThat(environment.getType(), equalTo(getEnvironmentType(environmentType)));
assertThat(environment.getUrl(), nullValue());
verifyZeroInteractions(printStream);
verifyNoInteractions(printStream);
}

@Test
Expand All @@ -302,7 +302,7 @@ public void testStartEnvironmentUriNull() throws Exception {
assertThat(environment.getName(), equalTo(environmentName));
assertThat(environment.getType(), equalTo(getEnvironmentType(environmentType)));
assertThat(environment.getUrl(), nullValue());
verifyZeroInteractions(printStream);
verifyNoInteractions(printStream);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void testAfterSaveDoesNothingIfIsInvalid() {

bitbucketSCMsource.afterSave();

verifyZeroInteractions(triggerDesc);
verifyNoInteractions(triggerDesc);
}

@Test
Expand All @@ -83,7 +83,7 @@ public void testAfterSaveDoesNothingIfWebhookAlreadyRegistered() {

bitbucketSCMsource.afterSave();

verifyZeroInteractions(triggerDesc);
verifyNoInteractions(triggerDesc);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ public void testCreateSCMServerConflictingIdAndNameProvided() {
BitbucketSCMRepository result = scmStep.createSCM().getBitbucketSCMRepository();

assertThat(result.getServerId(), equalTo(SERVER_ID));
verifyZeroInteractions(descriptor);
verifyNoInteractions(descriptor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void testDecorateContextWithEventHeads() {
List<SCMHead> heads = handler.discoverHeads().collect(Collectors.toList());

// Verify that the client does not fetch any branches and uses the event heads instead
verifyZeroInteractions(bitbucketBranchClient);
verifyNoInteractions(bitbucketBranchClient);
assertThat(heads, Matchers.contains(testEventHead));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void testDecorateContextWithEventHeads() {
List<SCMHead> heads = handler.discoverHeads().collect(Collectors.toList());

// Verify that the client does not fetch any pull requests and uses the event heads instead
verifyZeroInteractions(bitbucketRepositoryClient);
verifyNoInteractions(bitbucketRepositoryClient);
assertThat(heads, Matchers.contains(testEventHead));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public void testBitbucketClientException() {
public void testNoBuildAction() {
when(run.getActions(BitbucketRevisionAction.class)).thenReturn(Collections.emptyList());
buildStatusPoster.onCompleted(run, listener);
verifyZeroInteractions(jenkinsSetupMock.getPluginConfiguration());
verifyZeroInteractions(listener);
verifyNoInteractions(jenkinsSetupMock.getPluginConfiguration());
verifyNoInteractions(listener);
}

@Test
Expand All @@ -94,7 +94,7 @@ public void testNoMatchingServer() {
when(jenkinsSetupMock.getPluginConfiguration().getServerById(SERVER_ID)).thenReturn(Optional.empty());
buildStatusPoster.onCompleted(run, listener);
verify(listener).error(eq("Failed to post build status as the provided Bitbucket Server config does not exist"));
verifyZeroInteractions(clientFactoryMock.getBitbucketClientFactoryProvider());
verifyNoInteractions(clientFactoryMock.getBitbucketClientFactoryProvider());
}

@Test
Expand All @@ -108,7 +108,7 @@ public void testBuildStatusDisabled() {
}
verify(logger).println(eq("Build statuses disabled, no build status sent."));

verifyZeroInteractions(clientFactoryMock.getBitbucketClientFactoryProvider());
verifyNoInteractions(clientFactoryMock.getBitbucketClientFactoryProvider());
}

@Test
Expand Down
Loading