Read about our upcoming Code of Conduct on this issue

Commit b4eb4b70 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent d3bca170a6fe
......@@ -1190,6 +1190,10 @@ def cache_has_external_issue_tracker
update_column(:has_external_issue_tracker, services.external_issue_trackers.any?) if Gitlab::Database.read_write?
end
def external_references_supported?
external_issue_tracker&.support_cross_reference?
end
def has_wiki?
wiki_enabled? || has_external_wiki?
end
......
......@@ -151,6 +151,14 @@ def execute(data)
result
end
def support_close_issue?
false
end
def support_cross_reference?
false
end
private
def enabled_in_gitlab_config
......
# frozen_string_literal: true
class JiraService < IssueTrackerService
extend ::Gitlab::Utils::Override
include Gitlab::Routing
include ApplicationHelper
include ActionView::Helpers::AssetUrlHelper
......@@ -205,6 +206,16 @@ def test_data(user = nil, project = nil)
nil
end
override :support_close_issue?
def support_close_issue?
true
end
override :support_cross_reference?
def support_cross_reference?
true
end
private
def test_settings
......
......@@ -18,9 +18,9 @@ def execute(issue, commit: nil, notifications: true, system_note: true)
# The code calling this method is responsible for ensuring that a user is
# allowed to close the given issue.
def close_issue(issue, closed_via: nil, notifications: true, system_note: true)
if project.jira_tracker_active? && issue.is_a?(ExternalIssue)
project.jira_service.close_issue(closed_via, issue)
todo_service.close_issue(issue, current_user)
if issue.is_a?(ExternalIssue)
close_external_issue(issue, closed_via)
return issue
end
......@@ -47,6 +47,13 @@ def close_issue(issue, closed_via: nil, notifications: true, system_note: true)
private
def close_external_issue(issue, closed_via)
return unless project.external_issue_tracker&.support_close_issue?
project.external_issue_tracker.close_issue(closed_via, issue)
todo_service.close_issue(issue, current_user)
end
def create_note(issue, current_commit)
SystemNoteService.change_status(issue, issue.project, current_user, issue.state, current_commit)
end
......
......@@ -144,7 +144,7 @@ def cross_reference(mentioner)
#
# Returns Boolean
def cross_reference_disallowed?(mentioner)
return true if noteable.is_a?(ExternalIssue) && !noteable.project.jira_tracker_active?
return true if noteable.is_a?(ExternalIssue) && !noteable.project&.external_references_supported?
return false unless mentioner.is_a?(MergeRequest)
return false unless noteable.is_a?(Commit)
......
# frozen_string_literal: true
require 'omniauth/strategies/saml'
module OmniAuth
module Strategies
class SAML
extend ::Gitlab::Utils::Override
# NOTE: This method duplicates code from omniauth-saml
# so that we can access authn_request to store it
# See: https://github.com/omniauth/omniauth-saml/issues/172
override :request_phase
def request_phase
authn_request = OneLogin::RubySaml::Authrequest.new
......
......@@ -150,3 +150,292 @@ but commented out to help encourage others to add to it in the future. -->
[ee-735]: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/735
[ce-23361]: https://gitlab.com/gitlab-org/gitlab-foss/issues/23361
[ee-6602]: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6602
## Usage Statistics Collected
| Statistic | Section | Stage | Description |
|---|---|---|---|
|uuid|||
|hostname|||
|version|||
|installation_type|||
|active_user_count|||
|recorded_at|||
|edition|||
|license_md5|||
|license_id|||
|historical_max_users|||
|Name|licensee||
|Email|licensee||
|Company|licensee||
|license_user_count|||
|license_starts_at|||
|license_expires_at|||
|license_plan|||
|license_trial|||
|assignee_lists|counts||
|boards|counts||
|ci_builds|counts||
|ci_internal_pipelines|counts||
|ci_external_pipelines|counts||
|ci_pipeline_config_auto_devops|counts||
|ci_pipeline_config_repository|counts||
|ci_runners|counts||
|ci_triggers|counts||
|ci_pipeline_schedules|counts||
|auto_devops_enabled|counts||
|auto_devops_disabled|counts||
|deploy_keys|counts||
|deployments|counts||
|successful_deployments|counts||
|failed_deployments|counts||
|environments|counts||
|clusters|counts||
|clusters_enabled|counts||
|project_clusters_enabled|counts||
|group_clusters_enabled|counts||
|clusters_disabled|counts||
|project_clusters_disabled|counts||
|group_clusters_disabled|counts||
|clusters_platforms_eks|counts||
|clusters_platforms_gke|counts||
|clusters_platforms_user|counts||
|clusters_applications_helm|counts||
|clusters_applications_ingress|counts||
|clusters_applications_cert_managers|counts||
|clusters_applications_crossplane|counts||
|clusters_applications_prometheus|counts||
|clusters_applications_runner|counts||
|clusters_applications_knative|counts||
|clusters_applications_elastic_stack|counts||
|in_review_folder|counts||
|grafana_integrated_projects|counts||
|groups|counts||
|issues|counts||
|issues_created_from_gitlab_error_tracking_ui|counts||
|issues_with_associated_zoom_link|counts||
|issues_using_zoom_quick_actions|counts||
|issues_with_embedded_grafana_charts_approx|counts||
|keys|counts||
|label_lists|counts||
|lfs_objects|counts||
|milestone_lists|counts||
|milestones|counts||
|pages_domains|counts||
|pool_repositories|counts||
|projects|counts||
|projects_imported_from_github|counts||
|projects_with_repositories_enabled|counts||
|projects_with_error_tracking_enabled|counts||
|protected_branches|counts||
|releases|counts||
|remote_mirrors|counts||
|snippets|counts||
|suggestions|counts||
|todos|counts||
|uploads|counts||
|web_hooks|counts||
|projects_alerts_active|counts||
|projects_asana_active|counts||
|projects_assembla_active|counts||
|projects_bamboo_active|counts||
|projects_bugzilla_active|counts||
|projects_buildkite_active|counts||
|projects_campfire_active|counts||
|projects_custom_issue_tracker_active|counts||
|projects_discord_active|counts||
|projects_drone_ci_active|counts||
|projects_emails_on_push_active|counts||
|projects_external_wiki_active|counts||
|projects_flowdock_active|counts||
|projects_github_active|counts||
|projects_hangouts_chat_active|counts||
|projects_hipchat_active|counts||
|projects_irker_active|counts||
|projects_jenkins_active|counts||
|projects_jenkins_deprecated_active|counts||
|projects_jira_active -|counts||
|projects_mattermost_active|counts||
|projects_mattermost_slash_commands_active|counts||
|projects_microsoft_teams_active|counts||
|projects_packagist_active|counts||
|projects_pipelines_email_active|counts||
|projects_pivotaltracker_active|counts||
|projects_prometheus_active|counts||
|projects_pushover_active|counts||
|projects_redmine_active|counts||
|projects_slack_active|counts||
|projects_slack_slash_commands_active|counts||
|projects_teamcity_active|counts||
|projects_unify_circuit_active|counts||
|projects_youtrack_active|counts||
|projects_slack_notifications_active|counts||
|projects_slack_slash_active|counts||
|projects_jira_server_active|counts||
|projects_jira_cloud_active|counts||
|projects_jira_dvcs_cloud_active|counts||
|projects_jira_dvcs_server_active|counts||
|labels|counts||
|merge_requests|counts||
|notes|counts||
|wiki_pages_create|counts||
|wiki_pages_update|counts||
|wiki_pages_delete|counts||
|web_ide_commits|counts||
|web_ide_views|counts||
|web_ide_merge_requests|counts||
|web_ide_previews|counts||
|snippet_comment|counts||
|commit_comment|counts||
|merge_request_comment|counts||
|snippet_create|counts||
|snippet_update|counts||
|navbar_searches|counts||
|cycle_analytics_views|counts||
|productivity_analytics_views|counts||
|source_code_pushes|counts||
|merge_request_create|counts||
|design_management_designs_create|counts||
|design_management_designs_update|counts||
|design_management_designs_delete|counts||
|licenses_list_views|counts||
|user_preferences_group_overview_details|counts||
|user_preferences_group_overview_security_dashboard|counts||
|ingress_modsecurity_blocking|counts||
|ingress_modsecurity_disabled|counts||
|dependency_list_usages_total|counts||
|epics|counts||
|feature_flags|counts||
|geo_nodes|counts||
|incident_issues|counts||
|ldap_group_links|counts||
|ldap_keys|counts||
|ldap_users|counts||
|pod_logs_usages_total|counts||
|projects_enforcing_code_owner_approval|counts||
|projects_mirrored_with_pipelines_enabled|counts||
|projects_reporting_ci_cd_back_to_github|counts||
|projects_with_packages|counts||
|projects_with_prometheus_alerts|counts||
|projects_with_tracing_enabled|counts||
|projects_with_alerts_service_enabled|counts||
|template_repositories|counts||
|container_scanning_jobs|counts||
|dependency_scanning_jobs|counts||
|license_management_jobs|counts||
|sast_jobs|counts||
|epics_deepest_relationship_level|counts||
|operations_dashboard_default_dashboard|counts||
|operations_dashboard_users_with_projects_added|counts||
|container_registry_enabled|||
|dependency_proxy_enabled|||
|gitlab_shared_runners_enabled|||
|gravatar_enabled|||
|influxdb_metrics_enabled|||
|ldap_enabled|||
|mattermost_enabled|||
|omniauth_enabled|||
|prometheus_metrics_enabled|||
|reply_by_email_enabled|||
|signup_enabled|||
|web_ide_clientside_preview_enabled|||
|ingress_modsecurity_enabled|||
|elasticsearch_enabled|||
|license_trial_ends_on|||
|geo_enabled|||
|version|Git||
|version|Gitaly||
|servers|Gitaly||
|filesystems|Gitaly||
|enabled|gitlab_pages||
|version|gitlab_pages||
|adapter|database||
|version|database||
|average|avg_cycle_analytics - issue||
|sd|avg_cycle_analytics - issue||
|missing|avg_cycle_analytics - issue||
|average|avg_cycle_analytics - plan||
|sd|avg_cycle_analytics - plan||
|missing|avg_cycle_analytics - plan||
|average|avg_cycle_analytics - code||
|sd|avg_cycle_analytics - code||
|missing|avg_cycle_analytics - code||
|average|avg_cycle_analytics - test||
|sd|avg_cycle_analytics - test||
|missing|avg_cycle_analytics - test||
|average|avg_cycle_analytics - review||
|sd|avg_cycle_analytics - review||
|missing|avg_cycle_analytics - review||
|average|avg_cycle_analytics - staging||
|sd|avg_cycle_analytics - staging||
|missing|avg_cycle_analytics - staging||
|average|avg_cycle_analytics - production||
|sd|avg_cycle_analytics - production||
|missing|avg_cycle_analytics - production||
|total|avg_cycle_analytics||
|clusters_applications_cert_managers|usage_activity_by_stage|configure|
|clusters_applications_helm|usage_activity_by_stage|configure|
|clusters_applications_ingress|usage_activity_by_stage|configure|
|clusters_applications_knative|usage_activity_by_stage|configure|
|clusters_disabled|usage_activity_by_stage|configure|
|clusters_enabled|usage_activity_by_stage|configure|
|clusters_platforms_gke|usage_activity_by_stage|configure|
|clusters_platforms_eks|usage_activity_by_stage|configure|
|clusters_platforms_user|usage_activity_by_stage|configure|
|group_clusters_disabled|usage_activity_by_stage|configure|
|group_clusters_enabled|usage_activity_by_stage|configure|
|project_clusters_disabled|usage_activity_by_stage|configure|
|project_clusters_enabled|usage_activity_by_stage|configure|
|projects_slack_notifications_active|usage_activity_by_stage|configure|
|projects_slack_slash_active|usage_activity_by_stage|configure|
|projects_with_prometheus_alerts: 0|usage_activity_by_stage|configure|
|deploy_keys|usage_activity_by_stage|create|
|keys|usage_activity_by_stage|create|
|merge_requests|usage_activity_by_stage|create|
|projects_enforcing_code_owner_approval|usage_activity_by_stage|create|
|projects_imported_from_github|usage_activity_by_stage|create|
|projects_with_repositories_enabled|usage_activity_by_stage|create|
|protected_branches|usage_activity_by_stage|create|
|remote_mirrors|usage_activity_by_stage|create|
|snippets|usage_activity_by_stage|create|
|suggestions:|usage_activity_by_stage|create|
|groups|usage_activity_by_stage|manage|
|ldap_keys|usage_activity_by_stage|manage|
|ldap_users: 0|usage_activity_by_stage|manage|
|clusters|usage_activity_by_stage|monitor|
|clusters_applications_prometheus|usage_activity_by_stage|monitor|
|operations_dashboard_default_dashboard|usage_activity_by_stage|monitor|
|operations_dashboard_users_with_projects_added|usage_activity_by_stage|monitor|
|projects_prometheus_active|usage_activity_by_stage|monitor|
|projects_with_error_tracking_enabled|usage_activity_by_stage|monitor|
|projects_with_tracing_enabled: 0|usage_activity_by_stage|monitor|
|projects_with_packages: 0|usage_activity_by_stage|package|
|assignee_lists|usage_activity_by_stage|plan|
|epics|usage_activity_by_stage|plan|
|issues|usage_activity_by_stage|plan|
|label_lists|usage_activity_by_stage|plan|
|milestone_lists|usage_activity_by_stage|plan|
|notes|usage_activity_by_stage|plan|
|projects|usage_activity_by_stage|plan|
|projects_jira_active|usage_activity_by_stage|plan|
|projects_jira_dvcs_cloud_active|usage_activity_by_stage|plan|
|projects_jira_dvcs_server_active|usage_activity_by_stage|plan|
|service_desk_enabled_projects|usage_activity_by_stage|plan|
|service_desk_issues|usage_activity_by_stage|plan|
|todos: 0|usage_activity_by_stage|plan|
|deployments|usage_activity_by_stage|release|
|failed_deployments|usage_activity_by_stage|release|
|projects_mirrored_with_pipelines_enabled|usage_activity_by_stage|release|
|releases|usage_activity_by_stage|release|
|successful_deployments: 0|usage_activity_by_stage|release|
|user_preferences_group_overview_security_dashboard: 0|usage_activity_by_stage|secure|
|ci_builds|usage_activity_by_stage|verify|
|ci_external_pipelines|usage_activity_by_stage|verify|
|ci_internal_pipelines|usage_activity_by_stage|verify|
|ci_pipeline_config_auto_devops|usage_activity_by_stage|verify|
|ci_pipeline_config_repository|usage_activity_by_stage|verify|
|ci_pipeline_schedules|usage_activity_by_stage|verify|
|ci_pipelines|usage_activity_by_stage|verify|
|ci_triggers|usage_activity_by_stage|verify|
|clusters_applications_runner|usage_activity_by_stage|verify|
|projects_reporting_ci_cd_back_to_github: 0|usage_activity_by_stage|verify|
......@@ -44,7 +44,7 @@ def reset_memoized_values
end
def issues
if project && project.jira_tracker?
if project&.external_references_supported?
if project.issues_enabled?
@references[:all_issues] ||= references(:external_issue) + references(:issue)
else
......
......@@ -9949,6 +9949,9 @@ msgstr ""
msgid "GroupRoadmap|Something went wrong while fetching epics"
msgstr ""
 
msgid "GroupRoadmap|Something went wrong while fetching milestones"
msgstr ""
msgid "GroupRoadmap|Sorry, no epics matched your search"
msgstr ""
 
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe OmniAuth::Strategies::SAML, type: :strategy do
describe 'OmniAuth::Strategies::SAML', type: :strategy do
let(:idp_sso_target_url) { 'https://login.example.com/idp' }
let(:strategy) { [OmniAuth::Strategies::SAML, { idp_sso_target_url: idp_sso_target_url }] }
......
......@@ -225,6 +225,24 @@
end
end
context 'with an inactive external issue tracker' do
let(:project) { create(:project) }
let!(:jira_service) { create(:jira_service, project: project, active: false) }
let(:issue) { create(:issue, project: project) }
context 'when GitLab issues are enabled' do
it 'returns only internal issue' do
subject.analyze("JIRA-123 and FOOBAR-4567 and #{issue.to_reference}")
expect(subject.issues).to eq([issue])
end
it 'does not return any issue if the internal one does not exists' do
subject.analyze("JIRA-123 and FOOBAR-4567 and #999")
expect(subject.issues).to be_empty
end
end
end
context 'with a project with an underscore' do
let(:other_project) { create(:project, path: 'test_project') }
let(:issue) { create(:issue, project: other_project) }
......
......@@ -70,6 +70,38 @@
end
describe '#close_issue' do
context 'with external issue' do
context 'with an active external issue tracker supporting close_issue' do
let!(:external_issue_tracker) { create(:jira_service, project: project) }
it 'closes the issue on the external issue tracker' do
expect(project.external_issue_tracker).to receive(:close_issue)
described_class.new(project, user).close_issue(external_issue)
end
end
context 'with innactive external issue tracker supporting close_issue' do
let!(:external_issue_tracker) { create(:jira_service, project: project, active: false) }
it 'does not close the issue on the external issue tracker' do
expect(project.external_issue_tracker).not_to receive(:close_issue)
described_class.new(project, user).close_issue(external_issue)
end
end
context 'with an active external issue tracker not supporting close_issue' do
let!(:external_issue_tracker) { create(:bugzilla_service, project: project) }
it 'does not close the issue on the external issue tracker' do
expect(project.external_issue_tracker).not_to receive(:close_issue)
described_class.new(project, user).close_issue(external_issue)
end
end
end
context "closed by a merge request", :sidekiq_might_not_need_inline do
it 'mentions closure via a merge request' do
perform_enqueued_jobs do
......
......@@ -158,7 +158,7 @@
end
it 'does not close issue' do
allow(jira_tracker).to receive_messages(jira_issue_transition_id: nil)
jira_tracker.update(jira_issue_transition_id: nil)
expect_any_instance_of(JiraService).not_to receive(:transition_issue)
......
......@@ -598,8 +598,8 @@ def build_note(old_assignees, new_assignees)
context 'when mentioner is not a MergeRequest' do
it 'is falsey' do
mentioner = noteable.dup
expect(service.cross_reference_disallowed?(mentioner))
.to be_falsey
expect(service.cross_reference_disallowed?(mentioner)).to be_falsey
end
end
......@@ -609,24 +609,35 @@ def build_note(old_assignees, new_assignees)
it 'is truthy when noteable is in commits' do
expect(mentioner).to receive(:commits).and_return([noteable])
expect(service.cross_reference_disallowed?(mentioner))
.to be_truthy
expect(service.cross_reference_disallowed?(mentioner)).to be_truthy
end
it 'is falsey when noteable is not in commits' do
expect(mentioner).to receive(:commits).and_return([])
expect(service.cross_reference_disallowed?(mentioner))
.to be_falsey
expect(service.cross_reference_disallowed?(mentioner)).to be_falsey
end
end
context 'when notable is an ExternalIssue' do
let(:project) { create(:project) }
let(:noteable) { ExternalIssue.new('EXT-1234', project) }
it 'is truthy' do
mentioner = noteable.dup
expect(service.cross_reference_disallowed?(mentioner))
.to be_truthy
it 'is false with issue tracker supporting referencing' do
create(:jira_service, project: project)
expect(service.cross_reference_disallowed?(noteable)).to be_falsey
end
it 'is true with issue tracker not supporting referencing' do
create(:bugzilla_service, project: project)
expect(service.cross_reference_disallowed?(noteable)).to be_truthy
end
it 'is true without issue tracker' do
expect(service.cross_reference_disallowed?(noteable)).to be_truthy
end
end
end
......
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