Skip to content
Snippets Groups Projects
Commit 0dc3bc41 authored by Z.J. van de Weg's avatar Z.J. van de Weg
Browse files

Update entities, rename from builds to jobs

This commit only renames the commits, the cascading effects will be
dealt with later.


Former-commit-id: f5ae9ecb
parent f0984ef5
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -50,7 +50,7 @@ module API
class ProjectHook < Hook
expose :project_id, :issues_events, :merge_requests_events
expose :note_events, :pipeline_events, :wiki_page_events
expose :job_events, as: :build_events
expose :build_events, as: :job_events
end
 
class BasicProjectDetails < Grape::Entity
Loading
Loading
@@ -94,7 +94,7 @@ module API
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 :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|
SharedGroup.represent(project.project_group_links.all, options)
end
Loading
Loading
@@ -110,7 +110,7 @@ module API
expose :storage_size
expose :repository_size
expose :lfs_objects_size
expose :job_artifacts_size, as: :build_artifacts_size
expose :build_artifacts_size, as: :job_artifacts_size
end
 
class Member < UserBasic
Loading
Loading
@@ -145,7 +145,7 @@ module API
expose :storage_size
expose :repository_size
expose :lfs_objects_size
expose :job_artifacts_size, as: :build_artifacts_size
expose :build_artifacts_size, as: :job_artifacts_size
end
end
end
Loading
Loading
@@ -450,7 +450,7 @@ module API
expose :id, :title, :created_at, :updated_at, :active
expose :push_events, :issues_events, :merge_requests_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 :properties do |service, options|
field_names = service.fields.
Loading
Loading
@@ -622,15 +622,11 @@ module API
end
end
 
<<<<<<< HEAD
class RunnerRegistrationDetails < Grape::Entity
expose :id, :token
end
 
class BuildArtifactFile < Grape::Entity
=======
class JobArtifactFile < Grape::Entity
>>>>>>> 239b5f49c5... Rename Builds to Jobs in the API
expose :filename, :size
end
 
Loading
Loading
Loading
Loading
@@ -76,6 +76,9 @@ describe API::Groups, api: true do
lfs_objects_size: 234,
build_artifacts_size: 345,
}.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)
 
Loading
Loading
Loading
Loading
@@ -18,7 +18,7 @@ describe API::V3::Builds, api: true do
before do
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
 
context 'authorized user' do
Loading
Loading
@@ -91,7 +91,7 @@ describe API::V3::Builds, api: true do
describe 'GET /projects/:id/repository/commits/:sha/builds' do
context 'when commit does not exist in repository' 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
 
it 'responds with 404' do
Loading
Loading
@@ -107,7 +107,7 @@ describe API::V3::Builds, api: true do
create(:ci_build, pipeline: pipeline)
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
 
it 'returns project jobs for specific commit' do
Loading
Loading
@@ -130,7 +130,7 @@ describe API::V3::Builds, api: true do
context 'when pipeline has no jobs' do
before do
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
 
it 'returns an empty array' do
Loading
Loading
@@ -146,7 +146,7 @@ describe API::V3::Builds, api: true do
create(:ci_pipeline, project: project, sha: project.commit.id)
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
 
it 'does not return project jobs' do
Loading
Loading
@@ -159,7 +159,7 @@ describe API::V3::Builds, api: true do
 
describe 'GET /projects/:id/builds/:build_id' 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
 
context 'authorized user' do
Loading
Loading
@@ -189,7 +189,7 @@ describe API::V3::Builds, api: true do
 
describe 'GET /projects/:id/builds/:build_id/artifacts' 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
 
context 'job with artifacts' do
Loading
Loading
@@ -231,7 +231,7 @@ describe API::V3::Builds, api: true do
end
 
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
 
context 'when not logged in' do
Loading
Loading
@@ -324,7 +324,7 @@ describe API::V3::Builds, api: true do
let(:build) { create(:ci_build, :trace, pipeline: pipeline) }
 
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
 
context 'authorized user' do
Loading
Loading
@@ -345,7 +345,7 @@ describe API::V3::Builds, api: true do
 
describe 'POST /projects/:id/builds/:build_id/cancel' 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
 
context 'authorized user' do
Loading
Loading
@@ -378,7 +378,7 @@ describe API::V3::Builds, api: true do
let(:build) { create(:ci_build, :canceled, pipeline: pipeline) }
 
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
 
context 'authorized user' do
Loading
Loading
@@ -410,7 +410,7 @@ describe API::V3::Builds, api: true do
 
describe 'POST /projects/:id/builds/:build_id/erase' 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
 
context 'job is erasable' do
Loading
Loading
@@ -440,7 +440,7 @@ describe API::V3::Builds, api: true do
 
describe 'POST /projects/:id/builds/:build_id/artifacts/keep' 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
 
context 'artifacts did not expire' do
Loading
Loading
@@ -466,7 +466,7 @@ describe API::V3::Builds, api: true do
 
describe 'POST /projects/:id/builds/:build_id/play' 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
 
context 'on an playable job' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment