-
Notifications
You must be signed in to change notification settings - Fork 411
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
improve 'started' message with proper cause #37
Conversation
Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests |
Can you please expand upon what this is for? I guess I'll start maintaining this plugin. I don't have any experience developing Jenkins plugins but if I can get my own environment set up and learn to release then I'll do it. This may take about a week. |
I want the actual cause to be in the notification, but before this changeset the cause is incorrect. The notification message would say that the build was "started by changes" even if it was actually started by a human clicking "build". So now the cause is accurate. |
Thanks for elaborating. |
Candidate for merge means I will first merge your change locally, compile locally, and test locally in Jenkins before merging. |
@@ -14,7 +14,7 @@ | |||
<parent> | |||
<groupId>org.jenkins-ci.plugins</groupId> | |||
<artifactId>plugin</artifactId> | |||
<version>1.447</version> | |||
<version>1.567</version> |
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.
What does updating this do? Does it specify the minimum version of Jenkins?
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 realize this is upgrading the version in which unit tests are run against. Can you confirm my assumption?
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.
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.
Thanks for clarifying @daniel-beck.
I merged this and tested it; I couldn't see the difference between before and after. Can you give me a scenario where I can reproduce the old behavior and see the new behavior post-merge? |
@jackbowman I've merged so many other PRs that the current master conflicts pretty hard with your changes. Can you pull the latest changes from master into your request? Here's how I attempted to do it. The following commands are from the slack plugin git repository on my system. #pull in latest changes
git fetch
#a5d6d04 is a point before I performed dos2unix
git checkout a5d6d04
#download PR #37 and merge it
git ls-remote origin | grep 37
git fetch origin refs/pull/37/head
git merge FETCH_HEAD
#resolve the conflicts in ActiveNotifier.java and then run dos2unix
dos2unix src/main/java/jenkins/plugins/slack/ActiveNotifier.java
#all conflicts have been resolved so add all files
git add .
#conclude the merge
git commit
#I am assuming origin/master is this upstream repository https://github.com/jenkinsci/slack-plugin
git merge origin/master
#at this point there's significant merge conflicts that I can't resolve them myself. I had to merge this from an earlier point because I performed Run |
@jackbowman I plan to release slack plugin 1.7 this weekend. If you would like your change to make it into that release then please resolve the conflicts before the weekend so I can merge it. |
I'll try to do this before the weekend. |
If not then it can make it into the next release. I'll try to maintain a monthly release schedule if there's any pull requests that have been made. |
Ok, I don't think I'll have time to merge before you release 1.7. Thanks for keeping me up to date. |
Jack, you can make it much easier if you convert all CRLF's in your conflicting files to simple LF's first, then pull from master. |
I think that even if the build is started manually, the list of pending changes - if any - should still be shown in the start notification, because you may want to know what is being built anyway... I'd remove the return statement at the end in your (scmCause == null) test. |
Since the release is delayed due to #47 if you rebase and resolve the conflicts you might still make it in before the 1.7 release. |
Before, the started message would say the build had been 'started by changes ...' if a user started a build when there were changes to be pulled in. Now if a user starts the build, it will always say 'started by user', but if a user didn't start the build, it will still show the changes.
I rebased the change. You can observe the changes introduced by this plugin by following these steps:
Before this commit, step 6 has a different result ("test - #1 Started by changes from [...]"). peergum suggested always including the changes (removing the return statement in this change), but for my use case I don't actually want that; the changes are irrelevant to me I just want to know that someone manually started the build. |
I'll compile and test this later. If all is well this will be the next thing I merge. |
Any specific change to one individual may not necessary be good for others... the idea is to keep compatibility with the existing way things work. In this specific case, someone might start the build manually, but it will still include the changes and so people won't be informed about the changes being built... For the note, if this gets merged as is, it will be the second time a specific update prevails over the common goal, and I'll start forking and maintaining my own slack-plugin repo. |
@peergum what was the first time? Threatening to fork is not very productive. If there's something you wish to happen then opening a pull request is more productive. Also, what needs to be changed in this PR that would otherwise break compatibility? |
I'm all for looking for the common goal. Let's talk use cases. I've no intent to bust things for other people here. When my build/test servers are running along, everything happens automatically and so no build has to be triggered by a human. But inevitably something goes wrong, or there is an action that is not automated and a human has to decide when to do it. In that case, I think the important thing is always what human has decided to issue the command. Hence this changeset. Now, I suppose the counter argument is that you still want to know what changes are being built/tested/deployed anyway, when a human takes an action. I kind of see that, but I don't want the slack plugin to produce a lot of spam in chat. There may be a lot of changes that are irrelevant to the overall action (i.e. "Jack ran [Deploy internal tool X]".) Chat does not need a long list of changesets. If someone wants to read them, they can click the link. It could be an option, to please both of us, and it kind of already is because have this option "Show Commit List with Titles and Authors". Let me know what you think. |
I'll defer to @peergum on that. I don't use the plugin and only maintain it. So it would be better to get his, and perhaps others' perspectives on what they want to get out of this. |
I'll let this pull request incubate a few more days for feedback. If nobody pipes up then I'll set this to be merged and eventually merge it. |
MessageBuilder message = new MessageBuilder(notifier, build); | ||
message.append(causeAction.getShortDescription()); | ||
notifyStart(build, message.appendOpenLink().toString()); | ||
return; |
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.
Since this is a public void
function I will remove the return
statement as @peergum had mentioned earlier post-merge. I realize that it's not actually returning anything but I think it's a little cleaner. I'm doing this as post-merge to expedite merging your change.
@jackbowman I realize after reading up that |
Well, it changes the behavior of the function! So you should be careful about doing that in general, we can't just arbitrarily remove return statements. However, it's what peergum thought was better for everyone anyway, and I don't mind so much. So, maybe he'll be happy and I won't care :) |
Yeah, thanks for the advice. I'll be more patient about waiting for feedback. In reality, I didn't see a good reason one way or another. |
Before, the started message would say the build had been 'started
by changes ...' if a user started a build when there were changes
to be pulled in.
Now if a user starts the build, it will always say 'started by user',
but if a user didn't start the build, it will still show the changes.