2015-09-25 12:07:36 +05:30
|
|
|
module Ci
|
2015-12-23 02:04:40 +05:30
|
|
|
class LintsController < ApplicationController
|
2015-09-25 12:07:36 +05:30
|
|
|
before_action :authenticate_user!
|
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2016-01-14 18:37:52 +05:30
|
|
|
@content = params[:content]
|
|
|
|
|
|
|
|
if @content.blank?
|
2015-09-25 12:07:36 +05:30
|
|
|
@status = false
|
|
|
|
@error = "Please provide content of .gitlab-ci.yml"
|
|
|
|
else
|
2016-01-14 18:37:52 +05:30
|
|
|
@config_processor = Ci::GitlabCiYamlProcessor.new(@content)
|
2015-09-25 12:07:36 +05:30
|
|
|
@stages = @config_processor.stages
|
|
|
|
@builds = @config_processor.builds
|
|
|
|
@status = true
|
|
|
|
end
|
2015-11-26 14:37:03 +05:30
|
|
|
rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
|
2015-09-25 12:07:36 +05:30
|
|
|
@error = e.message
|
|
|
|
@status = false
|
2015-11-26 14:37:03 +05:30
|
|
|
rescue
|
2016-01-14 18:37:52 +05:30
|
|
|
@error = 'Undefined error'
|
2015-09-25 12:07:36 +05:30
|
|
|
@status = false
|
2016-01-14 18:37:52 +05:30
|
|
|
ensure
|
|
|
|
render :show
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|