Permalink
Browse files

documentation update

  • Loading branch information...
elvanja committed Feb 25, 2014
1 parent 5b8eaf2 commit 86e982db256d3d8368ee924df8f7113404762f40
View
@@ -76,10 +76,12 @@ http://your-jenkins-server/gitlab/notify_commit
The procedure is the same as for the build now hook, the difference is that this hook schedules polling of the project, much like the original notifyCommit.
-Additional notes:
+### Notes
+
+This goes for both hook options:
* the project must be configured not to skip notifyCommit
-* parametrized projects can be polled, but subsequent build will use the default parametere values (can't propagate the branch to the polling)
+* parametrized projects can be polled, but subsequent build will use the default parameter values (can't propagate the branch to the polling)
### Delete branch commits
View
@@ -14,8 +14,6 @@
module GitlabWebHook
class Api < Sinatra::Base
- LOGGER = Logger.getLogger(Api.class.name)
-
get '/ping' do
'Gitlab Web Hook is up and running :-)'
end
@@ -37,27 +35,31 @@ class Api < Sinatra::Base
def process_projects(action)
details = parse_request
messages = details.is_delete_branch_commit? ? ProcessDeleteCommit.new.with(details) : ProcessCommit.new.with(details, action)
- LOGGER.info(messages.join("\n"))
+ logger.info(messages.join("\n"))
messages.join("<br/>")
rescue BadRequestException => e
- LOGGER.warning(e.message)
+ logger.warning(e.message)
status 400
e.message
rescue NotFoundException => e
- LOGGER.warning(e.message)
+ logger.warning(e.message)
status 404
e.message
rescue => e
- LOGGER.log(Level::SEVERE, e.message, e)
+ logger.log(Level::SEVERE, e.message, e)
status 500
e.message
end
def parse_request
details = ParseRequest.new.from(params, request)
- LOGGER.info("gitlab web hook triggered for repo url #{details.repository_url} and #{details.branch} branch")
- LOGGER.info("with payload: #{details.payload}")
+ logger.info("gitlab web hook triggered for repo url #{details.repository_url} and #{details.branch} branch")
+ logger.info("with payload: #{details.payload}")
details
end
+
+ def logger
+ @logger || Logger.getLogger(self.class.name)
+ end
end
end
@@ -13,23 +13,65 @@ class GitlabWebHookRootAction < Jenkins::Model::UnprotectedRootAction
include Jenkins::Model::DescribableNative
include Jenkins::RackSupport
- LOGGER = Logger.getLogger(GitlabWebHookRootAction.class.name)
-
display_name "Gitlab Web Hook Rotten"
icon nil # we don't need the link in the main navigation
url_path "gitlab"
- attr_accessor :conf_param
+ describe_as Java.hudson.model.Descriptor, :with => GitlabWebHookRootActionDescriptor
def call(env)
- LOGGER.info "=========== GitlabWebHookRootAction ENV ==================="
- LOGGER.info conf_param
- LOGGER.info getDescriptor.inspect
- LOGGER.info env.inspect
+ logger.info "=========== GitlabWebHookRootAction ENV ==================="
+ logger.info "getDescriptor: #{getDescriptor.inspect}"
+ logger.info "descriptor_is: #{self.class.descriptor_is.inspect}"
+ #logger.info "conf_param: #{self.class.descriptor_is.conf_param}"
+ #logger.info "conf_param: #{GitlabWebHookRootActionDescriptor.newInstance.conf_param}"
+ logger.info "env: #{env.inspect}"
GitlabWebHook::Api.new.call(env)
end
- describe_as Java.hudson.model.Descriptor, :with => GitlabWebHookRootActionDescriptor
+ def logger
+ @logger || Logger.getLogger(self.class.name)
+ end
end
+#class GitlabWebHookRootActionProxy# < Java.hudson.slaves.NodeProperty
+# include Jenkins::Model::EnvironmentProxy
+# include Jenkins::Model::DescribableProxy
+# proxy_for GitlabWebHookRootAction
+#end
+
Jenkins::Plugin.instance.register_extension(GitlabWebHookRootAction)
+
+#class GitlabWebHookRootAction < Jenkins::Model::UnprotectedRootAction
+# include Jenkins::Model
+# #include Jenkins::Model::DescribableNative
+# include Jenkins::Model::Describable
+# include Jenkins::RackSupport
+#
+# LOGGER = Logger.getLogger(GitlabWebHookRootAction.class.name)
+#
+# display_name "Gitlab Web Hook Rotten"
+# icon nil # we don't need the link in the main navigation
+# url_path "gitlab"
+#
+# class TestDescriptor < Java.hudson.model.Descriptor
+# include Jenkins::Model::Descriptor
+#
+# def isApplicable(targetType)
+# true
+# end
+# end
+#
+# def call(env)
+# LOGGER.info "=========== GitlabWebHookRootAction ENV ==================="
+# LOGGER.info "getDescriptor: #{getDescriptor.inspect}"
+# LOGGER.info "descriptor_is: #{self.class.descriptor_is.inspect}"
+# #LOGGER.info "conf_param: #{self.class.descriptor_is.conf_param}"
+# LOGGER.info "conf_param: #{GitlabWebHookRootActionDescriptor.newInstance.conf_param}"
+# LOGGER.info "env: #{env.inspect}"
+# GitlabWebHook::Api.new.call(env)
+# end
+#
+# #describe_as Java.hudson.model.Descriptor, :with => GitlabWebHookRootActionDescriptor
+# describe_as Java.hudson.model.Descriptor, :with => TestDescriptor
+#end
Oops, something went wrong.

0 comments on commit 86e982d

Please sign in to comment.