From 601eb56c22421ee58c34e41ac621533646d1ea71 Mon Sep 17 00:00:00 2001 From: MerkushevKirill Date: Wed, 15 Jul 2015 22:44:34 +0300 Subject: [PATCH 1/2] Mention about admin:repo_hook scope for credentials --- .../com/cloudbees/jenkins/GitHubPushTrigger/help-auto.jelly | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help-auto.jelly b/src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help-auto.jelly index 8313adb99..067dac634 100644 --- a/src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help-auto.jelly +++ b/src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/help-auto.jelly @@ -3,7 +3,9 @@
In this mode, Jenkins will add/remove hook URLs to GitHub based on the project configuration of Jenkins. Jenkins has a single post-commit hook URL for all the repositories, and this URL will be added to - all the GitHub repositories Jenkins is interested in. + all the GitHub repositories Jenkins is interested in. You should provide credentials with scope + admin:repo_hook for every repo which should be managed by Jenkins. It needs to read current list of hooks, + create new hooks and remove old.

This URL is ${app.rootUrl}github-webhook/, From 5d0b38bafa6f125fa306f7db9c0c3626e38a5077 Mon Sep 17 00:00:00 2001 From: MerkushevKirill Date: Wed, 15 Jul 2015 22:45:10 +0300 Subject: [PATCH 2/2] use slf4j style template for logging in gh-webhook class --- src/main/java/com/cloudbees/jenkins/GitHubWebHook.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/cloudbees/jenkins/GitHubWebHook.java b/src/main/java/com/cloudbees/jenkins/GitHubWebHook.java index 1fc49328f..be362f26c 100644 --- a/src/main/java/com/cloudbees/jenkins/GitHubWebHook.java +++ b/src/main/java/com/cloudbees/jenkins/GitHubWebHook.java @@ -149,14 +149,14 @@ private Function reRegisterHookForJob() { return new Function() { @Override public AbstractProject apply(AbstractProject job) { - LOGGER.debug("Calling registerHooks() for {0}", notNull(job, "Job can't be null").getFullName()); + LOGGER.debug("Calling registerHooks() for {}", notNull(job, "Job can't be null").getFullName()); // We should handle wrong url of self defined hook url here in any case with try-catch :( URL hookUrl; try { hookUrl = Trigger.all().get(GitHubPushTrigger.DescriptorImpl.class).getHookUrl(); } catch (GHPluginConfigException e) { - LOGGER.error("Skip registration of GHHook ({0})", e.getMessage()); + LOGGER.error("Skip registration of GHHook ({})", e.getMessage()); return job; } Runnable hookRegistrator = forHookUrl(hookUrl).registerFor(job);