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

[JENKINS-50328] [JENKINS-51066] Fix bug where pipeline editor ignores custom Jenkinsfile script path. #2049

Merged
merged 6 commits into from
Jan 31, 2020

Conversation

sutrosoftware
Copy link
Contributor

Description

This change fixes a bug where the pipeline editor ignores and therefore fails to load or save custom Jenkinsfile script paths. This is a fix to existing functionality so no new tests have been added.

See JENKINS-50328.
See JENKINS-51066.

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description
  • Appropriate unit or acceptance tests or explanation to why this change has no tests
  • Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • Run the changes and verified the change matches the issue description
  • Reviewed the code
  • Verified that the appropriate tests have been written or valid explanation given

@sutrosoftware
Copy link
Contributor Author

The test failure appears to be due to a jenkins restart mid-test and unrelated to the change.

@kshultzCB
Copy link
Collaborator

Thanks for the PR!

As for the question of adding tests, it might be good to add something to the acceptance tests to run through this. I don't yet know what would be involved in that.

The test failure appears to be due to a jenkins restart mid-test and unrelated to the change.

I just relaunched the build.

Copy link
Collaborator

@kshultzCB kshultzCB left a comment

Choose a reason for hiding this comment

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

This looks like a really good PR. I've tried a silly number of folders for a silly named Jenkinsfile to be in, along with some other setups, and this works really nicely.

I'm looking to see how easy it would be to add a test (or just reconfigure an existing test) in the acceptance-tests to run through a round trip workflow with a non-default Jenkinsfile location. But that aside, this looks like a really great fix for a bug I bet has been annoying a lot of users.

Copy link
Member

@olamy olamy left a comment

Choose a reason for hiding this comment

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

LGTM a test would be good for sure but it's an easy change

Copy link
Collaborator

@kshultzCB kshultzCB left a comment

Choose a reason for hiding this comment

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

Even though an acceptance test would be good for this, I don't think that's worth holding up merge. This is a great fix. Many thanks for the PR!

@kshultzCB kshultzCB merged commit 6ae5307 into jenkinsci:master Jan 31, 2020
MultiBranchPipelineImpl mbpi = new MultiBranchPipelineImpl(organization, (MultiBranchProject) item);
if (item instanceof WorkflowMultiBranchProject) {
WorkflowMultiBranchProject wfmbp = (WorkflowMultiBranchProject)item;
WorkflowBranchProjectFactory wbpf = (WorkflowBranchProjectFactory)wfmbp.getProjectFactory();
Copy link

Choose a reason for hiding this comment

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

This seems to break "Multibranch with defaults" plugin as its PipelineBranchDefaultsProjectFactory cannot be cast to WorkflowBranchProjectFactory which leads to a ClassCastException.

Copy link

Choose a reason for hiding this comment

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

@kshultzCB Can you look at this plz? :)

Copy link

@glfp glfp May 8, 2020

Choose a reason for hiding this comment

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

I confirm ... it break Multibranch With Defaults

java.lang.ClassCastException: org.jenkinsci.plugins.pipeline.multibranch.defaults.PipelineBranchDefaultsProjectFactory cannot be cast to org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory at io.jenkins.blueocean.rest.impl.pipeline.MultiBranchPipelineImpl$PipelineFactoryImpl.getPipeline(MultiBranchPipelineImpl.java:277) at io.jenkins.blueocean.rest.impl.pipeline.MultiBranchPipelineImpl$PipelineFactoryImpl.getPipeline(MultiBranchPipelineImpl.java:268) at io.jenkins.blueocean.rest.factory.BluePipelineFactory.getPipelineInstance(BluePipelineFactory.java:117) at io.jenkins.blueocean.service.embedded.rest.PipelineContainerImpl.getPipelines(PipelineContainerImpl.java:66) at io.jenkins.blueocean.service.embedded.rest.PipelineSearch.search(PipelineSearch.java:106) at io.jenkins.blueocean.rest.ApiHead.search(ApiHead.java:61) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)

@sutrosoftware
Copy link
Contributor Author

Will take a look. Thanks for the bug report.

bitwiseman added a commit that referenced this pull request May 15, 2020
…ults

This change will stop the failure but also rolls back #2049 when using pipeline-multibranch-defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants