diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /app/models/integrations/jenkins.rb | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'app/models/integrations/jenkins.rb')
-rw-r--r-- | app/models/integrations/jenkins.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/app/models/integrations/jenkins.rb b/app/models/integrations/jenkins.rb index 815e86bcaa1..55fc60990f3 100644 --- a/app/models/integrations/jenkins.rb +++ b/app/models/integrations/jenkins.rb @@ -2,7 +2,9 @@ module Integrations class Jenkins < BaseCi + include HasWebHook include ActionView::Helpers::UrlHelper + extend Gitlab::Utils::Override prop_accessor :jenkins_url, :project_name, :username, :password @@ -16,8 +18,6 @@ module Integrations default_value_for :merge_requests_events, false default_value_for :tag_push_events, false - after_save :compose_service_hook, if: :activated? - def reset_password # don't reset the password if a new one is provided if (jenkins_url_changed? || username.blank?) && !password_touched? @@ -25,16 +25,10 @@ module Integrations end end - def compose_service_hook - hook = service_hook || build_service_hook - hook.url = hook_url - hook.save - end - def execute(data) return unless supported_events.include?(data[:object_kind]) - service_hook.execute(data, "#{data[:object_kind]}_hook") + execute_web_hook!(data, "#{data[:object_kind]}_hook") end def test(data) @@ -48,6 +42,7 @@ module Integrations { success: true, result: result[:message] } end + override :hook_url def hook_url url = URI.parse(jenkins_url) url.path = File.join(url.path || '/', "project/#{project_name}") @@ -97,7 +92,6 @@ module Integrations { type: 'text', name: 'username', - required: true, help: s_('The username for the Jenkins server.') }, { |