Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
JENKINS-33252 skip reporting if gitlab url/token not configured
Browse files Browse the repository at this point in the history
  • Loading branch information
javiplx committed Mar 24, 2016
1 parent 8200448 commit ae9825f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/gitlab/client.rb
Expand Up @@ -4,7 +4,7 @@
module Gitlab
class Client

attr_reader :id, :namespace, :name, :code, :msg
attr_reader :gitlab_url, :id, :namespace, :name, :code, :msg

def initialize(descriptor, repo_name=nil)
@gitlab_url = descriptor.gitlab_url
Expand Down Expand Up @@ -58,7 +58,7 @@ def post_status(commit, status, ci_url, mr_id=nil)

private

attr_accessor :gitlab_url, :token
attr_accessor :token

def post_commit_status(commit, status, ci_url)
url = "projects/#{id}/statuses/#{commit}"
Expand Down
4 changes: 4 additions & 0 deletions models/gitlab_notifier.rb
Expand Up @@ -20,6 +20,10 @@ def read_completed
def prebuild(build, listener)
env = build.native.environment listener
@project = GitlabWebHook::Project.new( build.native.project , env )
unless client.gitlab_url
listener.warn("No GitLab url configured, skipping reporting")
return
end
client.name = repo_namespace(build, env)
unless client.id
listener.error("GitLab error : #{client.msg}")
Expand Down

0 comments on commit ae9825f

Please sign in to comment.