Update entities, rename from builds to jobs
This commit only renames the commits, the cascading effects will be dealt with later.
This commit is contained in:
parent
111748ea89
commit
b5b93f80e5
3 changed files with 22 additions and 23 deletions
|
@ -50,7 +50,7 @@ module API
|
||||||
class ProjectHook < Hook
|
class ProjectHook < Hook
|
||||||
expose :project_id, :issues_events, :merge_requests_events
|
expose :project_id, :issues_events, :merge_requests_events
|
||||||
expose :note_events, :pipeline_events, :wiki_page_events
|
expose :note_events, :pipeline_events, :wiki_page_events
|
||||||
expose :job_events, as: :build_events
|
expose :build_events, as: :job_events
|
||||||
end
|
end
|
||||||
|
|
||||||
class BasicProjectDetails < Grape::Entity
|
class BasicProjectDetails < Grape::Entity
|
||||||
|
@ -94,7 +94,7 @@ module API
|
||||||
expose :star_count, :forks_count
|
expose :star_count, :forks_count
|
||||||
expose :open_issues_count, if: lambda { |project, options| project.feature_available?(:issues, options[:current_user]) && project.default_issues_tracker? }
|
expose :open_issues_count, if: lambda { |project, options| project.feature_available?(:issues, options[:current_user]) && project.default_issues_tracker? }
|
||||||
expose :runners_token, if: lambda { |_project, options| options[:user_can_admin_project] }
|
expose :runners_token, if: lambda { |_project, options| options[:user_can_admin_project] }
|
||||||
expose :public_jobs, as: :public_builds
|
expose :public_builds, as: :public_jobs
|
||||||
expose :shared_with_groups do |project, options|
|
expose :shared_with_groups do |project, options|
|
||||||
SharedGroup.represent(project.project_group_links.all, options)
|
SharedGroup.represent(project.project_group_links.all, options)
|
||||||
end
|
end
|
||||||
|
@ -110,7 +110,7 @@ module API
|
||||||
expose :storage_size
|
expose :storage_size
|
||||||
expose :repository_size
|
expose :repository_size
|
||||||
expose :lfs_objects_size
|
expose :lfs_objects_size
|
||||||
expose :job_artifacts_size, as: :build_artifacts_size
|
expose :build_artifacts_size, as: :job_artifacts_size
|
||||||
end
|
end
|
||||||
|
|
||||||
class Member < UserBasic
|
class Member < UserBasic
|
||||||
|
@ -145,7 +145,7 @@ module API
|
||||||
expose :storage_size
|
expose :storage_size
|
||||||
expose :repository_size
|
expose :repository_size
|
||||||
expose :lfs_objects_size
|
expose :lfs_objects_size
|
||||||
expose :job_artifacts_size, as: :build_artifacts_size
|
expose :build_artifacts_size, as: :job_artifacts_size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -450,7 +450,7 @@ module API
|
||||||
expose :id, :title, :created_at, :updated_at, :active
|
expose :id, :title, :created_at, :updated_at, :active
|
||||||
expose :push_events, :issues_events, :merge_requests_events
|
expose :push_events, :issues_events, :merge_requests_events
|
||||||
expose :tag_push_events, :note_events, :pipeline_events
|
expose :tag_push_events, :note_events, :pipeline_events
|
||||||
expose :job_events, as: :build_events
|
expose :build_events, as: :job_events
|
||||||
# Expose serialized properties
|
# Expose serialized properties
|
||||||
expose :properties do |service, options|
|
expose :properties do |service, options|
|
||||||
field_names = service.fields.
|
field_names = service.fields.
|
||||||
|
@ -618,15 +618,11 @@ module API
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
class RunnerRegistrationDetails < Grape::Entity
|
class RunnerRegistrationDetails < Grape::Entity
|
||||||
expose :id, :token
|
expose :id, :token
|
||||||
end
|
end
|
||||||
|
|
||||||
class BuildArtifactFile < Grape::Entity
|
|
||||||
=======
|
|
||||||
class JobArtifactFile < Grape::Entity
|
class JobArtifactFile < Grape::Entity
|
||||||
>>>>>>> 239b5f49c5... Rename Builds to Jobs in the API
|
|
||||||
expose :filename, :size
|
expose :filename, :size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,9 @@ describe API::Groups, api: true do
|
||||||
lfs_objects_size: 234,
|
lfs_objects_size: 234,
|
||||||
build_artifacts_size: 345,
|
build_artifacts_size: 345,
|
||||||
}.stringify_keys
|
}.stringify_keys
|
||||||
|
exposed_attributes = attributes.dup
|
||||||
|
exposed_attributes['job_artifacts_size'] = exposed_attributes['build_artifacts_size']
|
||||||
|
exposed_attributes.delete('build_artifacts_size')
|
||||||
|
|
||||||
project1.statistics.update!(attributes)
|
project1.statistics.update!(attributes)
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe API::V3::Builds, api: true do
|
||||||
before do
|
before do
|
||||||
create(:ci_build, :skipped, pipeline: pipeline)
|
create(:ci_build, :skipped, pipeline: pipeline)
|
||||||
|
|
||||||
get api("/projects/#{project.id}/builds?#{query}", api_user)
|
get v3_api("/projects/#{project.id}/builds?#{query}", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'authorized user' do
|
context 'authorized user' do
|
||||||
|
@ -91,7 +91,7 @@ describe API::V3::Builds, api: true do
|
||||||
describe 'GET /projects/:id/repository/commits/:sha/builds' do
|
describe 'GET /projects/:id/repository/commits/:sha/builds' do
|
||||||
context 'when commit does not exist in repository' do
|
context 'when commit does not exist in repository' do
|
||||||
before do
|
before do
|
||||||
get api("/projects/#{project.id}/repository/commits/1a271fd1/builds", api_user)
|
get v3_api("/projects/#{project.id}/repository/commits/1a271fd1/builds", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'responds with 404' do
|
it 'responds with 404' do
|
||||||
|
@ -107,7 +107,7 @@ describe API::V3::Builds, api: true do
|
||||||
create(:ci_build, pipeline: pipeline)
|
create(:ci_build, pipeline: pipeline)
|
||||||
create(:ci_build)
|
create(:ci_build)
|
||||||
|
|
||||||
get api("/projects/#{project.id}/repository/commits/#{project.commit.id}/builds", api_user)
|
get v3_api("/projects/#{project.id}/repository/commits/#{project.commit.id}/builds", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns project jobs for specific commit' do
|
it 'returns project jobs for specific commit' do
|
||||||
|
@ -130,7 +130,7 @@ describe API::V3::Builds, api: true do
|
||||||
context 'when pipeline has no jobs' do
|
context 'when pipeline has no jobs' do
|
||||||
before do
|
before do
|
||||||
branch_head = project.commit('feature').id
|
branch_head = project.commit('feature').id
|
||||||
get api("/projects/#{project.id}/repository/commits/#{branch_head}/builds", api_user)
|
get v3_api("/projects/#{project.id}/repository/commits/#{branch_head}/builds", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns an empty array' do
|
it 'returns an empty array' do
|
||||||
|
@ -146,7 +146,7 @@ describe API::V3::Builds, api: true do
|
||||||
create(:ci_pipeline, project: project, sha: project.commit.id)
|
create(:ci_pipeline, project: project, sha: project.commit.id)
|
||||||
create(:ci_build, pipeline: pipeline)
|
create(:ci_build, pipeline: pipeline)
|
||||||
|
|
||||||
get api("/projects/#{project.id}/repository/commits/#{project.commit.id}/builds", nil)
|
get v3_api("/projects/#{project.id}/repository/commits/#{project.commit.id}/builds", nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not return project jobs' do
|
it 'does not return project jobs' do
|
||||||
|
@ -159,7 +159,7 @@ describe API::V3::Builds, api: true do
|
||||||
|
|
||||||
describe 'GET /projects/:id/builds/:build_id' do
|
describe 'GET /projects/:id/builds/:build_id' do
|
||||||
before do
|
before do
|
||||||
get api("/projects/#{project.id}/builds/#{build.id}", api_user)
|
get v3_api("/projects/#{project.id}/builds/#{build.id}", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'authorized user' do
|
context 'authorized user' do
|
||||||
|
@ -189,7 +189,7 @@ describe API::V3::Builds, api: true do
|
||||||
|
|
||||||
describe 'GET /projects/:id/builds/:build_id/artifacts' do
|
describe 'GET /projects/:id/builds/:build_id/artifacts' do
|
||||||
before do
|
before do
|
||||||
get api("/projects/#{project.id}/builds/#{build.id}/artifacts", api_user)
|
get v3_api("/projects/#{project.id}/builds/#{build.id}/artifacts", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'job with artifacts' do
|
context 'job with artifacts' do
|
||||||
|
@ -231,7 +231,7 @@ describe API::V3::Builds, api: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
def path_for_ref(ref = pipeline.ref, job = build.name)
|
def path_for_ref(ref = pipeline.ref, job = build.name)
|
||||||
api("/projects/#{project.id}/builds/artifacts/#{ref}/download?job=#{job}", api_user)
|
v3_api("/projects/#{project.id}/builds/artifacts/#{ref}/download?job=#{job}", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when not logged in' do
|
context 'when not logged in' do
|
||||||
|
@ -324,7 +324,7 @@ describe API::V3::Builds, api: true do
|
||||||
let(:build) { create(:ci_build, :trace, pipeline: pipeline) }
|
let(:build) { create(:ci_build, :trace, pipeline: pipeline) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
get api("/projects/#{project.id}/builds/#{build.id}/trace", api_user)
|
get v3_api("/projects/#{project.id}/builds/#{build.id}/trace", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'authorized user' do
|
context 'authorized user' do
|
||||||
|
@ -345,7 +345,7 @@ describe API::V3::Builds, api: true do
|
||||||
|
|
||||||
describe 'POST /projects/:id/builds/:build_id/cancel' do
|
describe 'POST /projects/:id/builds/:build_id/cancel' do
|
||||||
before do
|
before do
|
||||||
post api("/projects/#{project.id}/builds/#{build.id}/cancel", api_user)
|
post v3_api("/projects/#{project.id}/builds/#{build.id}/cancel", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'authorized user' do
|
context 'authorized user' do
|
||||||
|
@ -378,7 +378,7 @@ describe API::V3::Builds, api: true do
|
||||||
let(:build) { create(:ci_build, :canceled, pipeline: pipeline) }
|
let(:build) { create(:ci_build, :canceled, pipeline: pipeline) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
post api("/projects/#{project.id}/builds/#{build.id}/retry", api_user)
|
post v3_api("/projects/#{project.id}/builds/#{build.id}/retry", api_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'authorized user' do
|
context 'authorized user' do
|
||||||
|
@ -410,7 +410,7 @@ describe API::V3::Builds, api: true do
|
||||||
|
|
||||||
describe 'POST /projects/:id/builds/:build_id/erase' do
|
describe 'POST /projects/:id/builds/:build_id/erase' do
|
||||||
before do
|
before do
|
||||||
post api("/projects/#{project.id}/builds/#{build.id}/erase", user)
|
post v3_api("/projects/#{project.id}/builds/#{build.id}/erase", user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'job is erasable' do
|
context 'job is erasable' do
|
||||||
|
@ -440,7 +440,7 @@ describe API::V3::Builds, api: true do
|
||||||
|
|
||||||
describe 'POST /projects/:id/builds/:build_id/artifacts/keep' do
|
describe 'POST /projects/:id/builds/:build_id/artifacts/keep' do
|
||||||
before do
|
before do
|
||||||
post api("/projects/#{project.id}/builds/#{build.id}/artifacts/keep", user)
|
post v3_api("/projects/#{project.id}/builds/#{build.id}/artifacts/keep", user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'artifacts did not expire' do
|
context 'artifacts did not expire' do
|
||||||
|
@ -466,7 +466,7 @@ describe API::V3::Builds, api: true do
|
||||||
|
|
||||||
describe 'POST /projects/:id/builds/:build_id/play' do
|
describe 'POST /projects/:id/builds/:build_id/play' do
|
||||||
before do
|
before do
|
||||||
post api("/projects/#{project.id}/builds/#{build.id}/play", user)
|
post v3_api("/projects/#{project.id}/builds/#{build.id}/play", user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on an playable job' do
|
context 'on an playable job' do
|
||||||
|
|
Loading…
Reference in a new issue