2015-08-25 21:42:46 -04:00
|
|
|
module Ci
|
2015-12-04 06:55:23 -05:00
|
|
|
class LintsController < ApplicationController
|
2015-09-14 07:37:18 -04:00
|
|
|
before_action :authenticate_user!
|
2015-08-25 21:42:46 -04:00
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
if params[:content].blank?
|
|
|
|
@status = false
|
|
|
|
@error = "Please provide content of .gitlab-ci.yml"
|
|
|
|
else
|
|
|
|
@config_processor = Ci::GitlabCiYamlProcessor.new params[:content]
|
|
|
|
@stages = @config_processor.stages
|
|
|
|
@builds = @config_processor.builds
|
|
|
|
@status = true
|
|
|
|
end
|
2015-11-19 14:16:56 -05:00
|
|
|
rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
|
2015-08-25 21:42:46 -04:00
|
|
|
@error = e.message
|
|
|
|
@status = false
|
2015-11-19 14:16:56 -05:00
|
|
|
rescue
|
2015-12-22 03:40:32 -05:00
|
|
|
@error = 'Undefined error'
|
2015-08-25 21:42:46 -04:00
|
|
|
@status = false
|
2015-12-22 03:40:32 -05:00
|
|
|
ensure
|
|
|
|
render :show
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|