-
Notifications
You must be signed in to change notification settings - Fork 354
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
Cleanup deprecated code #898
Conversation
8455a56
to
6a6a98a
Compare
@nfalco79 Breaks downstream test
The problem can be reproduced on an AMD64 system by cloning the Blue Ocean Git repository, then applying diff --git a/blueocean-bitbucket-pipeline/pom.xml b/blueocean-bitbucket-pipeline/pom.xml
index 0b2cae80c..8fdbb30ce 100644
--- a/blueocean-bitbucket-pipeline/pom.xml
+++ b/blueocean-bitbucket-pipeline/pom.xml
@@ -26,6 +26,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-bitbucket-branch-source</artifactId>
+ <version>906.vedf430cb_4481</version>
<exclusions>
<!-- Upper bound fix: later version of jsch is picked from git-plugin's transitive dependency -->
<exclusion>
diff --git a/blueocean-bitbucket-pipeline/src/main/java/io/jenkins/blueocean/blueocean_bitbucket_pipeline/AbstractBitbucketScm.java b/blueocean-bitbucket-pipeline/src/main/java/io/jenkins/blueocean/blueocean_bitbucket_pipeline/AbstractBitbucketScm.java
index 636a2d326..551b5f743 100644
--- a/blueocean-bitbucket-pipeline/src/main/java/io/jenkins/blueocean/blueocean_bitbucket_pipeline/AbstractBitbucketScm.java
+++ b/blueocean-bitbucket-pipeline/src/main/java/io/jenkins/blueocean/blueocean_bitbucket_pipeline/AbstractBitbucketScm.java
@@ -4,6 +4,7 @@ import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfig
import com.cloudbees.plugins.credentials.CredentialsScope;
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials;
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
+import hudson.model.Descriptor;
import hudson.model.User;
import io.jenkins.blueocean.commons.ErrorMessage;
import io.jenkins.blueocean.commons.ServiceException;
@@ -211,8 +212,13 @@ public abstract class AbstractBitbucketScm extends AbstractScm {
validate(userName, password, apiUrl);
- final StandardUsernamePasswordCredentials credential = new UsernamePasswordCredentialsImpl(CredentialsScope.USER,
+ final StandardUsernamePasswordCredentials credential;
+ try {
+ credential = new UsernamePasswordCredentialsImpl(CredentialsScope.USER,
createCredentialId(apiUrl), "Bitbucket server credentials", userName, password);
+ } catch (Descriptor.FormException e) {
+ throw new RuntimeException(e);
+ }
//if credentials are wrong, this call will fail with 401 error
validateCredential(apiUrl, credential);
diff --git a/blueocean-events/src/test/java/io/jenkins/blueocean/events/SseEventTest.java b/blueocean-events/src/test/java/io/jenkins/blueocean/events/SseEventTest.java
index f31bcb865..1ca98667e 100644
--- a/blueocean-events/src/test/java/io/jenkins/blueocean/events/SseEventTest.java
+++ b/blueocean-events/src/test/java/io/jenkins/blueocean/events/SseEventTest.java
@@ -14,7 +14,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
import edu.umd.cs.findbugs.annotations.NonNull;
import jenkins.branch.BranchProperty;
@@ -135,7 +134,7 @@ public class SseEventTest {
}
@Test
- public void pipelineWithInput() throws IOException, ExecutionException, InterruptedException, TimeoutException {
+ public void pipelineWithInput() throws Exception {
final OneShotEvent success = new OneShotEvent();
String script = "node {\n" +
diff --git a/blueocean-git-pipeline/src/main/java/io/jenkins/blueocean/blueocean_git_pipeline/GitScm.java b/blueocean-git-pipeline/src/main/java/io/jenkins/blueocean/blueocean_git_pipeline/GitScm.java
index 234f4d6a3..97c0787fd 100644
--- a/blueocean-git-pipeline/src/main/java/io/jenkins/blueocean/blueocean_git_pipeline/GitScm.java
+++ b/blueocean-git-pipeline/src/main/java/io/jenkins/blueocean/blueocean_git_pipeline/GitScm.java
@@ -9,6 +9,7 @@ import com.cloudbees.plugins.credentials.domains.DomainRequirement;
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
+import hudson.model.Descriptor;
import hudson.model.User;
import hudson.util.HttpResponses;
import io.jenkins.blueocean.commons.DigestUtils;
@@ -314,12 +315,16 @@ public class GitScm extends AbstractScm {
// Un-normalized repositoryUrl so the description matches user input.
String description = String.format("%s for %s", CREDENTIAL_DESCRIPTION_PW, repositoryUrl);
- final StandardUsernamePasswordCredentials newCredential =
- new UsernamePasswordCredentialsImpl(CredentialsScope.USER,
+ final StandardUsernamePasswordCredentials newCredential;
+ try {
+ newCredential = new UsernamePasswordCredentialsImpl(CredentialsScope.USER,
credentialId,
description,
requestUsername,
requestPassword);
+ } catch (Descriptor.FormException e) {
+ throw new RuntimeException(e);
+ }
try {
if (existingCredential == null) {
diff --git a/blueocean-github-pipeline/src/main/java/io/jenkins/blueocean/blueocean_github_pipeline/GithubScm.java b/blueocean-github-pipeline/src/main/java/io/jenkins/blueocean/blueocean_github_pipeline/GithubScm.java
index 97829e3d7..044d1df86 100644
--- a/blueocean-github-pipeline/src/main/java/io/jenkins/blueocean/blueocean_github_pipeline/GithubScm.java
+++ b/blueocean-github-pipeline/src/main/java/io/jenkins/blueocean/blueocean_github_pipeline/GithubScm.java
@@ -6,6 +6,7 @@ import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
import hudson.Extension;
+import hudson.model.Descriptor;
import hudson.model.Item;
import hudson.model.User;
import hudson.tasks.Mailer;
@@ -334,9 +335,13 @@ public class GithubScm extends AbstractScm {
String credentialId = createCredentialId(getUri());
StandardUsernamePasswordCredentials githubCredential =
CredentialsUtils.findCredential(credentialId, StandardUsernamePasswordCredentials.class, new BlueOceanDomainRequirement());
- final StandardUsernamePasswordCredentials credential =
- new UsernamePasswordCredentialsImpl(CredentialsScope.USER, credentialId, getCredentialDescription(),
+ final StandardUsernamePasswordCredentials credential;
+ try {
+ credential = new UsernamePasswordCredentialsImpl(CredentialsScope.USER, credentialId, getCredentialDescription(),
authenticatedUser.getId(), accessToken);
+ } catch (Descriptor.FormException e) {
+ throw new RuntimeException(e);
+ }
if(githubCredential == null) {
CredentialsUtils.createCredentialsInUserStore(
diff --git a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/CredentialApiTest.java b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/CredentialApiTest.java
index 5d597035c..c05c20864 100644
--- a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/CredentialApiTest.java
+++ b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/CredentialApiTest.java
@@ -31,7 +31,7 @@ import static org.junit.Assert.assertNotNull;
public class CredentialApiTest extends PipelineBaseTest {
@Test
- public void listCredentials() throws IOException {
+ public void listCredentials() throws Exception {
SystemCredentialsProvider.ProviderImpl system = ExtensionList.lookup(CredentialsProvider.class).get(SystemCredentialsProvider.ProviderImpl.class);
CredentialsStore systemStore = system.getStore(j.getInstance());
systemStore.addDomain(new Domain("domain1", null, null));
@@ -59,7 +59,7 @@ public class CredentialApiTest extends PipelineBaseTest {
}
@Test
- public void listAllCredentials() throws IOException {
+ public void listAllCredentials() throws Exception {
SystemCredentialsProvider.ProviderImpl system = ExtensionList.lookup(CredentialsProvider.class).get(SystemCredentialsProvider.ProviderImpl.class);
CredentialsStore systemStore = system.getStore(j.getInstance());
systemStore.addDomain(new Domain("domain1", null, null));
diff --git a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/GraphBuilderTest.java b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/GraphBuilderTest.java
index 37d1e3626..17d41b10a 100644
--- a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/GraphBuilderTest.java
+++ b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/GraphBuilderTest.java
@@ -542,7 +542,7 @@ public class GraphBuilderTest extends PipelineBaseTest {
return job.getLastBuild();
}
- private WorkflowJob createJob(String jobName, String jenkinsFileName) throws java.io.IOException {
+ private WorkflowJob createJob(String jobName, String jenkinsFileName) throws Exception {
WorkflowJob job = j.createProject(WorkflowJob.class, jobName);
URL resource = getClass().getResource(jenkinsFileName);
diff --git a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/LinkResolverTest.java b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/LinkResolverTest.java
index f1f9a781d..1c2e2c3ba 100644
--- a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/LinkResolverTest.java
+++ b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/LinkResolverTest.java
@@ -14,7 +14,6 @@ import org.junit.Assert;
import org.junit.Test;
import org.jvnet.hudson.test.MockFolder;
-import java.io.IOException;
import java.util.List;
/**
@@ -28,7 +27,7 @@ public class LinkResolverTest extends PipelineBaseTest {
}
@Test
- public void nestedFolderJobLinkResolveTest() throws IOException {
+ public void nestedFolderJobLinkResolveTest() throws Exception {
Project f = j.createFreeStyleProject("fstyle1");
MockFolder folder1 = j.createFolder("folder1");
Project p1 = folder1.createProject(FreeStyleProject.class, "test1");
diff --git a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/PipelineBaseTest.java b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/PipelineBaseTest.java
index b352c5660..3fa6bead9 100644
--- a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/PipelineBaseTest.java
+++ b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/PipelineBaseTest.java
@@ -647,7 +647,7 @@ public abstract class PipelineBaseTest{
return login("bob", "Bob Smith", "bob@jenkins-ci.org");
}
- protected WorkflowJob createWorkflowJobWithJenkinsfile(Class<?> contextClass, String jenkinsFileName) throws java.io.IOException {
+ protected WorkflowJob createWorkflowJobWithJenkinsfile(Class<?> contextClass, String jenkinsFileName) throws Exception {
WorkflowJob p = j.createProject(WorkflowJob.class, "project-" + UUID.randomUUID());
URL resource = contextClass.getResource(jenkinsFileName);
String jenkinsFile = IOUtils.toString(resource, StandardCharsets.UTF_8);
diff --git a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/analytics/PipelinePluginAnalyticsTest.java b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/analytics/PipelinePluginAnalyticsTest.java
index fe8dce37c..b40045b20 100644
--- a/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/analytics/PipelinePluginAnalyticsTest.java
+++ b/blueocean-pipeline-api-impl/src/test/java/io/jenkins/blueocean/rest/impl/pipeline/analytics/PipelinePluginAnalyticsTest.java
@@ -71,7 +71,7 @@ public class PipelinePluginAnalyticsTest extends PipelineBaseTest {
Assert.assertEquals("runResult", "SUCCESS", properties.get("runResult"));
}
- private void createAndRunPipeline(String jenkinsFileName) throws java.io.IOException, InterruptedException, java.util.concurrent.ExecutionException {
+ private void createAndRunPipeline(String jenkinsFileName) throws Exception {
// Create the pipeline and run it
WorkflowJob scriptedSingle = createWorkflowJobWithJenkinsfile(getClass(), jenkinsFileName);
WorkflowRun scriptedSingleRun = scriptedSingle.scheduleBuild2(0, new CauseAction()).waitForStart();
diff --git a/pom.xml b/pom.xml
index 9395690e4..c07970ec4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@
when changing jenkins core version please remember to change it in Jenkinsfile as well jenkinsVersions
and acceptance-tests/runner/scripts/args.sh
-->
- <jenkins.version>2.426.3</jenkins.version>
+ <jenkins.version>2.462.3</jenkins.version>
<javadoc.exec.goal>javadoc-no-fork</javadoc.exec.goal> <!-- stop initialize phase plugins executing twice -->
<byte-buddy.version>1.14.9</byte-buddy.version>
<node.version>10.13.0</node.version>
@@ -219,8 +219,8 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
- <artifactId>bom-2.426.x</artifactId>
- <version>2961.v1f472390972e</version>
+ <artifactId>bom-2.462.x</artifactId>
+ <version>3613.v584fca_12cf5c</version>
<scope>import</scope>
<type>pom</type>
</dependency>
--
2.34.1 and running
As a result of this new test failure, we have rolled back the upgrade of Bitbucket Branch Source from 906.vedf430cb_4481 back down to 895.v15dc41668f03 in jenkinsci/bom#3919. When the new test failure is fixed in Blue Ocean and when that fix is released in a new version of Blue Ocean, then we will upgrade Bitbucket Branch Source from 895.v15dc41668f03 to 906.vedf430cb_4481 in |
With this change in Jenkins under |
In this repository in the test data there are also a lot of XML files that still contain |
Causes JENKINS-74848, a failure to load job definitions that include com.cloudbees.jenkins.plugins.bitbucket.MergeWithGitSCMExtension |
Thanks @MarkEWaite and @darxriggs. Indeed, I faced both issues:
It is easy to fix manually by removing the line for repositoryType. For the second error (MergeWithGitSCMExtension), it does not break my pipeline. I am able to run an old build and it will automatically replace: For a classic multi-branch build trigger by a Bitbucket webhook on branches and PR, should I use something different than |
Let me try with these changes:
|
That transient field has been removed since it was not used. It's sage ignore or discard those data. |
@basil |
No description provided.