diff --git a/doc/api/services.md b/doc/api/services.md index 4bb45497d11b31428cc72d1ad3497c040ad2dcf4..8e7afe41b0c24d68e9b79b069b2aa8de9eb1e39e 100644 --- a/doc/api/services.md +++ b/doc/api/services.md @@ -70,7 +70,7 @@ GET /projects/:id/services/assembla ## Atlassian Bamboo CI -A continuous integration and job server +A continuous integration and build server ### Create/Edit Atlassian Bamboo CI service @@ -85,7 +85,7 @@ PUT /projects/:id/services/bamboo Parameters: - `bamboo_url` (**required**) - Bamboo root URL like https://bamboo.example.com -- `job_key` (**required**) - Bamboo job plan key like KEY +- `build_key` (**required**) - Bamboo build plan key like KEY - `username` (**required**) - A user with API access, if applicable - `password` (**required**) @@ -114,13 +114,13 @@ Continuous integration and deployments Set Buildkite service for a project. ``` -PUT /projects/:id/services/jobkite +PUT /projects/:id/services/buildkite ``` Parameters: - `token` (**required**) - Buildkite project GitLab token -- `project_url` (**required**) - https://jobkite.com/example/project +- `project_url` (**required**) - https://buildkite.com/example/project - `enable_ssl_verification` (optional) - Enable SSL verification ### Delete Buildkite service @@ -128,7 +128,7 @@ Parameters: Delete Buildkite service for a project. ``` -DELETE /projects/:id/services/jobkite +DELETE /projects/:id/services/buildkite ``` ### Get Buildkite service settings @@ -136,12 +136,12 @@ DELETE /projects/:id/services/jobkite Get Buildkite service settings for a project. ``` -GET /projects/:id/services/jobkite +GET /projects/:id/services/buildkite ``` ## Build-Emails -Get emails for GitLab CI jobs. +Get emails for GitLab CI builds. ### Create/Edit Build-Emails service diff --git a/doc/api/v3_to_v4.md b/doc/api/v3_to_v4.md index 67ee2b69c3f500fb870be091111f1cc070f0b2b5..1d24e625f229ab35ffe30e4a51d31a837e0358e8 100644 --- a/doc/api/v3_to_v4.md +++ b/doc/api/v3_to_v4.md @@ -59,6 +59,8 @@ changes are in V4: - Return 202 with JSON body on async removals on V4 API (DELETE `/projects/:id/repository/merged_branches` and DELETE `/projects/:id`) [!9449](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9449) - `projects/:id/milestones?iid[]=x&iid[]=y` array filter has been renamed to `iids` [!9096](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9096) - Return basic info about pipeline in `GET /projects/:id/pipelines` [!8875](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8875) +- Renamed all `build` references to `job` [!9463](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9463) +- Drop GET '/projects/:id/repository/commits/:sha/jobs' [!9463](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9463) - Rename Build Triggers to be Pipeline Triggers API [!9713](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9713) - `POST /projects/:id/trigger/builds` to `POST /projects/:id/trigger/pipeline` - Require description when creating a new trigger `POST /projects/:id/triggers` diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb index b48574e173f48c611a2de3e5ac9b0593f28afa71..33c05e8aa63d6f5201df7620ea0d85f4353fc995 100644 --- a/lib/api/jobs.rb +++ b/lib/api/jobs.rb @@ -40,27 +40,6 @@ module API user_can_download_artifacts: can?(current_user, :read_build, user_project) end - desc 'Get jobs for a specific commit of a project' do - success Entities::Job - end - params do - requires :sha, type: String, desc: 'The SHA id of a commit' - use :optional_scope - use :pagination - end - get ':id/repository/commits/:sha/jobs' do - authorize_read_builds! - - return not_found! unless user_project.commit(params[:sha]) - - pipelines = user_project.pipelines.where(sha: params[:sha]) - builds = user_project.builds.where(pipeline: pipelines).order('id DESC') - builds = filter_builds(builds, params[:scope]) - - present paginate(builds), with: Entities::Job, - user_can_download_artifacts: can?(current_user, :read_build, user_project) - end - desc 'Get a specific job of a project' do success Entities::Job end diff --git a/lib/api/v3/deployments.rb b/lib/api/v3/deployments.rb index c5feb49b22fae593e890ec157d4f8b35f0b6aab8..545485fac0ad436ecd4dbb33a880d33a1629d9c7 100644 --- a/lib/api/v3/deployments.rb +++ b/lib/api/v3/deployments.rb @@ -11,7 +11,7 @@ module API resource :projects do desc 'Get all deployments of the project' do detail 'This feature was introduced in GitLab 8.11.' - success Entities::Deployment + success ::API::V3::Deployments end params do use :pagination @@ -19,12 +19,12 @@ module API get ':id/deployments' do authorize! :read_deployment, user_project - present paginate(user_project.deployments), with: Entities::Deployment + present paginate(user_project.deployments), with: ::API::V3::Deployments end desc 'Gets a specific deployment' do detail 'This feature was introduced in GitLab 8.11.' - success Entities::Deployment + success ::API::V3::Deployments end params do requires :deployment_id, type: Integer, desc: 'The deployment ID' @@ -34,7 +34,7 @@ module API deployment = user_project.deployments.find(params[:deployment_id]) - present deployment, with: Entities::Deployment + present deployment, with: ::API::V3::Deployments end end end diff --git a/spec/requests/api/jobs_spec.rb b/spec/requests/api/jobs_spec.rb index f0e08e737638d4fc9e9fc6c221482358d1d8d979..a4d27734cc227d1048af1de17774e6a956fe01e6 100644 --- a/spec/requests/api/jobs_spec.rb +++ b/spec/requests/api/jobs_spec.rb @@ -75,75 +75,6 @@ describe API::Jobs, api: true do end end - describe 'GET /projects/:id/repository/commits/:sha/jobs' do - context 'when commit does not exist in repository' do - before do - get api("/projects/#{project.id}/repository/commits/1a271fd1/jobs", api_user) - end - - it 'responds with 404' do - expect(response).to have_http_status(404) - end - end - - context 'when commit exists in repository' do - context 'when user is authorized' do - context 'when pipeline has jobs' do - before do - create(:ci_pipeline, project: project, sha: project.commit.id) - create(:ci_build, pipeline: pipeline) - create(:ci_build) - - get api("/projects/#{project.id}/repository/commits/#{project.commit.id}/jobs", api_user) - end - - it 'returns project jobs for specific commit' do - expect(response).to have_http_status(200) - expect(response).to include_pagination_headers - expect(json_response).to be_an Array - expect(json_response.size).to eq 2 - end - - it 'returns pipeline data' do - json_build = json_response.first - expect(json_build['pipeline']).not_to be_empty - expect(json_build['pipeline']['id']).to eq build.pipeline.id - expect(json_build['pipeline']['ref']).to eq build.pipeline.ref - expect(json_build['pipeline']['sha']).to eq build.pipeline.sha - expect(json_build['pipeline']['status']).to eq build.pipeline.status - end - end - - context 'when pipeline has no jobs' do - before do - branch_head = project.commit('feature').id - get api("/projects/#{project.id}/repository/commits/#{branch_head}/jobs", api_user) - end - - it 'returns an empty array' do - expect(response).to have_http_status(200) - expect(json_response).to be_an Array - expect(json_response).to be_empty - end - end - end - - context 'when user is not authorized' do - before 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}/jobs", nil) - end - - it 'does not return project jobs' do - expect(response).to have_http_status(401) - expect(json_response.except('message')).to be_empty - end - end - end - end - describe 'GET /projects/:id/jobs/:job_id' do before do get api("/projects/#{project.id}/jobs/#{build.id}", api_user)