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:
-rw-r--r--.gitlab/ci/rails.gitlab-ci.yml14
-rw-r--r--Gemfile6
-rw-r--r--app/assets/javascripts/ide/components/ide_review.vue2
-rw-r--r--app/assets/javascripts/performance_bar/components/detailed_metric.vue4
-rw-r--r--app/controllers/groups_controller.rb2
-rw-r--r--app/controllers/projects_controller.rb2
-rw-r--r--app/graphql/mutations/snippets/create.rb9
-rw-r--r--app/models/project.rb1
-rw-r--r--app/models/project_services/webex_teams_service.rb57
-rw-r--r--app/models/service.rb2
-rw-r--r--app/presenters/ci/build_runner_presenter.rb7
-rw-r--r--app/views/shared/_recaptcha_form.html.haml2
-rw-r--r--changelogs/unreleased/213424-update-info-text-when-export-is-started.yml5
-rw-r--r--changelogs/unreleased/22691-externelize-i18n-strings-from---app-views-shared-_recaptcha_form-ht.yml5
-rw-r--r--changelogs/unreleased/25875-Add-Webex-Teams-project-integration-service.yml5
-rw-r--r--changelogs/unreleased/add-epic-id-to-resource-state-event-pd.yml5
-rw-r--r--changelogs/unreleased/fj-add-files-param-snippet-create-mutation.yml5
-rw-r--r--changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-ide-components-.yml5
-rw-r--r--changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-performance_bar.yml5
-rw-r--r--db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb17
-rw-r--r--db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb19
-rw-r--r--db/structure.sql8
-rw-r--r--doc/api/graphql/reference/gitlab_schema.graphql6
-rw-r--r--doc/api/graphql/reference/gitlab_schema.json24
-rw-r--r--doc/api/instance_level_ci_variables.md3
-rw-r--r--doc/api/services.md45
-rw-r--r--doc/development/fe_guide/style/scss.md25
-rw-r--r--doc/development/go_guide/index.md2
-rw-r--r--doc/push_rules/push_rules.md2
-rw-r--r--doc/user/admin_area/settings/usage_statistics.md1
-rw-r--r--doc/user/group/index.md23
-rw-r--r--doc/user/project/integrations/img/webex_teams_configuration.pngbin0 -> 250628 bytes
-rw-r--r--doc/user/project/integrations/overview.md1
-rw-r--r--doc/user/project/integrations/webex_teams.md24
-rw-r--r--lib/api/helpers/services_helpers.rb9
-rw-r--r--lib/gitlab/import_export/project/tree_restorer.rb2
-rw-r--r--lib/gitlab/import_export/project/tree_saver.rb2
-rw-r--r--locale/gitlab.pot7
-rw-r--r--spec/lib/gitlab/import_export/all_models.yml1
-rw-r--r--spec/models/project_services/webex_teams_service_spec.rb10
-rw-r--r--spec/models/project_spec.rb1
-rw-r--r--spec/presenters/ci/build_runner_presenter_spec.rb10
-rw-r--r--spec/requests/api/graphql/mutations/snippets/create_spec.rb52
-rw-r--r--spec/requests/api/graphql/project/alert_management/alerts_spec.rb44
-rw-r--r--spec/requests/api/runner_spec.rb11
45 files changed, 415 insertions, 77 deletions
diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml
index f277a8f7728..0bf90e18bbd 100644
--- a/.gitlab/ci/rails.gitlab-ci.yml
+++ b/.gitlab/ci/rails.gitlab-ci.yml
@@ -154,24 +154,22 @@ db:check-schema:
script:
- source scripts/schema_changed.sh
-db:migrate-from-v11.11.0:
+db:migrate-from-v12.10.0:
extends: .db-job-base
variables:
SETUP_DB: "false"
script:
- - export PROJECT_TO_CHECKOUT="gitlab-foss"
- - export TAG_TO_CHECKOUT="v11.11.0"
- - '[[ ! -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab"'
- - '[[ ! -d "ee/" ]] || export TAG_TO_CHECKOUT="v11.11.0-ee"'
+ - export PROJECT_TO_CHECKOUT="gitlab"
+ - export TAG_TO_CHECKOUT="v12.10.0-ee"
+ - '[[ -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab-foss"'
+ - '[[ -d "ee/" ]] || export TAG_TO_CHECKOUT="v12.10.0"'
- git fetch https://gitlab.com/gitlab-org/$PROJECT_TO_CHECKOUT.git $TAG_TO_CHECKOUT
- git checkout -f FETCH_HEAD
- - sed -i "s/gem 'oj', '~> 2.17.4'//" Gemfile
- - sed -i "s/gem 'bootsnap', '~> 1.0.0'/gem 'bootsnap'/" Gemfile
- bundle update google-protobuf grpc bootsnap
- bundle install $BUNDLE_INSTALL_FLAGS
- date
- cp config/gitlab.yml.example config/gitlab.yml
- - bundle exec rake db:drop db:create db:schema:load db:seed_fu
+ - bundle exec rake db:drop db:create db:structure:load db:seed_fu
- date
- git checkout -f $CI_COMMIT_SHA
- bundle install $BUNDLE_INSTALL_FLAGS
diff --git a/Gemfile b/Gemfile
index 23350e3a907..9c8c5e8b30d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -318,9 +318,6 @@ gem 'peek', '~> 1.1'
# Snowplow events tracking
gem 'snowplow-tracker', '~> 0.6.1'
-# Memory benchmarks
-gem 'derailed_benchmarks', require: false
-
# Metrics
group :metrics do
gem 'method_source', '~> 0.8', require: false
@@ -413,6 +410,9 @@ group :test do
gem 'test-prof', '~> 0.10.0'
gem 'rspec_junit_formatter'
gem 'guard-rspec'
+
+ # Moved in `test` because https://gitlab.com/gitlab-org/gitlab/-/issues/217527
+ gem 'derailed_benchmarks', require: false
end
gem 'octokit', '~> 4.15'
diff --git a/app/assets/javascripts/ide/components/ide_review.vue b/app/assets/javascripts/ide/components/ide_review.vue
index 901b8892e80..62dbfea2088 100644
--- a/app/assets/javascripts/ide/components/ide_review.vue
+++ b/app/assets/javascripts/ide/components/ide_review.vue
@@ -43,7 +43,7 @@ export default {
<template>
<ide-tree-list :viewer-type="viewer" header-class="ide-review-header">
- <template slot="header">
+ <template #header>
<div class="ide-review-button-holder">
{{ __('Review') }}
<editor-mode-dropdown
diff --git a/app/assets/javascripts/performance_bar/components/detailed_metric.vue b/app/assets/javascripts/performance_bar/components/detailed_metric.vue
index 24ae900b445..e1a0e2df0e0 100644
--- a/app/assets/javascripts/performance_bar/components/detailed_metric.vue
+++ b/app/assets/javascripts/performance_bar/components/detailed_metric.vue
@@ -116,7 +116,9 @@ export default {
</template>
</table>
- <div slot="footer"></div>
+ <template #footer>
+ <div></div>
+ </template>
</gl-modal>
{{ title }}
<request-warning :html-id="htmlId" :warnings="warnings" />
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 2cf5d61ec3a..d5f2239b16a 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -146,7 +146,7 @@ class GroupsController < Groups::ApplicationController
export_service = Groups::ImportExport::ExportService.new(group: @group, user: current_user)
if export_service.async_execute
- redirect_to edit_group_path(@group), notice: _('Group export started. A download link will be sent by email.')
+ redirect_to edit_group_path(@group), notice: _('Group export started. A download link will be sent by email and made available on this page.')
else
redirect_to edit_group_path(@group), alert: _('Group export could not be started.')
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 36d14d22ce6..f6eb0101ae0 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -201,7 +201,7 @@ class ProjectsController < Projects::ApplicationController
redirect_to(
edit_project_path(@project, anchor: 'js-export-project'),
- notice: _("Project export started. A download link will be sent by email.")
+ notice: _("Project export started. A download link will be sent by email and made available on this page.")
)
end
diff --git a/app/graphql/mutations/snippets/create.rb b/app/graphql/mutations/snippets/create.rb
index 266a123de82..6fc223fbee7 100644
--- a/app/graphql/mutations/snippets/create.rb
+++ b/app/graphql/mutations/snippets/create.rb
@@ -36,6 +36,10 @@ module Mutations
required: false,
description: 'The project full path the snippet is associated with'
+ argument :uploaded_files, [GraphQL::STRING_TYPE],
+ required: false,
+ description: 'The paths to files uploaded in the snippet description'
+
def resolve(args)
project_path = args.delete(:project_path)
@@ -45,9 +49,14 @@ module Mutations
raise_resource_not_available_error!
end
+ # We need to rename `uploaded_files` into `files` because
+ # it's the expected key param
+ args[:files] = args.delete(:uploaded_files)
+
service_response = ::Snippets::CreateService.new(project,
context[:current_user],
args).execute
+
snippet = service_response.payload[:snippet]
{
diff --git a/app/models/project.rb b/app/models/project.rb
index 362a01106c1..c0dd2eb8584 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -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',
diff --git a/app/models/project_services/webex_teams_service.rb b/app/models/project_services/webex_teams_service.rb
new file mode 100644
index 00000000000..1d791b19486
--- /dev/null
+++ b/app/models/project_services/webex_teams_service.rb
@@ -0,0 +1,57 @@
+# 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
diff --git a/app/models/service.rb b/app/models/service.rb
index 38cefc2df6e..fb4d9a77077 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -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[
diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb
index f63fd3c50c4..5e35bfc79ef 100644
--- a/app/presenters/ci/build_runner_presenter.rb
+++ b/app/presenters/ci/build_runner_presenter.rb
@@ -97,6 +97,13 @@ module Ci
end
def persistent_ref_exist?
+ ##
+ # Persistent refs for pipelines definitely exist from GitLab 12.4,
+ # hence, we don't need to check the ref existence before passing it to runners.
+ # Checking refs pressurizes gitaly node and should be avoided.
+ # Issue: https://gitlab.com/gitlab-com/gl-infra/production/-/issues/2143
+ return true if Feature.enabled?(:ci_skip_persistent_ref_existence_check)
+
pipeline.persistent_ref.exist?
end
diff --git a/app/views/shared/_recaptcha_form.html.haml b/app/views/shared/_recaptcha_form.html.haml
index 10f358402c1..245a86721eb 100644
--- a/app/views/shared/_recaptcha_form.html.haml
+++ b/app/views/shared/_recaptcha_form.html.haml
@@ -17,4 +17,4 @@
- if has_submit
.row-content-block.footer-block
- = f.submit "Submit #{humanized_resource_name}", class: 'btn btn-success'
+ = f.submit _("Submit %{humanized_resource_name}") % { humanized_resource_name: humanized_resource_name }, class: 'btn btn-success'
diff --git a/changelogs/unreleased/213424-update-info-text-when-export-is-started.yml b/changelogs/unreleased/213424-update-info-text-when-export-is-started.yml
new file mode 100644
index 00000000000..42580a8b5e4
--- /dev/null
+++ b/changelogs/unreleased/213424-update-info-text-when-export-is-started.yml
@@ -0,0 +1,5 @@
+---
+title: Update group and project export info messages
+merge_request: 31981
+author: briankabiro
+type: other
diff --git a/changelogs/unreleased/22691-externelize-i18n-strings-from---app-views-shared-_recaptcha_form-ht.yml b/changelogs/unreleased/22691-externelize-i18n-strings-from---app-views-shared-_recaptcha_form-ht.yml
new file mode 100644
index 00000000000..faa328617dc
--- /dev/null
+++ b/changelogs/unreleased/22691-externelize-i18n-strings-from---app-views-shared-_recaptcha_form-ht.yml
@@ -0,0 +1,5 @@
+---
+title: Externalize i18n strings from ./app/views/shared/_recaptcha_form.html.haml
+merge_request: 32106
+author: Gilang Gumilar
+type: changed
diff --git a/changelogs/unreleased/25875-Add-Webex-Teams-project-integration-service.yml b/changelogs/unreleased/25875-Add-Webex-Teams-project-integration-service.yml
new file mode 100644
index 00000000000..ee79fd33c13
--- /dev/null
+++ b/changelogs/unreleased/25875-Add-Webex-Teams-project-integration-service.yml
@@ -0,0 +1,5 @@
+---
+title: Add Webex Teams project integration service
+merge_request: 31543
+author: Sebastian Leuser
+type: added
diff --git a/changelogs/unreleased/add-epic-id-to-resource-state-event-pd.yml b/changelogs/unreleased/add-epic-id-to-resource-state-event-pd.yml
new file mode 100644
index 00000000000..56aee1e41e8
--- /dev/null
+++ b/changelogs/unreleased/add-epic-id-to-resource-state-event-pd.yml
@@ -0,0 +1,5 @@
+---
+title: Add epic_id to resource_state_events
+merge_request: 31587
+author:
+type: other
diff --git a/changelogs/unreleased/fj-add-files-param-snippet-create-mutation.yml b/changelogs/unreleased/fj-add-files-param-snippet-create-mutation.yml
new file mode 100644
index 00000000000..16dbe415f3f
--- /dev/null
+++ b/changelogs/unreleased/fj-add-files-param-snippet-create-mutation.yml
@@ -0,0 +1,5 @@
+---
+title: Add files param to snippet create mutation
+merge_request: 32309
+author:
+type: changed
diff --git a/changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-ide-components-.yml b/changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-ide-components-.yml
new file mode 100644
index 00000000000..7bac2a1c6b3
--- /dev/null
+++ b/changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-ide-components-.yml
@@ -0,0 +1,5 @@
+---
+title: Update deprecated slot syntax in ./app/assets/javascripts/ide/components/ide_review.vue
+merge_request: 32025
+author: Gilang Gumilar
+type: other
diff --git a/changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-performance_bar.yml b/changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-performance_bar.yml
new file mode 100644
index 00000000000..e23a49c5dc5
--- /dev/null
+++ b/changelogs/unreleased/update-deprecated-slot-syntax-in---app-assets-javascripts-performance_bar.yml
@@ -0,0 +1,5 @@
+---
+title: Update deprecated slot syntax in ./app/assets/javascripts/performance_bar/components/detailed_metric.vue
+merge_request: 32006
+author: Gilang Gumilar
+type: other
diff --git a/db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb b/db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb
new file mode 100644
index 00000000000..85d965972aa
--- /dev/null
+++ b/db/migrate/20200511092246_add_epic_id_to_resource_state_events.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddEpicIdToResourceStateEvents < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ INDEX_NAME = 'index_resource_state_events_on_epic_id'
+
+ def up
+ add_column :resource_state_events, :epic_id, :integer
+ add_index :resource_state_events, :epic_id, name: INDEX_NAME # rubocop:disable Migration/AddIndex
+ end
+
+ def down
+ remove_index :resource_state_events, name: INDEX_NAME # rubocop:disable Migration/RemoveIndex
+ remove_column :resource_state_events, :epic_id, :integer
+ end
+end
diff --git a/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb b/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb
new file mode 100644
index 00000000000..8072fe81c4a
--- /dev/null
+++ b/db/migrate/20200511092505_add_foreign_key_to_epic_id_on_resource_state_events.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddForeignKeyToEpicIdOnResourceStateEvents < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ add_foreign_key :resource_state_events, :epics, column: :epic_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey
+ end
+ end
+
+ def down
+ with_lock_retries do
+ remove_foreign_key :resource_state_events, column: :epic_id
+ end
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index cc5c16772f8..fe4a36b365c 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -5812,6 +5812,7 @@ CREATE TABLE public.resource_state_events (
merge_request_id bigint,
created_at timestamp with time zone NOT NULL,
state smallint NOT NULL,
+ epic_id integer,
CONSTRAINT resource_state_events_must_belong_to_issue_or_merge_request CHECK ((((issue_id <> NULL::bigint) AND (merge_request_id IS NULL)) OR ((merge_request_id <> NULL::bigint) AND (issue_id IS NULL))))
);
@@ -10521,6 +10522,8 @@ CREATE INDEX index_resource_milestone_events_on_milestone_id ON public.resource_
CREATE INDEX index_resource_milestone_events_on_user_id ON public.resource_milestone_events USING btree (user_id);
+CREATE INDEX index_resource_state_events_on_epic_id ON public.resource_state_events USING btree (epic_id);
+
CREATE INDEX index_resource_state_events_on_issue_id_and_created_at ON public.resource_state_events USING btree (issue_id, created_at);
CREATE INDEX index_resource_state_events_on_merge_request_id ON public.resource_state_events USING btree (merge_request_id);
@@ -12412,6 +12415,9 @@ ALTER TABLE ONLY public.vulnerability_occurrences
ALTER TABLE ONLY public.project_export_jobs
ADD CONSTRAINT fk_rails_c88d8db2e1 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.resource_state_events
+ ADD CONSTRAINT fk_rails_c913c64977 FOREIGN KEY (epic_id) REFERENCES public.epics(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.resource_milestone_events
ADD CONSTRAINT fk_rails_c940fb9fc5 FOREIGN KEY (milestone_id) REFERENCES public.milestones(id) ON DELETE CASCADE;
@@ -13809,6 +13815,8 @@ COPY "schema_migrations" (version) FROM STDIN;
20200506154421
20200507221434
20200508091106
+20200511092246
+20200511092505
20200511092714
20200511115430
20200511115431
diff --git a/doc/api/graphql/reference/gitlab_schema.graphql b/doc/api/graphql/reference/gitlab_schema.graphql
index faa5590152c..815f9ec470e 100644
--- a/doc/api/graphql/reference/gitlab_schema.graphql
+++ b/doc/api/graphql/reference/gitlab_schema.graphql
@@ -1335,6 +1335,11 @@ input CreateSnippetInput {
title: String!
"""
+ The paths to files uploaded in the snippet description
+ """
+ uploadedFiles: [String!]
+
+ """
The visibility level of the snippet
"""
visibilityLevel: VisibilityLevelsEnum!
@@ -9699,6 +9704,7 @@ enum ServiceType {
SLACK_SLASH_COMMANDS_SERVICE
TEAMCITY_SERVICE
UNIFY_CIRCUIT_SERVICE
+ WEBEX_TEAMS_SERVICE
YOUTRACK_SERVICE
}
diff --git a/doc/api/graphql/reference/gitlab_schema.json b/doc/api/graphql/reference/gitlab_schema.json
index 4e33b30549b..577e764d6a1 100644
--- a/doc/api/graphql/reference/gitlab_schema.json
+++ b/doc/api/graphql/reference/gitlab_schema.json
@@ -3609,6 +3609,24 @@
"defaultValue": null
},
{
+ "name": "uploadedFiles",
+ "description": "The paths to files uploaded in the snippet description",
+ "type": {
+ "kind": "LIST",
+ "name": null,
+ "ofType": {
+ "kind": "NON_NULL",
+ "name": null,
+ "ofType": {
+ "kind": "SCALAR",
+ "name": "String",
+ "ofType": null
+ }
+ }
+ },
+ "defaultValue": null
+ },
+ {
"name": "clientMutationId",
"description": "A unique identifier for the client performing the mutation.",
"type": {
@@ -28731,6 +28749,12 @@
"deprecationReason": null
},
{
+ "name": "WEBEX_TEAMS_SERVICE",
+ "description": null,
+ "isDeprecated": false,
+ "deprecationReason": null
+ },
+ {
"name": "YOUTRACK_SERVICE",
"description": null,
"isDeprecated": false,
diff --git a/doc/api/instance_level_ci_variables.md b/doc/api/instance_level_ci_variables.md
index d7e14fe0019..c5085bebe91 100644
--- a/doc/api/instance_level_ci_variables.md
+++ b/doc/api/instance_level_ci_variables.md
@@ -63,6 +63,9 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/a
Create a new instance-level variable.
+NOTE: **Note:**
+The maximum number of instance-level variables is [planned to be 25](https://gitlab.com/gitlab-org/gitlab/-/issues/216097).
+
```plaintext
POST /admin/ci/variables
```
diff --git a/doc/api/services.md b/doc/api/services.md
index 7577f5fe4b1..d435dffa651 100644
--- a/doc/api/services.md
+++ b/doc/api/services.md
@@ -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
diff --git a/doc/development/fe_guide/style/scss.md b/doc/development/fe_guide/style/scss.md
index abfe985c389..336c9b8ca35 100644
--- a/doc/development/fe_guide/style/scss.md
+++ b/doc/development/fe_guide/style/scss.md
@@ -9,30 +9,25 @@ easy to maintain, and performant for the end-user.
## Rules
+Our CSS is a mixture of current and legacy approaches. That means sometimes it may be difficult to follow this guide to the letter; it means you will definitely run into exceptions, where following the guide is difficult to impossible without outsized effort. In those cases, you may work with your reviewers and maintainers to identify an approach that does not fit these rules. Please endeavor to limit these cases.
+
### Utility Classes
-As part of the effort for [cleaning up our CSS and moving our components into `gitlab-ui`](https://gitlab.com/groups/gitlab-org/-/epics/950)
-led by the [GitLab UI WG](https://gitlab.com/gitlab-com/www-gitlab-com/-/merge_requests/20623) we prefer the use of utility classes over adding new CSS. However, complex CSS can be addressed by adding component classes.
+In order to reduce the generation of more CSS as our site grows, prefer the use of utility classes over adding new CSS. In complex cases, CSS can be addressed by adding component classes.
#### Where are utility classes defined?
-- [Bootstrap's Utility Classes](https://getbootstrap.com/docs/4.3/utilities/)
-- [`common.scss`](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/stylesheets/framework/common.scss) (old, many classes are now deprecated)
-- [`utilities.scss`](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/stylesheets/utilities.scss) (new)
+Prefer the use of [utility classes defined in GitLab UI](https://gitlab.com/gitlab-org/gitlab-ui/-/blob/master/doc/css.md#utilities). An easy list of classes can also be [seen on Unpkg](https://unpkg.com/browse/@gitlab/ui/src/scss/utilities.scss).
-#### Where should I put new utility classes?
+Classes in [`utilities.scss`](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/stylesheets/utilities.scss) and [`common.scss`](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/stylesheets/framework/common.scss) are being deprecated. Classes in [`common.scss`](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/stylesheets/framework/common.scss) that use non-design system values should be avoided in favor of conformant values.
-New utility classes should be added to [`utilities.scss`](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/stylesheets/utilities.scss). Existing classes include:
+Avoid [Bootstrap's Utility Classes](https://getbootstrap.com/docs/4.3/utilities/).
+
+#### Where should I put new utility classes?
-| Name | Pattern | Example |
-|------|---------|---------|
-| Background color | `.bg-{variant}-{shade}` | `.bg-warning-400` |
-| Text color | `.text-{variant}-{shade}` | `.text-success-500` |
-| Font size | `.text-{size}` | `.text-2` |
+If a class you need has not been added to GitLab UI, you get to add it! Follow the naming patterns documented in the [utility files](https://gitlab.com/gitlab-org/gitlab-ui/-/tree/master/src/scss/utility-mixins) and refer to [GitLab UI's CSS documentation](https://gitlab.com/gitlab-org/gitlab-ui/-/blob/master/doc/contributing/adding_css.md#adding-utility-mixins) for more details, especially about adding responsive and stateful rules.
-- `{variant}` is one of 'primary', 'secondary', 'success', 'warning', 'error'
-- `{shade}` is one of the shades listed on [colors](https://design.gitlab.com/product-foundations/colors/)
-- `{size}` is a number from 1-6 from our [Type scale](https://design.gitlab.com/product-foundations/typography/)
+If it is not possible to wait for a GitLab UI update (generally one day), add the class to [`utilities.scss`](https://gitlab.com/gitlab-org/gitlab/blob/master/app/assets/stylesheets/utilities.scss) following the same naming conventions documented in GitLab UI. A follow—up issue to backport the class to GitLab UI and delete it from GitLab should be opened.
#### When should I create component classes?
diff --git a/doc/development/go_guide/index.md b/doc/development/go_guide/index.md
index 6eadcdb5711..fe69a4205f8 100644
--- a/doc/development/go_guide/index.md
+++ b/doc/development/go_guide/index.md
@@ -249,7 +249,7 @@ Programs handling a lot of IO or complex operations should always include
[benchmarks](https://golang.org/pkg/testing/#hdr-Benchmarks), to ensure
performance consistency over time.
-## Using errors
+## Error handling
### Adding context
diff --git a/doc/push_rules/push_rules.md b/doc/push_rules/push_rules.md
index 15d09b31726..5685e848a33 100644
--- a/doc/push_rules/push_rules.md
+++ b/doc/push_rules/push_rules.md
@@ -68,7 +68,7 @@ See [server hooks](../administration/server_hooks.md) for more information.
NOTE: **Note:**
GitLab administrators can set push rules globally under
**Admin Area > Push Rules** that all new projects will inherit. You can later
-override them in a project's settings.
+override them in a project's settings. They can be also set on a [group level](../user/group/index.md#group-push-rules-starter).
1. Navigate to your project's **Settings > Repository** and expand **Push Rules**
1. Set the rule you want
diff --git a/doc/user/admin_area/settings/usage_statistics.md b/doc/user/admin_area/settings/usage_statistics.md
index 0fb96462623..a406210f983 100644
--- a/doc/user/admin_area/settings/usage_statistics.md
+++ b/doc/user/admin_area/settings/usage_statistics.md
@@ -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||
diff --git a/doc/user/group/index.md b/doc/user/group/index.md
index 19c608915eb..f36f3b3fd4f 100644
--- a/doc/user/group/index.md
+++ b/doc/user/group/index.md
@@ -596,6 +596,29 @@ For performance reasons, we may delay the update up to 1 hour and 30 minutes.
If your namespace shows `N/A` as the total storage usage, you can trigger a recalculation by pushing a commit to any project in that namespace.
+#### Group push rules **(STARTER)**
+
+> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/34370) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.8.
+
+Group push rules allow group maintainers to set
+[push rules](../../push_rules/push_rules.md) for newly created projects within the specific group.
+
+To configure push rules for a group, navigate to **{push-rules}** on the group's
+sidebar.
+
+When set, new subgroups have push rules set for them based on either:
+
+- The closest parent group with push rules defined.
+- Push rules set at the instance level, if no parent groups have push rules defined.
+
+##### Enabling the feature
+
+This feature comes with the `:group_push_rules` feature flag disabled by default. It can be enabled for specific group using feature flag [API endpoint](../../api/features.md#set-or-create-a-feature) or by GitLab administrator with Rails console access by running:
+
+```ruby
+Feature.enable(:group_push_rules)
+```
+
### Maximum artifacts size **(CORE ONLY)**
For information about setting a maximum artifact size for a group, see
diff --git a/doc/user/project/integrations/img/webex_teams_configuration.png b/doc/user/project/integrations/img/webex_teams_configuration.png
new file mode 100644
index 00000000000..66993e0887d
--- /dev/null
+++ b/doc/user/project/integrations/img/webex_teams_configuration.png
Binary files differ
diff --git a/doc/user/project/integrations/overview.md b/doc/user/project/integrations/overview.md
index 2e5e247671c..88668ab6c7d 100644
--- a/doc/user/project/integrations/overview.md
+++ b/doc/user/project/integrations/overview.md
@@ -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
diff --git a/doc/user/project/integrations/webex_teams.md b/doc/user/project/integrations/webex_teams.md
new file mode 100644
index 00000000000..a6e688887b6
--- /dev/null
+++ b/doc/user/project/integrations/webex_teams.md
@@ -0,0 +1,24 @@
+# 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.
diff --git a/lib/api/helpers/services_helpers.rb b/lib/api/helpers/services_helpers.rb
index 4c44aca2de4..02e60ff5db5 100644
--- a/lib/api/helpers/services_helpers.rb
+++ b/lib/api/helpers/services_helpers.rb
@@ -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
diff --git a/lib/gitlab/import_export/project/tree_restorer.rb b/lib/gitlab/import_export/project/tree_restorer.rb
index e9c89b803ba..a16ffe36054 100644
--- a/lib/gitlab/import_export/project/tree_restorer.rb
+++ b/lib/gitlab/import_export/project/tree_restorer.rb
@@ -54,7 +54,7 @@ module Gitlab
end
def ndjson_relation_reader
- return unless Feature.enabled?(:project_import_ndjson, project.namespace)
+ return unless Feature.enabled?(:project_import_ndjson, project.namespace, default_enabled: true)
ImportExport::JSON::NdjsonReader.new(
File.join(shared.export_path, 'tree')
diff --git a/lib/gitlab/import_export/project/tree_saver.rb b/lib/gitlab/import_export/project/tree_saver.rb
index 0017aa523c1..7cca3596da6 100644
--- a/lib/gitlab/import_export/project/tree_saver.rb
+++ b/lib/gitlab/import_export/project/tree_saver.rb
@@ -54,7 +54,7 @@ module Gitlab
def json_writer
@json_writer ||= begin
- if ::Feature.enabled?(:project_export_as_ndjson, @project.namespace)
+ if ::Feature.enabled?(:project_export_as_ndjson, @project.namespace, default_enabled: true)
full_path = File.join(@shared.export_path, 'tree')
Gitlab::ImportExport::JSON::NdjsonWriter.new(full_path)
else
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 8a372f03487..6a4e0246090 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -10670,7 +10670,7 @@ msgstr ""
msgid "Group export link has expired. Please generate a new export from your group settings."
msgstr ""
-msgid "Group export started. A download link will be sent by email."
+msgid "Group export started. A download link will be sent by email and made available on this page."
msgstr ""
msgid "Group has been already marked for deletion"
@@ -16426,7 +16426,7 @@ msgstr ""
msgid "Project export link has expired. Please generate a new export from your project settings."
msgstr ""
-msgid "Project export started. A download link will be sent by email."
+msgid "Project export started. A download link will be sent by email and made available on this page."
msgstr ""
msgid "Project has too many %{label_for_message} to search"
@@ -20576,6 +20576,9 @@ msgstr ""
msgid "Subkeys"
msgstr ""
+msgid "Submit %{humanized_resource_name}"
+msgstr ""
+
msgid "Submit Changes"
msgstr ""
diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml
index d246f531493..c78b4501310 100644
--- a/spec/lib/gitlab/import_export/all_models.yml
+++ b/spec/lib/gitlab/import_export/all_models.yml
@@ -493,6 +493,7 @@ project:
- alert_management_alerts
- repository_storage_moves
- freeze_periods
+- webex_teams_service
award_emoji:
- awardable
- user
diff --git a/spec/models/project_services/webex_teams_service_spec.rb b/spec/models/project_services/webex_teams_service_spec.rb
new file mode 100644
index 00000000000..38977ef3b7d
--- /dev/null
+++ b/spec/models/project_services/webex_teams_service_spec.rb
@@ -0,0 +1,10 @@
+# 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
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 1c7e47f8114..7fbca7b8105 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -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) }
diff --git a/spec/presenters/ci/build_runner_presenter_spec.rb b/spec/presenters/ci/build_runner_presenter_spec.rb
index cfa2e77e7cf..de199d2bff9 100644
--- a/spec/presenters/ci/build_runner_presenter_spec.rb
+++ b/spec/presenters/ci/build_runner_presenter_spec.rb
@@ -185,16 +185,19 @@ describe Ci::BuildRunnerPresenter do
subject { presenter.refspecs }
let(:build) { create(:ci_build) }
+ let(:pipeline) { build.pipeline }
it 'returns the correct refspecs' do
- is_expected.to contain_exactly("+refs/heads/#{build.ref}:refs/remotes/origin/#{build.ref}")
+ is_expected.to contain_exactly("+refs/heads/#{build.ref}:refs/remotes/origin/#{build.ref}",
+ "+refs/pipelines/#{pipeline.id}:refs/pipelines/#{pipeline.id}")
end
context 'when ref is tag' do
let(:build) { create(:ci_build, :tag) }
it 'returns the correct refspecs' do
- is_expected.to contain_exactly("+refs/tags/#{build.ref}:refs/tags/#{build.ref}")
+ is_expected.to contain_exactly("+refs/tags/#{build.ref}:refs/tags/#{build.ref}",
+ "+refs/pipelines/#{pipeline.id}:refs/pipelines/#{pipeline.id}")
end
context 'when GIT_DEPTH is zero' do
@@ -204,7 +207,8 @@ describe Ci::BuildRunnerPresenter do
it 'returns the correct refspecs' do
is_expected.to contain_exactly('+refs/tags/*:refs/tags/*',
- '+refs/heads/*:refs/remotes/origin/*')
+ '+refs/heads/*:refs/remotes/origin/*',
+ "+refs/pipelines/#{pipeline.id}:refs/pipelines/#{pipeline.id}")
end
end
end
diff --git a/spec/requests/api/graphql/mutations/snippets/create_spec.rb b/spec/requests/api/graphql/mutations/snippets/create_spec.rb
index cef7fc5cbe3..e1e5fe22887 100644
--- a/spec/requests/api/graphql/mutations/snippets/create_spec.rb
+++ b/spec/requests/api/graphql/mutations/snippets/create_spec.rb
@@ -13,6 +13,7 @@ describe 'Creating a Snippet' do
let(:file_name) { 'Initial file_name' }
let(:visibility_level) { 'public' }
let(:project_path) { nil }
+ let(:uploaded_files) { nil }
let(:mutation) do
variables = {
@@ -21,7 +22,8 @@ describe 'Creating a Snippet' do
visibility_level: visibility_level,
file_name: file_name,
title: title,
- project_path: project_path
+ project_path: project_path,
+ uploaded_files: uploaded_files
}
graphql_mutation(:create_snippet, variables)
@@ -31,6 +33,8 @@ describe 'Creating a Snippet' do
graphql_mutation_response(:create_snippet)
end
+ subject { post_graphql_mutation(mutation, current_user: current_user) }
+
context 'when the user does not have permission' do
let(:current_user) { nil }
@@ -39,7 +43,7 @@ describe 'Creating a Snippet' do
it 'does not create the Snippet' do
expect do
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
end.not_to change { Snippet.count }
end
@@ -48,7 +52,7 @@ describe 'Creating a Snippet' do
it 'does not create the snippet when the user is not authorized' do
expect do
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
end.not_to change { Snippet.count }
end
end
@@ -60,12 +64,12 @@ describe 'Creating a Snippet' do
context 'with PersonalSnippet' do
it 'creates the Snippet' do
expect do
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
end.to change { Snippet.count }.by(1)
end
it 'returns the created Snippet' do
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
expect(mutation_response['snippet']['blob']['richData']).to be_nil
expect(mutation_response['snippet']['blob']['plainData']).to match(content)
@@ -86,12 +90,12 @@ describe 'Creating a Snippet' do
it 'creates the Snippet' do
expect do
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
end.to change { Snippet.count }.by(1)
end
it 'returns the created Snippet' do
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
expect(mutation_response['snippet']['blob']['richData']).to be_nil
expect(mutation_response['snippet']['blob']['plainData']).to match(content)
@@ -106,7 +110,7 @@ describe 'Creating a Snippet' do
let(:project_path) { 'foobar' }
it 'returns an an error' do
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
errors = json_response['errors']
expect(errors.first['message']).to eq(Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR)
@@ -117,7 +121,7 @@ describe 'Creating a Snippet' do
it 'returns an an error' do
project.project_feature.update_attribute(:snippets_access_level, ProjectFeature::DISABLED)
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
errors = json_response['errors']
expect(errors.first['message']).to eq(Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR)
@@ -132,15 +136,41 @@ describe 'Creating a Snippet' do
it 'does not create the Snippet' do
expect do
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
end.not_to change { Snippet.count }
end
it 'does not return Snippet' do
- post_graphql_mutation(mutation, current_user: current_user)
+ subject
expect(mutation_response['snippet']).to be_nil
end
end
+
+ context 'when there uploaded files' do
+ shared_examples 'expected files argument' do |file_value, expected_value|
+ let(:uploaded_files) { file_value }
+
+ it do
+ expect(::Snippets::CreateService).to receive(:new).with(nil, user, hash_including(files: expected_value))
+
+ subject
+ end
+ end
+
+ it_behaves_like 'expected files argument', nil, nil
+ it_behaves_like 'expected files argument', %w(foo bar), %w(foo bar)
+ it_behaves_like 'expected files argument', 'foo', %w(foo)
+
+ context 'when files has an invalid value' do
+ let(:uploaded_files) { [1] }
+
+ it 'returns an error' do
+ subject
+
+ expect(json_response['errors']).to be
+ end
+ end
+ end
end
end
diff --git a/spec/requests/api/graphql/project/alert_management/alerts_spec.rb b/spec/requests/api/graphql/project/alert_management/alerts_spec.rb
index a751d8ce63a..209ac850212 100644
--- a/spec/requests/api/graphql/project/alert_management/alerts_spec.rb
+++ b/spec/requests/api/graphql/project/alert_management/alerts_spec.rb
@@ -7,8 +7,8 @@ describe 'getting Alert Management Alerts' do
let_it_be(:payload) { { 'custom' => { 'alert' => 'payload' } } }
let_it_be(:project) { create(:project, :repository) }
let_it_be(:current_user) { create(:user) }
- let_it_be(:alert_1) { create(:alert_management_alert, :all_fields, :resolved, project: project, issue: nil, severity: :low) }
- let_it_be(:alert_2) { create(:alert_management_alert, :all_fields, project: project, severity: :critical, payload: payload) }
+ let_it_be(:resolved_alert) { create(:alert_management_alert, :all_fields, :resolved, project: project, issue: nil, severity: :low) }
+ let_it_be(:triggered_alert) { create(:alert_management_alert, :all_fields, project: project, severity: :critical, payload: payload) }
let_it_be(:other_project_alert) { create(:alert_management_alert, :all_fields) }
let(:params) { {} }
@@ -58,38 +58,38 @@ describe 'getting Alert Management Alerts' do
it 'returns the correct properties of the alerts' do
expect(first_alert).to include(
- 'iid' => alert_2.iid.to_s,
- 'issueIid' => alert_2.issue_iid.to_s,
- 'title' => alert_2.title,
- 'description' => alert_2.description,
- 'severity' => alert_2.severity.upcase,
+ 'iid' => triggered_alert.iid.to_s,
+ 'issueIid' => triggered_alert.issue_iid.to_s,
+ 'title' => triggered_alert.title,
+ 'description' => triggered_alert.description,
+ 'severity' => triggered_alert.severity.upcase,
'status' => 'TRIGGERED',
- 'monitoringTool' => alert_2.monitoring_tool,
- 'service' => alert_2.service,
- 'hosts' => alert_2.hosts,
- 'eventCount' => alert_2.events,
- 'startedAt' => alert_2.started_at.strftime('%Y-%m-%dT%H:%M:%SZ'),
+ 'monitoringTool' => triggered_alert.monitoring_tool,
+ 'service' => triggered_alert.service,
+ 'hosts' => triggered_alert.hosts,
+ 'eventCount' => triggered_alert.events,
+ 'startedAt' => triggered_alert.started_at.strftime('%Y-%m-%dT%H:%M:%SZ'),
'endedAt' => nil,
'details' => { 'custom.alert' => 'payload' },
- 'createdAt' => alert_2.created_at.strftime('%Y-%m-%dT%H:%M:%SZ'),
- 'updatedAt' => alert_2.updated_at.strftime('%Y-%m-%dT%H:%M:%SZ')
+ 'createdAt' => triggered_alert.created_at.strftime('%Y-%m-%dT%H:%M:%SZ'),
+ 'updatedAt' => triggered_alert.updated_at.strftime('%Y-%m-%dT%H:%M:%SZ')
)
expect(second_alert).to include(
- 'iid' => alert_1.iid.to_s,
+ 'iid' => resolved_alert.iid.to_s,
'issueIid' => nil,
'status' => 'RESOLVED',
- 'endedAt' => alert_1.ended_at.strftime('%Y-%m-%dT%H:%M:%SZ')
+ 'endedAt' => resolved_alert.ended_at.strftime('%Y-%m-%dT%H:%M:%SZ')
)
end
context 'with iid given' do
- let(:params) { { iid: alert_1.iid.to_s } }
+ let(:params) { { iid: resolved_alert.iid.to_s } }
it_behaves_like 'a working graphql query'
it { expect(alerts.size).to eq(1) }
- it { expect(first_alert['iid']).to eq(alert_1.iid.to_s) }
+ it { expect(first_alert['iid']).to eq(resolved_alert.iid.to_s) }
end
context 'sorting data given' do
@@ -99,25 +99,25 @@ describe 'getting Alert Management Alerts' do
it_behaves_like 'a working graphql query'
it 'sorts in the correct order' do
- expect(iids).to eq [alert_1.iid.to_s, alert_2.iid.to_s]
+ expect(iids).to eq [resolved_alert.iid.to_s, triggered_alert.iid.to_s]
end
context 'ascending order' do
let(:params) { 'sort: SEVERITY_ASC' }
it 'sorts in the correct order' do
- expect(iids).to eq [alert_2.iid.to_s, alert_1.iid.to_s]
+ expect(iids).to eq [triggered_alert.iid.to_s, resolved_alert.iid.to_s]
end
end
end
context 'searching' do
- let(:params) { { search: alert_1.title } }
+ let(:params) { { search: resolved_alert.title } }
it_behaves_like 'a working graphql query'
it { expect(alerts.size).to eq(1) }
- it { expect(first_alert['iid']).to eq(alert_1.iid.to_s) }
+ it { expect(first_alert['iid']).to eq(resolved_alert.iid.to_s) }
context 'unknown criteria' do
let(:params) { { search: 'something random' } }
diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb
index 5327a3a77c5..7284f33f3af 100644
--- a/spec/requests/api/runner_spec.rb
+++ b/spec/requests/api/runner_spec.rb
@@ -471,7 +471,8 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
'sha' => job.sha,
'before_sha' => job.before_sha,
'ref_type' => 'branch',
- 'refspecs' => ["+refs/heads/#{job.ref}:refs/remotes/origin/#{job.ref}"],
+ 'refspecs' => ["+refs/pipelines/#{pipeline.id}:refs/pipelines/#{pipeline.id}",
+ "+refs/heads/#{job.ref}:refs/remotes/origin/#{job.ref}"],
'depth' => project.ci_default_git_depth }
end
@@ -578,7 +579,9 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
expect(response).to have_gitlab_http_status(:created)
expect(json_response['git_info']['refspecs'])
- .to contain_exactly('+refs/tags/*:refs/tags/*', '+refs/heads/*:refs/remotes/origin/*')
+ .to contain_exactly("+refs/pipelines/#{pipeline.id}:refs/pipelines/#{pipeline.id}",
+ '+refs/tags/*:refs/tags/*',
+ '+refs/heads/*:refs/remotes/origin/*')
end
end
end
@@ -638,7 +641,9 @@ describe API::Runner, :clean_gitlab_redis_shared_state do
expect(response).to have_gitlab_http_status(:created)
expect(json_response['git_info']['refspecs'])
- .to contain_exactly('+refs/tags/*:refs/tags/*', '+refs/heads/*:refs/remotes/origin/*')
+ .to contain_exactly("+refs/pipelines/#{pipeline.id}:refs/pipelines/#{pipeline.id}",
+ '+refs/tags/*:refs/tags/*',
+ '+refs/heads/*:refs/remotes/origin/*')
end
end
end