-
Notifications
You must be signed in to change notification settings - Fork 528
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-51627] the code was just plain wrong and ugly :) #1745
Conversation
The code attempted to make sure that only one "Try BlueOcean" action was shown butno one looked at the reason why multiple where shown. The reason that multiple actions where shown was a bug in core that affected Queue.Items and their subclasses. Given that almost all Queue.Items have no page of their own there is little point in creating an Action for them (and this solves the fact that they get persisted and then shown for a AbstractBuild. In the case they are already persisted we just replace the action with an invisibleAction such that the only rendered "Try Blue" will be the one created afresh from the TransientActionFactory
As noted in this PR, its untested so please do not merge. We need to first test it works for all 'Open BlueOcean' links. |
@vivek to be clear, the same approach has been used internally, so it is not completely untested (it is just not tested for BlueOcean) |
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.
@jtnord Thanks for the PR, before we merge, it needs testing to ensure no regressions and it does what its supposed to do :)
@jtnord Good to know, guess work in progress label is not needed in that case. Lets merge it after more testing. |
return DoNotShowPersistedBlueOceanUrlActions.INSTANCE; | ||
} | ||
|
||
private static final class DoNotShowPersistedBlueOceanUrlActions extends InvisibleAction { |
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.
@jtnord Build is failing as jacoco wants 100% class coverage.
[WARNING] Rule violated for bundle blueocean-rest-impl: classes missed count is 1.00, but expected maximum is 0.00
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.
Code looks good. Lets get it properly tested and then we can merge it.
|
||
@Test | ||
public void testMigration() { | ||
BlueOceanUrlObject mock = mock(BlueOceanUrlObject.class); |
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.
Awesome, thanks @jtnord .
@jtnord , I'm working on the testing following your steps, but don't see any
I'm running the "before" scenario off of blueocean/master, which works out to core 2.107.2: |
try doing the builds in classic and see if there is a difference.... |
I tried it both ways, from BO and Classic. Neither produced the This Freestyle job is nothing more than a shell step. It's config.xml is below. Any reason to suspect a different sort of job would help? I can't think of one, but stuff like that still surprises me occasionally.
|
Not able to recreate using classic-only. Here's the project itself, just a simple shell step in a freestyle job:
Here are the
|
Same issue with a freestyle job which is only ever run from within Blue Ocean (i.e., create the job from Classic, immediately switch, and hit the "Run" button when it tells you it's never been run before). |
@jtnord @kshultzCB ping |
I was never able to recreate the issue as originally described while running from master. So, I switched to James' branch (
|
@kshultzCB Reading James's notes, we should at least see one blueAction, no? Did you try on UI, do you see Open blueocean button - one and only one instance on different classic page, dashboard, job page, specific run page etc.? |
Running this branch:
Running from master:
|
you may not be able to see any actions persisted as you are removing them. Not all ModelObjects allow removal of actions (hence the ugly Anything that does a
is bad code. |
@jtnord So what @kshultzCB described is ok behavior? Karl already confirmed functionally it looks good. I am trying to get sense if its ready to merge. |
@vivek yes the behaviour is OK. |
Got OK from @kshultzCB, its ready to be merged. |
See JENKINS-51627.
Tidy up the code that prevents multiple "try blue" actions from showing.
The code attempted to make sure that only one "Try BlueOcean" action was shown butno one looked at the reason why multiple where shown.
The reason that multiple actions where shown was a bug in core that affected Queue.Items and their subclasses. Given that almost all Queue.Items have no page of their own there is little point in creating an Action for them (and this solves the fact that they get persisted and then shown for a AbstractBuild.
In the case they are already persisted we just replace the action with an invisibleAction such that the only rendered "Try Blue" will be the one created afresh from the TransientActionFactory
NOtes to tester (this is untested). TO verify run the existing code and create a freestyle job.
build it multiple times.
stop jenkins and validate in the build.xml you have multiple blueActions defined.
start jenkins and update the code to the version contained here.
restart jenkins and do a few more builds.
check the old builds just have one BLue Action shown. check the new builds have one blue action shown.
Submitter checklist
Reviewer checklist