Commit a20ebb7f authored by Sean McGivern's avatar Sean McGivern

Merge branch '25875-Add-Webex-Teams-project-integration-service' into 'master'

25875-Add-Webex-Teams-project-integration-service

Closes #25875

See merge request gitlab-org/gitlab!31543
parents c37c8146 b4143e7c
......@@ -177,6 +177,7 @@ class Project < ApplicationRecord
has_one :packagist_service
has_one :hangouts_chat_service
has_one :unify_circuit_service
has_one :webex_teams_service
has_one :root_of_fork_network,
foreign_key: 'root_project_id',
......
# frozen_string_literal: true
class WebexTeamsService < ChatNotificationService
def title
'Webex Teams'
end
def description
'Receive event notifications in Webex Teams'
end
def self.to_param
'webex_teams'
end
def help
'This service sends notifications about projects events to a Webex Teams conversation.<br />
To set up this service:
<ol>
<li><a href="https://apphub.webex.com/teams/applications/incoming-webhooks-cisco-systems">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>'
end
def event_field(event)
end
def default_channel_placeholder
end
def self.supported_events
%w[push issue confidential_issue merge_request note confidential_note tag_push
pipeline wiki_page]
end
def default_fields
[
{ type: 'text', name: 'webhook', placeholder: "e.g. https://api.ciscospark.com/v1/webhooks/incoming/…", required: true },
{ type: 'checkbox', name: 'notify_only_broken_pipelines' },
{ type: 'select', name: 'branches_to_be_notified', choices: branch_choices }
]
end
private
def notify(message, opts)
header = { 'Content-Type' => 'application/json' }
response = Gitlab::HTTP.post(webhook, headers: header, body: { markdown: message.pretext }.to_json)
response if response.success?
end
def custom_data(data)
super(data).merge(markdown: true)
end
end
......@@ -12,7 +12,7 @@ class Service < ApplicationRecord
alerts asana assembla bamboo bugzilla buildkite campfire custom_issue_tracker discord
drone_ci emails_on_push external_wiki flowdock hangouts_chat hipchat irker jira
mattermost mattermost_slash_commands microsoft_teams packagist pipelines_email
pivotaltracker prometheus pushover redmine slack slack_slash_commands teamcity unify_circuit youtrack
pivotaltracker prometheus pushover redmine slack slack_slash_commands teamcity unify_circuit webex_teams youtrack
].freeze
DEV_SERVICE_NAMES = %w[
......
---
title: Add Webex Teams project integration service
merge_request: 31543
author: Sebastian Leuser
type: added
......@@ -9704,6 +9704,7 @@ enum ServiceType {
SLACK_SLASH_COMMANDS_SERVICE
TEAMCITY_SERVICE
UNIFY_CIRCUIT_SERVICE
WEBEX_TEAMS_SERVICE
YOUTRACK_SERVICE
}
......
......@@ -28748,6 +28748,12 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "WEBEX_TEAMS_SERVICE",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "YOUTRACK_SERVICE",
"description": null,
......@@ -331,6 +331,51 @@ Get Unify Circuit service settings for a project.
GET /projects/:id/services/unify-circuit
```
## Webex Teams
Webex Teams collaboration tool.
### Create/Edit Webex Teams service
Set Webex Teams service for a project.
```plaintext
PUT /projects/:id/services/webex-teams
```
Parameters:
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `webhook` | string | true | The Webex Teams webhook. For example, `https://api.ciscospark.com/v1/webhooks/incoming/...`. |
| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines |
| `branches_to_be_notified` | string | all | Branches to send notifications for. Valid options are "all", "default", "protected", and "default_and_protected" |
| `push_events` | boolean | false | Enable notifications for push events |
| `issues_events` | boolean | false | Enable notifications for issue events |
| `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events |
| `merge_requests_events` | boolean | false | Enable notifications for merge request events |
| `tag_push_events` | boolean | false | Enable notifications for tag push events |
| `note_events` | boolean | false | Enable notifications for note events |
| `confidential_note_events` | boolean | false | Enable notifications for confidential note events |
| `pipeline_events` | boolean | false | Enable notifications for pipeline events |
| `wiki_page_events` | boolean | false | Enable notifications for wiki page events |
### Delete Webex Teams service
Delete Webex Teams service for a project.
```plaintext
DELETE /projects/:id/services/webex-teams
```
### Get Webex Teams service settings
Get Webex Teams service settings for a project.
```plaintext
GET /projects/:id/services/webex-teams
```
## Custom Issue Tracker
Custom issue tracker
......
......@@ -271,6 +271,7 @@ but commented out to help encourage others to add to it in the future. -->
|projects_slack_slash_commands_active|counts||
|projects_teamcity_active|counts||
|projects_unify_circuit_active|counts||
|projects_webex_teams_active|counts||
|projects_youtrack_active|counts||
|projects_slack_notifications_active|counts||
|projects_slack_slash_active|counts||
......
......@@ -55,6 +55,7 @@ Click on the service links to see further configuration instructions and details
| Pushover | Pushover makes it easy to get real-time notifications on your Android device, iPhone, iPad, and Desktop | No |
| [Redmine](redmine.md) | Redmine issue tracker | No |
| [Unify Circuit](unify_circuit.md) | Receive events notifications in Unify Circuit | No |
| [Webex Teams](webex_teams.md) | Receive events notifications in Webex Teams | No |
| [YouTrack](youtrack.md) | YouTrack issue tracker | No |
## Push hooks limit
......
# Webex Teams service
You can configure GitLab to send notifications to a Webex Teams space.
## Create a webhook for the space
1. Go to the [Incoming Webooks app page](https://apphub.webex.com/teams/applications/incoming-webhooks-cisco-systems).
1. Click **Connect** and log in to Webex Teams, if required.
1. Enter a name for the webhook and select the space that will receive the notifications.
1. Click **ADD**.
1. Copy the **Webhook URL**.
## Configure settings in GitLab
Once you have a webhook URL for your Webex Teams space, you can configure GitLab to send notifications.
1. Navigate to **Project > Settings > Integrations**.
1. Select the **Webex Teams** integration.
1. Ensure that the **Active** toggle is enabled.
1. Select the checkboxes corresponding to the GitLab events you want to receive in Webex Teams.
1. Paste the **Webhook** URL for the Webex Teams space.
1. Configure the remaining options and then click **Test settings and save changes**.
The Webex Teams space will begin to receive all applicable GitLab events.
......@@ -724,6 +724,15 @@ module API
desc: 'The Unify Circuit webhook. e.g. https://circuit.com/rest/v2/webhooks/incoming/…'
},
chat_notification_events
].flatten,
'webex-teams' => [
{
required: true,
name: :webhook,
type: String,
desc: 'The Webex Teams webhook. e.g. https://api.ciscospark.com/v1/webhooks/incoming/…'
},
chat_notification_events
].flatten
}
end
......
......@@ -493,6 +493,7 @@ project:
- alert_management_alerts
- repository_storage_moves
- freeze_periods
- webex_teams_service
award_emoji:
- awardable
- user
......
# frozen_string_literal: true
require "spec_helper"
describe WebexTeamsService do
it_behaves_like "chat service", "Webex Teams" do
let(:client_arguments) { webhook_url }
let(:content_key) { :markdown }
end
end
......@@ -36,6 +36,7 @@ describe Project do
it { is_expected.to have_one(:mattermost_service) }
it { is_expected.to have_one(:hangouts_chat_service) }
it { is_expected.to have_one(:unify_circuit_service) }
it { is_expected.to have_one(:webex_teams_service) }
it { is_expected.to have_one(:packagist_service) }
it { is_expected.to have_one(:pushover_service) }
it { is_expected.to have_one(:asana_service) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment