-
Notifications
You must be signed in to change notification settings - Fork 399
Ignorable pusher #58
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
Open
aderigs
wants to merge
47
commits into
jenkinsci:master
Choose a base branch
from
OpenDataSpace:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ignorable pusher #58
Changes from 4 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
f4009b5
specifies an ignorable pusher
891455a
specifies an ignorable pusher
f84123f
documents ignorable pusher
1494279
Merge branch 'stable'
985cc73
fixes breaking of backward compatibility caused by the implementation…
be4c874
Merge branch 'stable'
784abc6
fixes access to ignorable pusher
f5b2488
Merge branch 'stable'
0ce901a
fixes needless line deletion
23abd4a
fixes NPE if regex for ignorable pusher is null
fa122af
Merge branch 'stable'
9bcadfa
[maven-release-plugin] prepare for next development iteration
KostyaSha 93cb2f9
don't run cleaner if we don't manage hooks
lanwen b6e21f1
throw config exception on empty jenkins root url
lanwen f4f6525
[maven-release-plugin] prepare release github-1.13.1
KostyaSha 2f684d0
[maven-release-plugin] prepare for next development iteration
KostyaSha f0a971f
check hook url for override before checking jenkins default url
lanwen c4657a2
[maven-release-plugin] prepare release github-1.13.2
KostyaSha 0dbb10d
[maven-release-plugin] prepare for next development iteration
KostyaSha 73b60b4
fixes typo
b10ad38
[FIXES JENKINS-30223] return back com.cloudbees.jenkins.Credential
lanwen 28cb051
[maven-release-plugin] prepare release github-1.13.3
lanwen f4b6e2e
Merge tag 'github-1.13.3' into stable
7cc6f54
fixes constructor parameter name (@DataBoundConstructor)
4d7c47f
Merge branch 'stable'
6763575
Merge remote-tracking branch 'upstream/master'
6a52fdc
Merge remote-tracking branch 'upstream/master'
6990b83
Merge remote-tracking branch 'upstream/master'
082ed8c
fixes SonarQube issues
72d1013
turns logic of ignoring a pusher to avoid further mocking
02157bc
Merge remote-tracking branch 'upstream/master'
0567134
Merge remote-tracking branch 'upstream/master'
33473e9
Merge remote-tracking branch 'upstream/master'
57f1f57
Merge remote-tracking branch 'upstream/master'
28e9481
Merge remote-tracking branch 'upstream/master'
7a68f89
Merge remote-tracking branch 'upstream/master'
6f52adc
Merge remote-tracking branch 'upstream/master'
4fc39e2
merges config.jelly into config.groovy
e985ff1
Merge remote-tracking branch 'upstream/master'
ddd4d67
Merge remote-tracking branch 'upstream/master'
49c1e3a
Merge remote-tracking branch 'upstream/master'
9802aa1
Merge remote-tracking branch 'upstream/master'
07bd103
Merge remote-tracking branch 'upstream/master'
79d37a0
Merge remote-tracking branch 'upstream/master'
b2daf8b
Merge remote-tracking branch 'upstream/master'
830e436
Merge remote-tracking branch 'upstream/master'
b1d8812
Merge remote-tracking branch 'upstream/master'
aderigs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/config.jelly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
| <f:entry title="${%github.ignorablePusher}" help="/descriptor/com.cloudbees.jenkins.GitHubPushTrigger/help/ignorablePusher"> | ||
| <f:textbox name="github.ignorablePusher" value="${instance.ignorablePusher}" /> | ||
| </f:entry> | ||
| </j:jelly> |
1 change: 1 addition & 0 deletions
1
src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/config.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| github.ignorablePusher=Ignorable pusher |
1 change: 1 addition & 0 deletions
1
src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/config_de.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| github.ignorablePusher=Ignorierbarer Pusher |
3 changes: 3 additions & 0 deletions
3
src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help-ignorablePusher.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <div> | ||
| This defines a regular expression to which the name or email of an ignorable pusher is to be matched. Such a push wil be ignored. Normally a preceding push of Jenkins him self could be prevented that way. | ||
| </div> |
3 changes: 3 additions & 0 deletions
3
src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help-ignorablePusher_de.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <div> | ||
| Hier wird ein regulärer Ausdruck definiert, der zu dem Namen oder der E-Mail eines ignorierbaren Pushers paßt. Solch ein Push wird ignoriert. Üblicherweise kann kann auf diese Weise damit ein vorhergehender Push von Jenkins selber verhindert werden. | ||
| </div> |
84 changes: 84 additions & 0 deletions
84
src/test/java/com/cloudbees/jenkins/GitHubPushTriggerTestCase.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| package com.cloudbees.jenkins; | ||
|
|
||
| import static org.junit.Assert.assertEquals; | ||
| import static org.junit.Assert.assertNull; | ||
| import hudson.model.FreeStyleProject; | ||
| import hudson.plugins.git.GitSCM; | ||
| import hudson.scm.SCM; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.OutputStream; | ||
| import java.net.HttpURLConnection; | ||
| import java.net.URL; | ||
| import java.nio.charset.StandardCharsets; | ||
|
|
||
| import org.junit.Rule; | ||
| import org.junit.Test; | ||
| import org.jvnet.hudson.test.JenkinsRule; | ||
|
|
||
| import com.cloudbees.jenkins.GitHubPushTrigger.DescriptorImpl; | ||
|
|
||
| /** | ||
| * @author <a href = "mailto:achim.derigs@graudata.com">Achim Derigs</a> | ||
| */ | ||
| public final class GitHubPushTriggerTestCase { | ||
|
|
||
| @Rule | ||
| public final JenkinsRule j = new JenkinsRule(); | ||
|
|
||
| private static void triggerWebHook(final String repositoryUrl, final String pusherName) | ||
| throws IOException { | ||
|
|
||
| final DescriptorImpl descriptor = DescriptorImpl.get(); | ||
| final URL url = descriptor.getHookUrl(); | ||
| final HttpURLConnection connection = (HttpURLConnection) url.openConnection(); | ||
| connection.setRequestMethod("POST"); | ||
| connection.setDoOutput(true); | ||
| connection.connect(); | ||
|
|
||
| final String payload = "payload={\"repository\":{\"url\":\"" + repositoryUrl | ||
| + "\"},\"pusher\":{\"name\":\"" + pusherName + "\",\"email\":\"\"}}"; | ||
|
|
||
| final OutputStream stream = connection.getOutputStream(); | ||
|
|
||
| try { | ||
| stream.write(payload.getBytes(StandardCharsets.UTF_8)); | ||
| } finally { | ||
| stream.close(); | ||
| } | ||
|
|
||
| assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode()); | ||
| } | ||
|
|
||
| @Test | ||
| public void trigger() throws IOException { | ||
| final String repositoryUrl = "https://github.com/OpenDataSpace/parent"; | ||
| final SCM scm = new GitSCM(repositoryUrl); | ||
| final FreeStyleProject project = j.createFreeStyleProject(); | ||
| project.setScm(scm); | ||
|
|
||
| final String expected = System.getProperty("user.name"); | ||
| final GitHubPushTrigger trigger = new GitHubPushTrigger(); | ||
| project.addTrigger(trigger); | ||
| triggerWebHook(repositoryUrl, expected); | ||
|
|
||
| final String actual = trigger.pushBy(); | ||
| assertEquals(expected, actual); | ||
| } | ||
|
|
||
| @Test | ||
| public void ignore() throws IOException { | ||
| final String repositoryUrl = "https://github.com/OpenDataSpace/parent"; | ||
| final SCM scm = new GitSCM(repositoryUrl); | ||
| final FreeStyleProject project = j.createFreeStyleProject(); | ||
| project.setScm(scm); | ||
|
|
||
| final String pusherName = System.getProperty("user.name"); | ||
| final GitHubPushTrigger trigger = new GitHubPushTrigger(pusherName); | ||
| project.addTrigger(trigger); | ||
| triggerWebHook(repositoryUrl, pusherName); | ||
|
|
||
| final Object object = trigger.pushBy(); | ||
| assertNull(object); | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this breaks backward compatibility