-
Notifications
You must be signed in to change notification settings - Fork 145
Remove references to ChildNameGenerator.beforeCreateItem
#506
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid I have no recollection of what this code was for.
idealNames
workaround can be removedChildNameGenerator.beforeCreateItem
diff --git a/src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java b/src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java
index 86d2af8..36890fe 100644
--- a/src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java
+++ b/src/test/java/org/jenkinsci/plugins/workflow/multibranch/WorkflowMultiBranchProjectTest.java
@@ -248,30 +248,30 @@ public class WorkflowMultiBranchProjectTest {
mp.scheduleBuild2(0).getFuture().get();
assertNull(mp.getItem("master"));
- sampleRepo.git("checkout", "-b", "feature");
+ sampleRepo.git("checkout", "-b", "feature/1");
sampleRepo.write("another-Jenkinsfile", "echo(/branch=$BRANCH_NAME/); node {checkout scm; echo readFile('file')}");
sampleRepo.git("add", "another-Jenkinsfile");
sampleRepo.write("file", "subsequent content");
sampleRepo.git("commit", "--all", "--message=feature-create");
- WorkflowJob p1 = scheduleAndFindBranchProject(mp, "feature");
+ WorkflowJob p1 = scheduleAndFindBranchProject(mp, "feature/1");
assertEquals(1, mp.getItems().size());
r.waitUntilNoActivity();
WorkflowRun b1 = p1.getLastBuild();
assertEquals(1, b1.getNumber());
r.assertLogContains("subsequent content", b1);
- r.assertLogContains("branch=feature", b1);
+ r.assertLogContains("branch=feature/1", b1);
- sampleRepo.git("checkout", "-b", "feature2");
+ sampleRepo.git("checkout", "-b", "feature/2");
sampleRepo.write("another-Jenkinsfile", "echo(/branch=$BRANCH_NAME/); node {checkout scm; echo readFile('file').toUpperCase()}");
sampleRepo.write("file", "alternative content");
sampleRepo.git("commit", "--all", "--message=feature2-create");
- WorkflowJob p2 = scheduleAndFindBranchProject(mp, "feature2");
+ WorkflowJob p2 = scheduleAndFindBranchProject(mp, "feature/2");
assertEquals(2, mp.getItems().size());
r.waitUntilNoActivity();
WorkflowRun b2 = p2.getLastBuild();
assertEquals(1, b2.getNumber());
r.assertLogContains("ALTERNATIVE CONTENT", b2);
- r.assertLogContains("branch=feature2", b2);
+ r.assertLogContains("branch=feature/2", b2);
}
@Issue("JENKINS-72613") shows that this workaround is still used from
|
try (ChildNameGenerator.Trace trace = ChildNameGenerator.beforeCreateItem( | ||
MultiBranchProject.this, encodedName, branch.getName() | ||
)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocked on jenkinsci/workflow-multibranch-plugin#359.
@@ -1436,19 +1436,14 @@ private void completeNew(MultiBranchProjectFactory factory, Map<String, Object> | |||
.println("Ignoring duplicate child " + projectName + " named " + folderName); | |||
return; | |||
} | |||
MultiBranchProject<?, ?> project; | |||
try (ChildNameGenerator.Trace trace = ChildNameGenerator.beforeCreateItem( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractWorkflowMultiBranchProjectFactory#doCreateProject
does not attempt to save the project, and both SCMSourceObserver.ProjectObserver#completeNew
and SCMSourceObserver.ProjectObserver#completeExisting
use BulkChange
, so idealNames
is never consulted here.
I am taking this out of draft now that jenkinsci/bom#4868 has been successfully adopted in BOM, but it still might make sense to wait a bit to allow people to upgrade |
We should probably wait a few weeks. My understanding is that the issue affects branch projects corresponding to unusually named branches, say |
I see no reason why a |
See jenkinsci/cloudbees-folder-plugin#479. This workaround is no longer necessary as of jenkinsci/workflow-multibranch-plugin#359, so remove usages of the API here in preparation for eventually removing the API itself in jenkinsci/cloudbees-folder-plugin#479.
This PR is in draft jenkinsci/workflow-multibranch-plugin#359 is merged, released, and adopted.
Testing done
BOM run in jenkinsci/bom#4838. See self-review for a justification of why the change is safe.