Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ci_cd_controller.rb « settings « groups « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c1dcc463de77c100df7d01103947344cfd1c5ed2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

module Groups
  module Settings
    class CiCdController < Groups::ApplicationController
      skip_cross_project_access_check :show
      before_action :authorize_admin_pipeline!

      def show
        define_ci_variables
      end

      def reset_registration_token
        @group.reset_runners_token!

        flash[:notice] = 'New runners registration token has been generated!'
        redirect_to group_settings_ci_cd_path
      end

      private

      def define_ci_variables
        @variable = Ci::GroupVariable.new(group: group)
          .present(current_user: current_user)
        @variables = group.variables.order_key_asc
          .map { |variable| variable.present(current_user: current_user) }
      end

      def authorize_admin_pipeline!
        return render_404 unless can?(current_user, :admin_pipeline, group)
      end
    end
  end
end