gitlab-org--gitlab-foss/app/controllers/ci/lints_controller.rb

31 lines
716 B
Ruby
Raw Normal View History

2015-08-26 01:42:46 +00:00
module Ci
2015-12-04 11:55:23 +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
@content = params[:content]
if @content.blank?
2015-08-26 01:42:46 +00:00
@status = false
@error = "Please provide content of .gitlab-ci.yml"
else
@config_processor = Ci::GitlabCiYamlProcessor.new(@content)
2015-08-26 01:42:46 +00:00
@stages = @config_processor.stages
@builds = @config_processor.builds
@status = true
end
rescue Ci::GitlabCiYamlProcessor::ValidationError, Psych::SyntaxError => e
2015-08-26 01:42:46 +00:00
@error = e.message
@status = false
rescue
@error = 'Undefined error'
2015-08-26 01:42:46 +00:00
@status = false
ensure
render :show
2015-08-26 01:42:46 +00:00
end
end
end