Skip to content

Commit

Permalink
Adding example of ignoring push event with zero commits
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Nov 16, 2018
1 parent 108723a commit 8ba5bcd
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 2 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Generic Webhook Plugin Changelog
Changelog of Generic Webhook Plugin.
## Unreleased
### No issue

**Adding example of ignoring push event with zero commits**


[1b8e9b3a25fe7a7](https://github.com/jenkinsci/generic-webhook-trigger-plugin/commit/1b8e9b3a25fe7a7) Tomas Bjerre *2018-11-16 19:40:12*

**Example of ignoring removal or creation of branches**


[108723a32c7c5ec](https://github.com/jenkinsci/generic-webhook-trigger-plugin/commit/108723a32c7c5ec) Tomas Bjerre *2018-11-16 19:28:24*

**Documenting trigger on changed folder GitLab**


[a4713a8b6532496](https://github.com/jenkinsci/generic-webhook-trigger-plugin/commit/a4713a8b6532496) Tomas Bjerre *2018-11-15 18:13:36*


## 1.48 (2018-11-08 17:47:29)
### GitHub [#88](https://github.com/jenkinsci/generic-webhook-trigger-plugin/pull/88) Use the job's configured quiet period

Expand Down
2 changes: 0 additions & 2 deletions src/test/java/org/jenkinsci/plugins/gwt/bdd/Stepdefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import org.assertj.core.api.Assertions;
import org.jenkinsci.plugins.gwt.ExpressionType;
import org.jenkinsci.plugins.gwt.GenericVariable;
import org.jenkinsci.plugins.gwt.Renderer;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
Feature: It should be possible to trigger for GitLab push events and ignore branch creation.

Scenario: Push events happens.

Given the following generic variables are configured:
| variable | expression | expressionType | defaultValue | regexpFilter |
| object_kind | $.object_kind | JSONPath | | |
| after | $.after | JSONPath | | |
| total_commits_count | $.total_commits_count | JSONPath | | |
| ref | $.ref | JSONPath | | |
| git_ssh_url | $.repository.git_ssh_url | JSONPath | | |

Given filter is configured with text: $object_kind $after $total_commits_count
Given filter is configured with expression: ^push\s.{40}\s[^0].*


When received post content is:
"""
{
"object_kind": "push",
"after": "f34c80f418afb802094f1ba42ad0ec1a20c7a02s",
"ref": "refs/heads/master",
"total_commits_count": 0,
"repository":{
"git_ssh_url":"git@example.com:mike/diaspora.git",
}
}
"""
Then the job is not triggered
Then variables are resolved to:
| variable | value |
| object_kind | push |
| after | f34c80f418afb802094f1ba42ad0ec1a20c7a02s |
| total_commits_count | 0 |
| ref | refs/heads/master |
| git_ssh_url | git@example.com:mike/diaspora.git |


When received post content is:
"""
{
"object_kind": "push",
"after": "f34c80f418afb802094f1ba42ad0ec1a20c7a02s",
"ref": "refs/heads/master",
"total_commits_count": 1,
"repository":{
"git_ssh_url":"git@example.com:mike/diaspora.git",
}
}
"""
Then the job is triggered
Then variables are resolved to:
| variable | value |
| object_kind | push |
| after | f34c80f418afb802094f1ba42ad0ec1a20c7a02s |
| total_commits_count | 1 |
| ref | refs/heads/master |
| git_ssh_url | git@example.com:mike/diaspora.git |


When received post content is:
"""
{
"object_kind": "push",
"after": "f34c80f418afb802094f1ba42ad0ec1a20c7a02s",
"ref": "refs/heads/master",
"total_commits_count": 10,
"repository":{
"git_ssh_url":"git@example.com:mike/diaspora.git",
}
}
"""
Then the job is triggered
Then variables are resolved to:
| variable | value |
| object_kind | push |
| after | f34c80f418afb802094f1ba42ad0ec1a20c7a02s |
| total_commits_count | 10 |
| ref | refs/heads/master |
| git_ssh_url | git@example.com:mike/diaspora.git |


When received post content is:
"""
{
"object_kind": "push",
"after": "f34c80f418afb802094f1ba42ad0ec1a20c7a02s",
"ref": "refs/heads/master",
"total_commits_count": 123,
"repository":{
"git_ssh_url":"git@example.com:mike/diaspora.git",
}
}
"""
Then the job is triggered
Then variables are resolved to:
| variable | value |
| object_kind | push |
| after | f34c80f418afb802094f1ba42ad0ec1a20c7a02s |
| total_commits_count | 123 |
| ref | refs/heads/master |
| git_ssh_url | git@example.com:mike/diaspora.git |

0 comments on commit 8ba5bcd

Please sign in to comment.