summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-03-06 11:50:32 +0100
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-03-06 14:34:47 +0100
commit75123fa9f706a6ab7cdd5dba4393ad9d8bac0947 (patch)
tree39beb2ae628d37005d3be7d09957ea4616421a77
parent194223476b8df57a56ba096c7a300d51d2e3e750 (diff)
downloadgitlab-ce-75123fa9f706a6ab7cdd5dba4393ad9d8bac0947.tar.gz
Incorporate review, drop old endpoint
The endpoint dropped, get ':id/repository/commits/:sha/jobs', should be replace by a new endpoint.
-rw-r--r--doc/api/services.md14
-rw-r--r--doc/api/v3_to_v4.md2
-rw-r--r--lib/api/jobs.rb21
-rw-r--r--lib/api/v3/deployments.rb8
-rw-r--r--spec/requests/api/jobs_spec.rb69
5 files changed, 13 insertions, 101 deletions
diff --git a/doc/api/services.md b/doc/api/services.md
index 4bb45497d11..8e7afe41b0c 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 67ee2b69c3f..1d24e625f22 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 b48574e173f..33c05e8aa63 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 c5feb49b22f..545485fac0a 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 f0e08e73763..a4d27734cc2 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)