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-31516] Run re-index on children on organization re-index #20

Merged
merged 4 commits into from Dec 9, 2015

Conversation

amuniz
Copy link
Member

@amuniz amuniz commented Nov 12, 2015

JENKINS-31516

@reviewbybees

@ghost
Copy link

ghost commented Nov 12, 2015

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

@tfennelly
Copy link
Member

🐝

1 similar comment
@oleg-nenashev
Copy link
Member

🐝

@jglick
Copy link
Member

jglick commented Nov 12, 2015

A test would be nice but 🐝

@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@recena
Copy link
Collaborator

recena commented Dec 2, 2015

👍 to add a new test

@jglick
Copy link
Member

jglick commented Dec 2, 2015

Well, if you have time to write a test (verifying that it fails in the expected way with your fix commented out), that would be great, otherwise you are free to merge as is.

@recena
Copy link
Collaborator

recena commented Dec 2, 2015

🐝

public static class BranchProjectFactoryImpl extends BranchProjectFactory<FreeStyleProject, FreeStyleBuild> {

@Override
public FreeStyleProject newInstance(Branch branch) {
FreeStyleProject job = new FreeStyleProject(getOwner(), branch.getName());
job.onCreatedFromScratch();
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't like this, but if I remove it then I get:

Dec 04, 2015 12:31:02 PM hudson.model.Executor finish1
SEVERE: Executor threw an exception
java.lang.AssertionError
    at jenkins.model.lazy.LazyBuildMixIn.createBuildRunMap(LazyBuildMixIn.java:139)
    at jenkins.model.lazy.LazyBuildMixIn.onCreatedFromScratch(LazyBuildMixIn.java:96)
    at hudson.model.AbstractProject.onCreatedFromScratch(AbstractProject.java:310)
    at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder$1.created(ComputedFolder.java:171)
    at jenkins.branch.MultiBranchProject$1.observe(MultiBranchProject.java:351)
    at jenkins.scm.impl.SingleSCMSource.retrieve(SingleSCMSource.java:99)
    at jenkins.scm.api.SCMSource.fetch(SCMSource.java:143)
    at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:295)
    at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:151)
    at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:106)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)

Any idea?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure, something you need to debug. The Javadoc for newInstance explicit forbids you from calling onCreatedFromScratch, since this is called by MultiBranchProject.

@amuniz
Copy link
Member Author

amuniz commented Dec 4, 2015

Added a test. If the fix is commented out, the test fails // @recena @jglick

synchronized (rootDir) {
int limit = 0;
while (limit < 5) {
rootDir.wait(1000);
Copy link
Member

Choose a reason for hiding this comment

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

Huh?? Who is notifying a File?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nobody, it just waits for 1 second (5 in total) for the message to appear, then returns or assert unconditionally.

Copy link
Member

Choose a reason for hiding this comment

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

🐜 So why not use Thread.sleep?

@jglick
Copy link
Member

jglick commented Dec 4, 2015

🐛 for the stray call to onCreatedFromScratch.

@amuniz
Copy link
Member Author

amuniz commented Dec 4, 2015

@jglick

bug for the stray call to onCreatedFromScratch.

Caught! 😄 Mockito.spy on FreestyleProject was mocking the call to onCreatedFromScratch too, which is obviously not desired.

@@ -65,7 +75,23 @@ public void configRoundTrip() throws Exception {
assertEquals(MockFactory.class, projectFactories.get(0).getClass());
assertEquals(MockFactory.class, projectFactories.get(1).getClass());
}
@TestExtension("configRoundTrip")

@Test
Copy link
Member

Choose a reason for hiding this comment

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

🐜 missing @Issue

@jglick
Copy link
Member

jglick commented Dec 4, 2015

🐝

@amuniz
Copy link
Member Author

amuniz commented Dec 9, 2015

@reviewbybees done

jglick added a commit that referenced this pull request Dec 9, 2015
[JENKINS-31516] Run re-index on children on organization re-index
@jglick jglick merged commit e1cf1f4 into jenkinsci:master Dec 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants