summaryrefslogtreecommitdiff
path: root/app/controllers/groups/runners_controller.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-04-15 15:16:18 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-04-15 15:16:18 +0000
commit5e8d344de5658ace62c367fc19256488416cdc49 (patch)
tree5a54f9bdb0c0107d43e7d92181a753b908cfd173 /app/controllers/groups/runners_controller.rb
parent792ffb0daf235b6150f696fc1b5ea63fc9845b94 (diff)
downloadgitlab-ce-5e8d344de5658ace62c367fc19256488416cdc49.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/groups/runners_controller.rb')
-rw-r--r--app/controllers/groups/runners_controller.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/app/controllers/groups/runners_controller.rb b/app/controllers/groups/runners_controller.rb
index 859bb0adb4e..f267c1cb857 100644
--- a/app/controllers/groups/runners_controller.rb
+++ b/app/controllers/groups/runners_controller.rb
@@ -2,14 +2,20 @@
class Groups::RunnersController < Groups::ApplicationController
before_action :authorize_read_group_runners!, only: [:index, :show]
+ before_action :authorize_create_group_runners!, only: [:new, :register]
before_action :authorize_update_runner!, only: [:edit, :update, :destroy, :pause, :resume]
- before_action :runner, only: [:edit, :update, :destroy, :pause, :resume, :show]
+ before_action :runner, only: [:edit, :update, :destroy, :pause, :resume, :show, :register]
+
+ before_action only: [:index] do
+ push_frontend_feature_flag(:create_runner_workflow_for_namespace, group)
+ end
feature_category :runner
urgency :low
def index
@group_runner_registration_token = @group.runners_token if can?(current_user, :register_group_runners, group)
+ @group_new_runner_path = new_group_runner_path(@group) if can?(current_user, :create_runner, group)
Gitlab::Tracking.event(self.class.name, 'index', user: current_user, namespace: @group)
end
@@ -28,6 +34,16 @@ class Groups::RunnersController < Groups::ApplicationController
end
end
+ def new
+ render_404 unless create_runner_workflow_for_namespace_enabled?
+
+ @group_runner_registration_token = @group.runners_token
+ end
+
+ def register
+ render_404 unless create_runner_workflow_for_namespace_enabled? && runner.registration_available?
+ end
+
private
def runner
@@ -47,6 +63,16 @@ class Groups::RunnersController < Groups::ApplicationController
render_404
end
+
+ def authorize_create_group_runners!
+ return if can?(current_user, :create_runner, group)
+
+ render_404
+ end
+
+ def create_runner_workflow_for_namespace_enabled?
+ Feature.enabled?(:create_runner_workflow_for_namespace, group)
+ end
end
Groups::RunnersController.prepend_mod