debian-mirror-gitlab/app/controllers/ci/lints_controller.rb

27 lines
670 B
Ruby
Raw Normal View History

2015-09-25 12:07:36 +05:30
module Ci
class LintsController < Ci::ApplicationController
before_action :authenticate_user!
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-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
2015-09-25 12:07:36 +05:30
@error = "Undefined error"
@status = false
end
end
end