github-plugin
github-plugin copied to clipboard
Ignorable pusher
This defines a regular expression to which the name or email of an ignorable pusher is to be matched. Such a push will be ignored. Normally a preceding push of Jenkins him self could be prevented that way.
This should work and be configured in GIT scm configuration.
How would you do this? The only possibility I have found would be something like "Polling ignores commits from certain users". But this would involve committers but not pushers.
@KostyaSha:
Wrong. You are confusing this with the existing featue of ignoring a commit-author. The pusher is not necessarily the committer!
Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests
Hi I think this PR solve this issue: https://issues.jenkins-ci.org/browse/JENKINS-24208 I missed this PR and I create another one https://github.com/jenkinsci/github-plugin/pull/83 (probably more basic then this one)
@KostyaSha It can not be done in GIT scm configuration, have look at jira comment.
Anyway if you can validate this PR or mine, it's critical for our jenkins/github dev. pipeline
Regards Christophe
When this should be merged?
This will be never merged it current state, because of it provides only one case of filtering push (there is same for branches, committers, titles). But it still open because of its a good idea and not bad implementation. But we beed some more common implementation of filtering feature.
You can use hpi from the jenkins build to use this custom implementation (thanks @aderigs for rebasing)
What about using the Run Condition Plugin to support all kinds of filtering?
You can solve this issue by using intermediate decider
job that can do additional verification and trigger real builds.
Pushers need to be implemented in more generic security API. API will be clear when you implement all possible gh triggers. I started this work in https://github.com/jenkinsci/github-integration-plugin .
@lanwen on other hand this 'hook -> gitscm poll' trigger wouldn't fit in any good APIs so probably such feature may be added to this trigger. But everything should be localised somewhere in code unique to this trigger.
Keeping in mind that gh utilises git polling log i can suggest try set exclusions using git configuration features (i.e. user exclusions). It wouldn't use gh names, but should work fine if people setting right names in git commits.
When I install the plugin with this change I don't see where to configure the new configuration!
Yes. The last version has introduced src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/config.groovy which hides src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/config.jelly. I think the clean way would be to migrate config.jelly into the new config.groovy. But I do not know how to do this.
the groovy file should be:
package com.cisco.jenkins.GitHubPushTrigger
import com.cisco.jenkins.GitHubPushTrigger
def f = namespace(lib.FormTagLib);
tr {
td(colspan: 4) {
f.entry(title: _("Ignorable Pusher"), field: "ignorablePusher") {
f.textbox()
}
}
}
script(src: "${rootURL}${h.getResourcePath()}/plugin/github/js/warning.js")
script {
text("""
InlineWarning.setup({
id: 'gh-hooks-warn',
url: ${descriptor.getCheckMethod('hookRegistered').toCheckUrl()},
input: 'input[name="${GitHubPushTrigger.class.getName().replace(".", "-")}"]'
}).start();
""")
}
Codecov Report
Merging #58 into master will increase coverage by
0.01%
. The diff coverage is73.68%
.
@@ Coverage Diff @@
## master #58 +/- ##
==========================================
+ Coverage 75.07% 75.08% +0.01%
==========================================
Files 64 64
Lines 1412 1425 +13
Branches 146 149 +3
==========================================
+ Hits 1060 1070 +10
+ Misses 307 306 -1
- Partials 45 49 +4
Impacted Files | Coverage Δ | |
---|---|---|
...bhook/subscriber/DefaultPushGHEventSubscriber.java | 82.14% <66.66%> (ø) |
:arrow_up: |
.../java/com/cloudbees/jenkins/GitHubPushTrigger.java | 61.24% <75%> (+0.89%) |
:arrow_up: |
src/main/java/com/cloudbees/jenkins/Cleaner.java | 22.22% <0%> (+5.55%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update c7927b4...b1d8812. Read the comment docs.
Please rebase and not merge
@KostyaSha, it's why I did
git pull --rebase origin master
But don't know why, sounds not working, maybe missing some settings ?
That message to @aderigs who owns this PR
Does this support ignoring specific commit messages as well?
No. It ignores the pusher by name or email. If you want to ignore by specific commit messages you could use the git-plugin.
I have not been able to find a solution for this using the github folder plugin, which manages webhooks, and I believe uses this plugin. It automatically sets up the job and doesn't give you anywhere to configure the SCM that was setup. I just need a way to ignore webhook triggers if a specific commit message exists. I was hoping this would solve the issue :(