Commit 8d3e8069 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Add information about project

parent 83607a4d
......@@ -261,6 +261,15 @@ Example response:
"sha": "97de212e80737a608d939f648d959671fb0a0142",
"ref": "master",
"status": "pending"
},
"project": {
"id": 1,
"description": null,
"name": "project1",
"name_with_namespace": "John Doe2 / project1",
"path": "project1",
"path_with_namespace": "namespace1/project1",
"created_at": "2017-11-16T18:38:46.620Z"
}
}
]
......
......@@ -80,16 +80,21 @@ module API
expose :group_access, as: :group_access_level
end
class BasicProjectDetails < Grape::Entity
expose :id, :description, :default_branch, :tag_list
expose :ssh_url_to_repo, :http_url_to_repo, :web_url
class ProjectIdentity < Grape::Entity
expose :id, :description
expose :name, :name_with_namespace
expose :path, :path_with_namespace
expose :created_at
end
class BasicProjectDetails < ProjectIdentity
expose :default_branch, :tag_list
expose :ssh_url_to_repo, :http_url_to_repo, :web_url
expose :avatar_url do |project, options|
project.avatar_url(only_path: false)
end
expose :star_count, :forks_count
expose :created_at, :last_activity_at
expose :last_activity_at
end
class Project < BasicProjectDetails
......@@ -838,6 +843,10 @@ module API
expose :pipeline, with: PipelineBasic
end
class JobWithProject < Job
expose :project, with: ProjectIdentity
end
class Trigger < Grape::Entity
expose :id
expose :token, :description
......
......@@ -85,7 +85,9 @@ module API
destroy_conditionally!(runner)
end
desc 'List jobs running on a runner'
desc 'List jobs running on a runner' do
success Entities::JobWithProject
end
params do
requires :id, type: Integer, desc: 'The ID of the runner'
use :pagination
......@@ -94,7 +96,7 @@ module API
runner = get_runner(params[:id])
authenticate_list_runners_jobs!(runner)
present paginate(runner.builds.running), with: Entities::Job
present paginate(runner.builds.running), with: Entities::JobWithProject
end
end
......
......@@ -356,10 +356,10 @@ describe API::Runners do
describe 'GET /runners/:id/jobs' do
let!(:job_1) { create(:ci_build) }
let!(:job_2) { create(:ci_build, :running, runner: shared_runner) }
let!(:job_3) { create(:ci_build, :failed, runner: shared_runner) }
let!(:job_4) { create(:ci_build, :running, runner: specific_runner) }
let!(:job_5) { create(:ci_build, :failed, runner: specific_runner) }
let!(:job_2) { create(:ci_build, :running, runner: shared_runner, project: project) }
let!(:job_3) { create(:ci_build, :failed, runner: shared_runner, project: project) }
let!(:job_4) { create(:ci_build, :running, runner: specific_runner, project: project) }
let!(:job_5) { create(:ci_build, :failed, runner: specific_runner, project: project) }
context 'admin user' do
context 'when runner exists' do
......
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