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
Allow Commit Notifications to be used as Workflow Build Steps. #102
Allow Commit Notifications to be used as Workflow Build Steps. #102
Conversation
arthurschreiber
commented
Dec 16, 2015
Right, that was i worked on, @jglick that what you missed for workflow support. |
Yeah, so this allows the two commit notification build steps to be used in the workflow plugin. The changes are super simple, and a quick (if possible) release would make me very happy. 😄 |
@arthurschreiber i would like wait @jglick review. |
@arthurschreiber can you write an example of wf script with this steps? |
@lanwen Here's an example workflow script that I'm using together with these changes: node {
checkout scm
step([$class: 'GitHubSetCommitStatusBuilder'])
catchError {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
sh('script/cibuild')
}
}
step([$class: 'GitHubCommitNotifier', resultOnFailure: 'FAILURE'])
} |
I think there is something not working quite yet - and I believe this is because the |
Okay, the following workflow script does the trick: node {
checkout scm
step([$class: 'GitHubSetCommitStatusBuilder'])
echo "${currentBuild.result}"
try {
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
sh('script/cibuild')
}
currentBuild.result = 'SUCCESS'
} catch (err) {
currentBuild.result = 'FAILURE'
}
step([$class: 'GitHubCommitNotifier', resultOnFailure: 'FAILURE'])
} |
So workflow doesn't set run results? Smells like a workflow bug. |
@KostyaSha Not quite. In case the When using a |
That's unexpected way of workflow logic, step was performed on build but didn't set it's result (btw many plugins setting results directly). For non-standard cases i would expected save result state before execution and setting it back in case of skipping step execution. |
From https://github.com/jenkinsci/workflow-plugin/blob/master/basic-steps/CORE-STEPS.md:
|
@arthurschreiber thanks for info. |
@KostyaSha Maybe implementing a |
BuildWrapper doesn't allow you specify the step/place when you want set status. And people may have cases when they don't want set |
@arthurschreiber Can you rebase it? I'll going to merge this pr |
Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests. |
097333f
to
568e889
Compare
568e889
to
731ffae
Compare
@lanwen I just rebased and pushed again. Please have a look. |
…upport Allow Commit Notifications to be used as Workflow Build Steps.
Thanks! |
The PR seems fine so far as it goes, but yes in general it can be awkward to use publishers which depend on the current build’s result; BTW currentBuild.result = 'SUCCESS' is a no-op. |
@jglick Writing workflow steps (or what class do you mean?) means killing other job types. Publishers and Builders will exist and handling results is step back to complex configurations and bad user experience. |
@KostyaSha @lanwen Can you release a new version with the merged changes? ❤️ |
That is not really true, from what I can see. Even after executing a |
@arthurschreiber sorry for the delay, was on NY vacation. |
released as 1.15.0 |
@lanwen Thank you! |
I just tried this and must say it works! Nice job. However, I was trying to use the new custom context feature (#100) and it does not work for me. It works for me with normal jobs, but not with workflow. Can someone confirm it works and it is just on my side? |
@mikz How did u try to use context feature with wf? |
The same way as normal projects. Turning on the I have two builds, |
@mikz Please fill JIRA issue with |
Didn't get what you are doing, but having standard builds and (especially) |
Unfortunately, Workflow job can't be used with ghprb. I'd love to have them in one. https://issues.jenkins-ci.org/browse/JENKINS-26591 |
@mikz you can try https://github.com/jenkinsci/github-integration-plugin Workflow support in master, i will do one more beta release in evening, any testing would be appreciate, because i can't test all cases. |