2017-01-03 18:57:55 -05:00
|
|
|
module Projects
|
|
|
|
module Settings
|
2017-01-23 17:19:39 -05:00
|
|
|
class CiCdController < Projects::ApplicationController
|
2017-01-03 18:57:55 -05:00
|
|
|
before_action :authorize_admin_pipeline!
|
2017-01-06 10:23:32 -05:00
|
|
|
|
2017-01-03 18:57:55 -05:00
|
|
|
def show
|
2017-01-18 14:50:15 -05:00
|
|
|
define_runners_variables
|
2017-01-23 19:51:16 -05:00
|
|
|
define_secret_variables
|
2017-01-18 14:50:15 -05:00
|
|
|
define_triggers_variables
|
|
|
|
define_badges_variables
|
2017-08-30 14:39:23 -04:00
|
|
|
define_auto_devops_variables
|
2017-01-18 14:50:15 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def define_runners_variables
|
2017-01-03 18:57:55 -05:00
|
|
|
@project_runners = @project.runners.ordered
|
2017-06-21 09:48:12 -04:00
|
|
|
@assignable_runners = current_user.ci_authorized_runners
|
|
|
|
.assignable_for(project).ordered.page(params[:page]).per(20)
|
2017-01-03 18:57:55 -05:00
|
|
|
@shared_runners = Ci::Runner.shared.active
|
|
|
|
@shared_runners_count = @shared_runners.count(:all)
|
2017-01-18 14:50:15 -05:00
|
|
|
end
|
|
|
|
|
2017-01-23 19:51:16 -05:00
|
|
|
def define_secret_variables
|
2017-05-03 14:51:55 -04:00
|
|
|
@variable = Ci::Variable.new(project: project)
|
|
|
|
.present(current_user: current_user)
|
|
|
|
@variables = project.variables.order_key_asc
|
|
|
|
.map { |variable| variable.present(current_user: current_user) }
|
2017-01-23 17:19:39 -05:00
|
|
|
end
|
|
|
|
|
2017-01-18 14:50:15 -05:00
|
|
|
def define_triggers_variables
|
2017-01-03 18:57:55 -05:00
|
|
|
@triggers = @project.triggers
|
|
|
|
@trigger = Ci::Trigger.new
|
2017-01-18 14:50:15 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def define_badges_variables
|
2017-01-03 18:57:55 -05:00
|
|
|
@ref = params[:ref] || @project.default_branch || 'master'
|
|
|
|
|
2017-07-19 07:08:47 -04:00
|
|
|
@badges = [Gitlab::Badge::Pipeline::Status,
|
2017-01-03 18:57:55 -05:00
|
|
|
Gitlab::Badge::Coverage::Report]
|
|
|
|
|
|
|
|
@badges.map! do |badge|
|
|
|
|
badge.new(@project, @ref).metadata
|
|
|
|
end
|
|
|
|
end
|
2017-08-30 14:39:23 -04:00
|
|
|
|
|
|
|
def define_auto_devops_variables
|
|
|
|
@auto_devops = @project.auto_devops || ProjectAutoDevops.new
|
|
|
|
end
|
2017-01-03 18:57:55 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|