summaryrefslogtreecommitdiff
path: root/app/controllers/ci/lints_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/ci/lints_controller.rb')
-rw-r--r--app/controllers/ci/lints_controller.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/controllers/ci/lints_controller.rb b/app/controllers/ci/lints_controller.rb
new file mode 100644
index 00000000000..a81e4e319ff
--- /dev/null
+++ b/app/controllers/ci/lints_controller.rb
@@ -0,0 +1,26 @@
+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
+ rescue Ci::GitlabCiYamlProcessor::ValidationError => e
+ @error = e.message
+ @status = false
+ rescue Exception => e
+ @error = "Undefined error"
+ @status = false
+ end
+ end
+end