2015-08-26 01:42:46 +00:00
|
|
|
module Ci
|
2016-10-06 16:01:32 +00:00
|
|
|
class LintsController < ::ApplicationController
|
2015-09-14 11:37:18 +00:00
|
|
|
before_action :authenticate_user!
|
2015-08-26 01:42:46 +00:00
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2016-01-11 12:34:12 +00:00
|
|
|
@content = params[:content]
|
2016-08-29 13:07:19 +00:00
|
|
|
@error = Ci::GitlabCiYamlProcessor.validation_message(@content)
|
2016-08-30 13:38:36 +00:00
|
|
|
@status = @error.blank?
|
2016-01-11 12:34:12 +00:00
|
|
|
|
2016-08-30 13:38:36 +00:00
|
|
|
if @error.blank?
|
2016-01-11 12:34:12 +00:00
|
|
|
@config_processor = Ci::GitlabCiYamlProcessor.new(@content)
|
2015-08-26 01:42:46 +00:00
|
|
|
@stages = @config_processor.stages
|
|
|
|
@builds = @config_processor.builds
|
2016-09-20 13:19:55 +00:00
|
|
|
@jobs = @config_processor.jobs
|
2015-08-26 01:42:46 +00:00
|
|
|
end
|
2015-11-19 19:16:56 +00:00
|
|
|
rescue
|
2015-12-22 08:40:32 +00:00
|
|
|
@error = 'Undefined error'
|
2015-08-26 01:42:46 +00:00
|
|
|
@status = false
|
2015-12-22 08:40:32 +00:00
|
|
|
ensure
|
|
|
|
render :show
|
2015-08-26 01:42:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|