BigW Consortium Gitlab

Commit fb1c7254 by Katarzyna Kobierska

API for CI Lint

parent 1d548869
...@@ -24,6 +24,7 @@ module Ci ...@@ -24,6 +24,7 @@ module Ci
mount ::Ci::API::Builds mount ::Ci::API::Builds
mount ::Ci::API::Runners mount ::Ci::API::Runners
mount ::Ci::API::Triggers mount ::Ci::API::Triggers
mount ::Ci::API::Lint
end end
end end
end end
...@@ -59,6 +59,13 @@ module Ci ...@@ -59,6 +59,13 @@ module Ci
expose :id, :variables expose :id, :variables
expose :pipeline, using: Commit, as: :commit expose :pipeline, using: Commit, as: :commit
end end
class Lint < Grape::Entity
expose :content
expose :status
expose :builds
expose :stages
end
end end
end end
end end
module Ci
module API
class Lint < Grape::API
before { authenticate! }
resources :lint do
post do
content = params[:content]
if content
config_processor = Ci::GitlabCiYamlProcessor.new(content)
stages = config_processor.stages
builds = config_processor.builds
status = true
response = { status: status, stages: stages, builds: builds }
end
response
end
end
end
end
end
require 'spec_helper'
describe Ci::API::API do
include ApiHelpers
let(:content) do
File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
end
describe "Builds API for Lint" do
describe 'POST /ci/lint' do
before { content }
context "with valid .gitlab-ci.yaml file" do
it "has success status" do
# binding.pry
expect(response).to have_content(true)
end
end
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment