2018-09-25 23:45:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-13 13:57:16 -04:00
|
|
|
class Projects::Ci::LintsController < Projects::ApplicationController
|
2018-03-21 17:24:49 -04:00
|
|
|
before_action :authorize_create_pipeline!
|
2018-03-13 13:57:16 -04:00
|
|
|
|
2020-10-08 14:08:32 -04:00
|
|
|
feature_category :pipeline_authoring
|
|
|
|
|
2020-11-07 04:08:52 -05:00
|
|
|
respond_to :json, only: [:create]
|
|
|
|
|
2018-03-13 13:57:16 -04:00
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2020-11-07 04:08:52 -05:00
|
|
|
content = params[:content]
|
|
|
|
dry_run = params[:dry_run]
|
2020-08-12 11:10:02 -04:00
|
|
|
|
2020-11-07 04:08:52 -05:00
|
|
|
result = Gitlab::Ci::Lint
|
2020-08-24 11:10:11 -04:00
|
|
|
.new(project: @project, current_user: current_user)
|
2020-11-07 04:08:52 -05:00
|
|
|
.validate(content, dry_run: dry_run)
|
2018-03-13 13:57:16 -04:00
|
|
|
|
2020-11-07 04:08:52 -05:00
|
|
|
render json: ::Ci::Lint::ResultSerializer.new.represent(result)
|
2018-03-13 13:57:16 -04:00
|
|
|
end
|
|
|
|
end
|