Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/models/integrations
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/models/integrations')
-rw-r--r--app/models/integrations/bamboo.rb2
-rw-r--r--app/models/integrations/datadog.rb56
-rw-r--r--app/models/integrations/irker.rb40
-rw-r--r--app/models/integrations/jenkins.rb2
-rw-r--r--app/models/integrations/jira.rb10
-rw-r--r--app/models/integrations/microsoft_teams.rb2
-rw-r--r--app/models/integrations/packagist.rb29
-rw-r--r--app/models/integrations/pushover.rb51
-rw-r--r--app/models/integrations/teamcity.rb2
-rw-r--r--app/models/integrations/unify_circuit.rb2
10 files changed, 131 insertions, 65 deletions
diff --git a/app/models/integrations/bamboo.rb b/app/models/integrations/bamboo.rb
index 590be52151c..1a7cbaa34c7 100644
--- a/app/models/integrations/bamboo.rb
+++ b/app/models/integrations/bamboo.rb
@@ -18,7 +18,7 @@ module Integrations
attr_accessor :response
- before_update :reset_password
+ before_validation :reset_password
def reset_password
if bamboo_url_changed? && !password_touched?
diff --git a/app/models/integrations/datadog.rb b/app/models/integrations/datadog.rb
index 27c2fcf266b..5516e6bc2c0 100644
--- a/app/models/integrations/datadog.rb
+++ b/app/models/integrations/datadog.rb
@@ -2,6 +2,7 @@
module Integrations
class Datadog < Integration
+ include ActionView::Helpers::UrlHelper
include HasWebHook
extend Gitlab::Utils::Override
@@ -47,11 +48,12 @@ module Integrations
end
def description
- 'Trace your GitLab pipelines with Datadog'
+ s_('DatadogIntegration|Trace your GitLab pipelines with Datadog.')
end
def help
- nil
+ docs_link = link_to s_('DatadogIntegration|How do I set up this integration?'), Rails.application.routes.url_helpers.help_page_url('integration/datadog'), target: '_blank', rel: 'noopener noreferrer'
+ s_('DatadogIntegration|Send CI/CD pipeline information to Datadog to monitor for job failures and troubleshoot performance issues. %{docs_link}').html_safe % { docs_link: docs_link.html_safe }
end
def self.to_param
@@ -64,14 +66,19 @@ module Integrations
type: 'text',
name: 'datadog_site',
placeholder: DEFAULT_DOMAIN,
- help: 'Choose the Datadog site to send data to. Set to "datadoghq.eu" to send data to the EU site',
+ help: ERB::Util.html_escape(
+ s_('DatadogIntegration|The Datadog site to send data to. To send data to the EU site, use %{codeOpen}datadoghq.eu%{codeClose}.')
+ ) % {
+ codeOpen: '<code>'.html_safe,
+ codeClose: '</code>'.html_safe
+ },
required: false
},
{
type: 'text',
name: 'api_url',
- title: 'API URL',
- help: '(Advanced) Define the full URL for your Datadog site directly',
+ title: s_('DatadogIntegration|API URL'),
+ help: s_('DatadogIntegration|(Advanced) The full URL for your Datadog site.'),
required: false
},
{
@@ -80,21 +87,34 @@ module Integrations
title: _('API key'),
non_empty_password_title: s_('ProjectService|Enter new API key'),
non_empty_password_help: s_('ProjectService|Leave blank to use your current API key'),
- help: "<a href=\"#{api_keys_url}\" target=\"_blank\">API key</a> used for authentication with Datadog",
+ help: ERB::Util.html_escape(
+ s_('DatadogIntegration|%{linkOpen}API key%{linkClose} used for authentication with Datadog.')
+ ) % {
+ linkOpen: '<a href="%s" target="_blank" rel="noopener noreferrer">'.html_safe % api_keys_url,
+ linkClose: '</a>'.html_safe
+ },
required: true
},
{
type: 'text',
name: 'datadog_service',
- title: 'Service',
+ title: s_('DatadogIntegration|Service'),
placeholder: 'gitlab-ci',
- help: 'Name of this GitLab instance that all data will be tagged with'
+ help: s_('DatadogIntegration|Tag all data from this GitLab instance in Datadog. Useful when managing several self-managed deployments.')
},
{
type: 'text',
name: 'datadog_env',
- title: 'Env',
- help: 'The environment tag that traces will be tagged with'
+ title: s_('DatadogIntegration|Environment'),
+ placeholder: 'ci',
+ help: ERB::Util.html_escape(
+ s_('DatadogIntegration|For self-managed deployments, set the %{codeOpen}env%{codeClose} tag for all the data sent to Datadog. %{linkOpen}How do I use tags?%{linkClose}')
+ ) % {
+ codeOpen: '<code>'.html_safe,
+ codeClose: '</code>'.html_safe,
+ linkOpen: '<a href="https://docs.datadoghq.com/getting_started/tagging/#using-tags" target="_blank" rel="noopener noreferrer">'.html_safe,
+ linkClose: '</a>'.html_safe
+ }
}
]
end
@@ -123,18 +143,18 @@ module Integrations
object_kind = 'job' if object_kind == 'build'
return unless supported_events.include?(object_kind)
+ data = data.with_retried_builds if data.respond_to?(:with_retried_builds)
+
execute_web_hook!(data, "#{object_kind} hook")
end
def test(data)
- begin
- result = execute(data)
- return { success: false, result: result[:message] } if result[:http_status] != 200
- rescue StandardError => error
- return { success: false, result: error }
- end
-
- { success: true, result: result[:message] }
+ result = execute(data)
+
+ {
+ success: (200..299).cover?(result[:http_status]),
+ result: result[:message]
+ }
end
private
diff --git a/app/models/integrations/irker.rb b/app/models/integrations/irker.rb
index 7048dd641ea..cea4aa2038d 100644
--- a/app/models/integrations/irker.rb
+++ b/app/models/integrations/irker.rb
@@ -4,6 +4,8 @@ require 'uri'
module Integrations
class Irker < Integration
+ include ActionView::Helpers::UrlHelper
+
prop_accessor :server_host, :server_port, :default_irc_uri
prop_accessor :recipients, :channels
boolean_accessor :colorize_messages
@@ -12,11 +14,11 @@ module Integrations
before_validation :get_channels
def title
- 'Irker (IRC gateway)'
+ s_('IrkerService|irker (IRC gateway)')
end
def description
- 'Send IRC messages.'
+ s_('IrkerService|Send update messages to an irker server.')
end
def self.to_param
@@ -42,33 +44,25 @@ module Integrations
end
def fields
+ recipients_docs_link = link_to s_('IrkerService|How to enter channels or users?'), Rails.application.routes.url_helpers.help_page_url('user/project/integrations/irker', anchor: 'enter-irker-recipients'), target: '_blank', rel: 'noopener noreferrer'
[
- { type: 'text', name: 'server_host', placeholder: 'localhost',
- help: 'Irker daemon hostname (defaults to localhost)' },
- { type: 'text', name: 'server_port', placeholder: 6659,
- help: 'Irker daemon port (defaults to 6659)' },
- { type: 'text', name: 'default_irc_uri', title: 'Default IRC URI',
- help: 'A default IRC URI to prepend before each recipient (optional)',
+ { type: 'text', name: 'server_host', placeholder: 'localhost', title: s_('IrkerService|Server host (optional)'),
+ help: s_('IrkerService|irker daemon hostname (defaults to localhost).') },
+ { type: 'text', name: 'server_port', placeholder: 6659, title: s_('IrkerService|Server port (optional)'),
+ help: s_('IrkerService|irker daemon port (defaults to 6659).') },
+ { type: 'text', name: 'default_irc_uri', title: s_('IrkerService|Default IRC URI (optional)'),
+ help: s_('IrkerService|URI to add before each recipient.'),
placeholder: 'irc://irc.network.net:6697/' },
- { type: 'textarea', name: 'recipients',
- placeholder: 'Recipients/channels separated by whitespaces', required: true,
- help: 'Recipients have to be specified with a full URI: '\
- 'irc[s]://irc.network.net[:port]/#channel. Special cases: if '\
- 'you want the channel to be a nickname instead, append ",isnick" to ' \
- 'the channel name; if the channel is protected by a secret password, ' \
- ' append "?key=secretpassword" to the URI (Note that due to a bug, if you ' \
- ' want to use a password, you have to omit the "#" on the channel). If you ' \
- ' specify a default IRC URI to prepend before each recipient, you can just ' \
- ' give a channel name.' },
- { type: 'checkbox', name: 'colorize_messages' }
+ { type: 'textarea', name: 'recipients', title: s_('IrkerService|Recipients'),
+ placeholder: 'irc[s]://irc.network.net[:port]/#channel', required: true,
+ help: s_('IrkerService|Channels and users separated by whitespaces. %{recipients_docs_link}').html_safe % { recipients_docs_link: recipients_docs_link.html_safe } },
+ { type: 'checkbox', name: 'colorize_messages', title: _('Colorize messages') }
]
end
def help
- ' NOTE: Irker does NOT have built-in authentication, which makes it' \
- ' vulnerable to spamming IRC channels if it is hosted outside of a ' \
- ' firewall. Please make sure you run the daemon within a secured network ' \
- ' to prevent abuse. For more details, read: http://www.catb.org/~esr/irker/security.html.'
+ docs_link = link_to _('Learn more.'), Rails.application.routes.url_helpers.help_page_url('user/project/integrations/irker', anchor: 'set-up-an-irker-daemon'), target: '_blank', rel: 'noopener noreferrer'
+ s_('IrkerService|Send update messages to an irker server. Before you can use this, you need to set up the irker daemon. %{docs_link}').html_safe % { docs_link: docs_link.html_safe }
end
private
diff --git a/app/models/integrations/jenkins.rb b/app/models/integrations/jenkins.rb
index 55fc60990f3..e5c1d5ad0d7 100644
--- a/app/models/integrations/jenkins.rb
+++ b/app/models/integrations/jenkins.rb
@@ -8,7 +8,7 @@ module Integrations
prop_accessor :jenkins_url, :project_name, :username, :password
- before_update :reset_password
+ before_validation :reset_password
validates :jenkins_url, presence: true, addressable_url: true, if: :activated?
validates :project_name, presence: true, if: :activated?
diff --git a/app/models/integrations/jira.rb b/app/models/integrations/jira.rb
index 1dc5c0db9e3..ec6adc87bf4 100644
--- a/app/models/integrations/jira.rb
+++ b/app/models/integrations/jira.rb
@@ -33,7 +33,7 @@ module Integrations
data_field :username, :password, :url, :api_url, :jira_issue_transition_automatic, :jira_issue_transition_id, :project_key, :issues_enabled,
:vulnerabilities_enabled, :vulnerabilities_issuetype
- before_update :reset_password
+ before_validation :reset_password
after_commit :update_deployment_type, on: [:create, :update], if: :update_deployment_type?
enum comment_detail: {
@@ -65,7 +65,10 @@ module Integrations
end
def reset_password
- data_fields.password = nil if reset_password?
+ return unless reset_password?
+
+ data_fields.password = nil
+ properties.delete('password') if properties
end
def set_default_data
@@ -536,8 +539,7 @@ module Integrations
end
def update_deployment_type?
- (api_url_changed? || url_changed? || username_changed? || password_changed?) &&
- testable?
+ api_url_changed? || url_changed? || username_changed? || password_changed?
end
def update_deployment_type
diff --git a/app/models/integrations/microsoft_teams.rb b/app/models/integrations/microsoft_teams.rb
index 91e6800f03c..5aad25e8ddc 100644
--- a/app/models/integrations/microsoft_teams.rb
+++ b/app/models/integrations/microsoft_teams.rb
@@ -15,7 +15,7 @@ module Integrations
end
def help
- '<p>Use this service to send notifications about events in GitLab projects to your Microsoft Teams channels. <a href="https://docs.gitlab.com/ee/user/project/integrations/microsoft_teams.html">How do I configure this integration?</a></p>'
+ '<p>Use this service to send notifications about events in GitLab projects to your Microsoft Teams channels. <a href="https://docs.gitlab.com/ee/user/project/integrations/microsoft_teams.html" target="_blank" rel="noopener noreferrer">How do I configure this integration?</a></p>'
end
def webhook_placeholder
diff --git a/app/models/integrations/packagist.rb b/app/models/integrations/packagist.rb
index fb0917db02b..f616bc5faf2 100644
--- a/app/models/integrations/packagist.rb
+++ b/app/models/integrations/packagist.rb
@@ -18,7 +18,7 @@ module Integrations
end
def description
- s_('Integrations|Update your Packagist projects.')
+ s_('Integrations|Keep your PHP dependencies updated on Packagist.')
end
def self.to_param
@@ -27,9 +27,30 @@ module Integrations
def fields
[
- { type: 'text', name: 'username', placeholder: '', required: true },
- { type: 'text', name: 'token', placeholder: '', required: true },
- { type: 'text', name: 'server', placeholder: 'https://packagist.org', required: false }
+ {
+ type: 'text',
+ name: 'username',
+ title: _('Username'),
+ help: s_('Enter your Packagist username.'),
+ placeholder: '',
+ required: true
+ },
+ {
+ type: 'text',
+ name: 'token',
+ title: _('Token'),
+ help: s_('Enter your Packagist token.'),
+ placeholder: '',
+ required: true
+ },
+ {
+ type: 'text',
+ name: 'server',
+ title: _('Server (optional)'),
+ help: s_('Enter your Packagist server. Defaults to https://packagist.org.'),
+ placeholder: 'https://packagist.org',
+ required: false
+ }
]
end
diff --git a/app/models/integrations/pushover.rb b/app/models/integrations/pushover.rb
index b0cadc7ef4e..db39a4c68bd 100644
--- a/app/models/integrations/pushover.rb
+++ b/app/models/integrations/pushover.rb
@@ -21,18 +21,46 @@ module Integrations
def fields
[
- { type: 'text', name: 'api_key', title: _('API key'), placeholder: s_('PushoverService|Your application key'), required: true },
- { type: 'text', name: 'user_key', placeholder: s_('PushoverService|Your user key'), required: true },
- { type: 'text', name: 'device', placeholder: s_('PushoverService|Leave blank for all active devices') },
- { type: 'select', name: 'priority', required: true, choices:
+ {
+ type: 'text',
+ name: 'api_key',
+ title: _('API key'),
+ help: s_('PushoverService|Enter your application key.'),
+ placeholder: '',
+ required: true
+ },
+ {
+ type: 'text',
+ name: 'user_key',
+ title: _('User key'),
+ help: s_('PushoverService|Enter your user key.'),
+ placeholder: '',
+ required: true
+ },
+ {
+ type: 'text',
+ name: 'device',
+ title: _('Devices (optional)'),
+ help: s_('PushoverService|Leave blank for all active devices.'),
+ placeholder: ''
+ },
+ {
+ type: 'select',
+ name: 'priority',
+ required: true,
+ choices:
[
- [s_('PushoverService|Lowest Priority'), -2],
- [s_('PushoverService|Low Priority'), -1],
- [s_('PushoverService|Normal Priority'), 0],
- [s_('PushoverService|High Priority'), 1]
+ [s_('PushoverService|Lowest priority'), -2],
+ [s_('PushoverService|Low priority'), -1],
+ [s_('PushoverService|Normal priority'), 0],
+ [s_('PushoverService|High priority'), 1]
],
- default_choice: 0 },
- { type: 'select', name: 'sound', choices:
+ default_choice: 0
+ },
+ {
+ type: 'select',
+ name: 'sound',
+ choices:
[
['Device default sound', nil],
['Pushover (default)', 'pushover'],
@@ -57,7 +85,8 @@ module Integrations
['Pushover Echo (long)', 'echo'],
['Up Down (long)', 'updown'],
['None (silent)', 'none']
- ] }
+ ]
+ }
]
end
diff --git a/app/models/integrations/teamcity.rb b/app/models/integrations/teamcity.rb
index 135c304b57e..3f868b57597 100644
--- a/app/models/integrations/teamcity.rb
+++ b/app/models/integrations/teamcity.rb
@@ -18,7 +18,7 @@ module Integrations
attr_accessor :response
- before_update :reset_password
+ before_validation :reset_password
class << self
def to_param
diff --git a/app/models/integrations/unify_circuit.rb b/app/models/integrations/unify_circuit.rb
index 834222834e9..ad6a9164d00 100644
--- a/app/models/integrations/unify_circuit.rb
+++ b/app/models/integrations/unify_circuit.rb
@@ -18,7 +18,7 @@ module Integrations
'This service sends notifications about projects events to a Unify Circuit conversation.<br />
To set up this service:
<ol>
- <li><a href="https://www.circuit.com/unifyportalfaqdetail?articleId=164448">Set up an incoming webhook for your conversation</a>. All notifications will come to this conversation.</li>
+ <li><a href="https://www.circuit.com/unifyportalfaqdetail?articleId=164448" target="_blank" rel="noopener noreferrer">Set up an incoming webhook for your conversation</a>. All notifications will come to this conversation.</li>
<li>Paste the <strong>Webhook URL</strong> into the field below.</li>
<li>Select events below to enable notifications.</li>
</ol>'