summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-03 09:09:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-03 09:09:50 +0000
commit29761d24b86b7a091ca83df4e8cd1cc14f81d534 (patch)
treeeb77242b6d1685f14428caad63edd10e71502d02 /lib
parent74081733481d7d3d480a5e887ac768fe30f84055 (diff)
downloadgitlab-ce-29761d24b86b7a091ca83df4e8cd1cc14f81d534.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/v3/github.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/api/v3/github.rb b/lib/api/v3/github.rb
index db71e823b1d..7d8c37cd39b 100644
--- a/lib/api/v3/github.rb
+++ b/lib/api/v3/github.rb
@@ -1,10 +1,11 @@
# frozen_string_literal: true
+# The endpoints by default return `404` in preparation for their removal
+# (also see comment above `#reversible_end_of_life!`).
+# https://gitlab.com/gitlab-org/gitlab/-/issues/362168
+#
# These endpoints partially mimic Github API behavior in order to successfully
# integrate with Jira Development Panel.
-# Endpoints returning an empty list were temporarily added to avoid 404's
-# during Jira's DVCS integration.
-#
module API
module V3
class Github < ::API::Base
@@ -28,6 +29,8 @@ module API
feature_category :integrations
before do
+ reversible_end_of_life!
+
authorize_jira_user_agent!(request)
authenticate!
end
@@ -38,6 +41,17 @@ module API
requires :project, type: String
end
+ # The endpoints in this class have been deprecated since 15.1.
+ #
+ # Due to uncertainty about the impact of a full removal in 16.0, all endpoints return `404`
+ # by default but we allow customers to toggle a flag to reverse this breaking change.
+ # See https://gitlab.com/gitlab-org/gitlab/-/issues/362168#note_1347692683.
+ #
+ # TODO Make the breaking change irreversible https://gitlab.com/gitlab-org/gitlab/-/issues/408148.
+ def reversible_end_of_life!
+ not_found! unless Feature.enabled?(:jira_dvcs_end_of_life_amnesty)
+ end
+
def authorize_jira_user_agent!(request)
not_found! unless Gitlab::Jira::Middleware.jira_dvcs_connector?(request.env)
end