2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
class Projects::Ci::LintsController < Projects::ApplicationController
|
|
|
|
before_action :authorize_create_pipeline!
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
feature_category :pipeline_authoring
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
respond_to :json, only: [:create]
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2021-01-29 00:20:46 +05:30
|
|
|
content = params[:content]
|
|
|
|
dry_run = params[:dry_run]
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
result = Gitlab::Ci::Lint
|
2020-11-24 15:15:51 +05:30
|
|
|
.new(project: @project, current_user: current_user)
|
2021-01-29 00:20:46 +05:30
|
|
|
.validate(content, dry_run: dry_run)
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
render json: ::Ci::Lint::ResultSerializer.new.represent(result)
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|