Skip to content

StashBuilds.java : try again before asking to "PLEASE SET JENKINS ROOT URL… #26

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Jan 24, 2019

Conversation

jimklimov
Copy link

@jimklimov jimklimov commented Sep 19, 2018

…FROM GLOBAL CONFIGURATION"

https://stackoverflow.com/questions/30355079/jenkins-setting-root-url-via-groovy-api was helpful :)

Note: apparently, jenkinsci/jenkins@c3988aa#diff-1439884ddd002c6ca6463d9657412b15 from Aug 18 2018 broke the earlier working setups, since the constructors doing load() were removed with it. Which sort of contradicts some discussion threads from much earlier ages, that the constructor makes a new empty object so a get() of existing config should be done. But not being much of a Java developer, I might read it wrong... still, it matches our server's mis-behavior starting a few weeks ago after an update.

@jimklimov
Copy link
Author

In site-local testing, this patch did fix our issue. We see links to particular builds in [BUILD SUCCESS] parts of the Stash comments again :)

@jimklimov
Copy link
Author

In the end, the solution recommended with discussion in jenkinsci/jenkins#3570 (comment) was to just access the data using get() and avoiding new; PR updated accordingly and worked with our Jenkins 2.142 deployment.

@jimklimov
Copy link
Author

Technically, nemccarthy#149 is almost identical, but with a null-ness guard seems to be one line better :)

@jakub-bochenski
Copy link

but with a null-ness guard seems to be one line better

@jimklimov it's pointless to do a null check on a @Nonnull value

@jimklimov
Copy link
Author

@jakub-bochenski : Just in case, did you verify since when is the value marked as @Nonnull?

My concern here is if the older Jenkins core (as in "compatible-since" metadata of the plugin) already has that, or the double-check is warranted there?

@jakub-bochenski
Copy link

@jimklimov good catch, apparently this has only been changed in April jenkinsci/jenkins@79ec930#diff-1439884ddd002c6ca6463d9657412b15

@proski
Copy link

proski commented Jan 7, 2019

Can someone merge it and make a release, please! Even the stable Jenkins branch is at 2.150.1, which requires this fix.

@jakub-bochenski
Copy link

jakub-bochenski commented Jan 7, 2019

@proski no, nobody can
Edit: I could swear i posted this link before but apparently I didn't. Sorry, here is the jenkins-dev thread:
https://groups.google.com/forum/m/?utm_medium=email&utm_source=footer#!msg/jenkinsci-dev/oRBRP5-sZe4/9N44G__mDgAJ

Make noise there if you want to make a difference.

@proski
Copy link

proski commented Jan 7, 2019

Done (the message is pending approval). Thank you for stepping up!

@dawidmalina
Copy link

Hopefully soon @jakub-bochenski will be a new project maintainer 👍

@batmat
Copy link
Member

batmat commented Jan 11, 2019

Processing the request to become maintainer, BTW, I'm thinking: given you apparently submitted many PRs here @jimklimov, would be interested too to become co-maintainer with @jakub-bochenski ?

@@ -49,7 +49,9 @@ public void onCompleted(AbstractBuild build, TaskListener listener) {
return;
}
Result result = build.getResult();
JenkinsLocationConfiguration globalConfig = new JenkinsLocationConfiguration();
// Note: current code should no longer use "new JenkinsLocationConfiguration()"
Copy link
Member

Choose a reason for hiding this comment

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

I would recommend removing this comment seems like it adds no value, the reasoning behind the change can be in the commit message or the PR

Copy link
Author

Choose a reason for hiding this comment

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

Well, to many newcomers (like myself not so long ago) the code is the documentation. A removed line carries no visibility to git blame, not that many people dig in that at all, and a checked-out workspace or a fork has no data from PR discussions. For this particular piece of code, I found too many examples collecting dust on the internet over many years proposing the new way to get the config, that without the comment someone might be eager to make this particular mistake again.

@jakub-bochenski
Copy link

Processing the request to become maintainer, BTW, I'm thinking: given you apparently submitted many PRs here @jimklimov, would be interested too to become co-maintainer with @jakub-bochenski ?

That would be great. As mentioned I don't plan to actively develop the plugin, only fix the most annoying defects.

@jimklimov
Copy link
Author

What @jakub-bochenski said :) +1

@batmat
Copy link
Member

batmat commented Jan 11, 2019

You've both been granted permissions. Thanks again for stepping up!

jovandeginste pushed a commit to jenkinsci/mattermost-plugin that referenced this pull request Jan 16, 2019
@jakub-bochenski jakub-bochenski self-requested a review January 23, 2019 15:50
Copy link

@jakub-bochenski jakub-bochenski left a comment

Choose a reason for hiding this comment

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

Let's merge it once build has passed

@jakub-bochenski
Copy link

I guess we need to rebase the branch vs. master for the build to happen

JenkinsLocationConfiguration globalConfig = new JenkinsLocationConfiguration();
// Note: current code should no longer use "new JenkinsLocationConfiguration()"
// as only one instance per runtime is really supported by the current core.
JenkinsLocationConfiguration globalConfig = JenkinsLocationConfiguration.get();

Choose a reason for hiding this comment

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

We need to add a null check or upgrade to newer jenkins dependency.

My vote is for the former, since the later would reduce compatibility.

@jakub-bochenski jakub-bochenski merged commit 84bbeb8 into jenkinsci:master Jan 24, 2019
@emangual
Copy link

@jakub-bochenski Are you guys planning on releasing a new version of the stash-pullrequest-builder-plugin now that this PR has been merged?

@jakub-bochenski
Copy link

jakub-bochenski commented Jan 30, 2019

Yes, you can expect a release soon.

@jimklimov no pressure, but could you take a look at #36 #37 #38 ? Those are simple changes, I'd prefer to release with a clean project descriptor.

@jimklimov
Copy link
Author

Hope I can, but currently preoccupied with other topics on fosdem. So likely next week.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants