diff --git a/doc/api/deployments.md b/doc/api/deployments.md index 9ce95664435550cb69e8aab090eb061b35abe3f2..9a0d09d2623fd953fb7446c7f9cb460faf2c0e2c 100644 --- a/doc/api/deployments.md +++ b/doc/api/deployments.md @@ -260,10 +260,10 @@ GET /projects/:id/deployments/:deployment_id | Attribute | Type | Required | Description | |-----------|---------|----------|---------------------| | `id` | integer | yes | The ID of a project | -| `deployment_id` | string | yes | The ID of the deployment | +| `deployment_id` | integer | yes | The ID of the deployment | ```bash -curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/deployment/1" +curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/deployments/1" ``` Example of response diff --git a/lib/api/builds.rb b/lib/api/builds.rb index 2bd3b65acdc73e7d756cc5b58e3155d3a638d36f..52bdbcae5a8e68c9e182de535e58ca249cdb2af9 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -202,15 +202,13 @@ module API build = get_build!(params[:build_id]) - if build.playable? - build.play(current_user) + bad_request!("Unplayable Build") unless build.playable? - status 200 - present build, with: Entities::Build, - user_can_download_artifacts: can?(current_user, :read_build, user_project) - else - bad_request!("Unplayable Build") - end + build.play(current_user) + + status 200 + present build, with: Entities::Build, + user_can_download_artifacts: can?(current_user, :read_build, user_project) end end diff --git a/spec/requests/api/builds_spec.rb b/spec/requests/api/builds_spec.rb index 02b7e0c819f9637868d1788211c4c586832a8c1d..9a17a705b1e18af4a91abb3c7c7dc161824949fd 100644 --- a/spec/requests/api/builds_spec.rb +++ b/spec/requests/api/builds_spec.rb @@ -419,6 +419,7 @@ describe API::API, api: true do it 'plays the build' do expect(response).to have_http_status 200 expect(json_response['user']['id']).to eq(user.id) + expect(json_response['id']).to eq(build.id) end end