Skip to content

Commit

Permalink
Helpful response if no jobs found
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Jul 26, 2017
1 parent b0fad3a commit ff35149
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Generic Webhook Plugin Changelog
Changelog of Generic Webhook Plugin.
## Unreleased
### No issue

**doc**


[b0fad3a4ff5f110](https://github.com/jenkinsci/generic-webhook-trigger-plugin/commit/b0fad3a4ff5f110) Tomas Bjerre *2017-07-26 04:15:15*


## 1.16 (2017-07-25 18:10:46)
### GitHub [#13](https://github.com/jenkinsci/generic-webhook-trigger-plugin/issues/13) Generic Webhook hook stops working on v1.15 *bug*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
@Extension
public class GenericWebHookRequestReceiver extends CrumbExclusion implements UnprotectedRootAction {

private static final String NO_JOBS_MSG =
"Did not find any jobs to trigger! "
+ "The user invoking /generic-webhook-trigger/invoke must have read permission to any jobs that should be triggered. "
+ "You may try adding http://user:passw@url... "
+ "or configuring and passing an authentication token like ...trigger/invoke?token=TOKENHERE";
private static final String URL_NAME = "generic-webhook-trigger";
private static final Logger LOGGER =
Logger.getLogger(GenericWebHookRequestReceiver.class.getName());
Expand Down Expand Up @@ -70,15 +75,11 @@ HttpResponse doInvoke(
String token) {

List<FoundJob> foundJobs = JobFinder.findAllJobsWithTrigger(token);
Map<String, String> triggerResults = new HashMap<>();
if (foundJobs.isEmpty()) {
LOGGER.log(
INFO,
"Did not find any jobs to trigger! "
+ "The user invoking /generic-webhook-trigger/invoke must have read permission to any jobs that should be triggered. "
+ "You may try adding http://user:passw@url... "
+ "or configuring and passing an authentication token like ...trigger/invoke?token=TOKENHERE");
LOGGER.log(INFO, NO_JOBS_MSG);
triggerResults.put("ANY", NO_JOBS_MSG);
}
Map<String, String> triggerResults = new HashMap<>();
for (FoundJob foundJob : foundJobs) {
try {
LOGGER.log(INFO, "Triggering " + foundJob.getFullName());
Expand Down

0 comments on commit ff35149

Please sign in to comment.