Add finished_at to the internal API Deployment entity

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/56130.
This commit is contained in:
Krasimir Angelov 2019-08-14 14:17:13 +03:00
parent 94cf543fe3
commit 18159235a3
5 changed files with 13 additions and 1 deletions

View File

@ -18,6 +18,7 @@ class DeploymentEntity < Grape::Entity
end end
expose :created_at expose :created_at
expose :finished_at
expose :tag expose :tag
expose :last? expose :last?
expose :user, using: UserEntity expose :user, using: UserEntity

View File

@ -4,7 +4,7 @@ class DeploymentSerializer < BaseSerializer
entity DeploymentEntity entity DeploymentEntity
def represent_concise(resource, opts = {}) def represent_concise(resource, opts = {})
opts[:only] = [:iid, :id, :sha, :created_at, :tag, :last?, :id, ref: [:name]] opts[:only] = [:iid, :id, :sha, :created_at, :finished_at, :tag, :last?, :id, ref: [:name]]
represent(resource, opts) represent(resource, opts)
end end
end end

View File

@ -0,0 +1,5 @@
---
title: Add finished_at to the internal API Deployment entity
merge_request: 31808
author:
type: other

View File

@ -3,6 +3,7 @@
"required": [ "required": [
"sha", "sha",
"created_at", "created_at",
"finished_at",
"iid", "iid",
"tag", "tag",
"last?", "last?",
@ -11,6 +12,7 @@
], ],
"properties": { "properties": {
"created_at": { "type": "string" }, "created_at": { "type": "string" },
"finished_at": { "type": ["string", "null"] },
"id": { "type": "integer" }, "id": { "type": "integer" },
"iid": { "type": "integer" }, "iid": { "type": "integer" },
"last?": { "type": "boolean" }, "last?": { "type": "boolean" },

View File

@ -32,6 +32,10 @@ describe DeploymentEntity do
expect(subject).to include(:created_at) expect(subject).to include(:created_at)
end end
it 'exposes finished_at' do
expect(subject).to include(:finished_at)
end
context 'when the pipeline has another manual action' do context 'when the pipeline has another manual action' do
let(:other_build) { create(:ci_build, :manual, name: 'another deploy', pipeline: pipeline) } let(:other_build) { create(:ci_build, :manual, name: 'another deploy', pipeline: pipeline) }
let!(:other_deployment) { create(:deployment, deployable: other_build) } let!(:other_deployment) { create(:deployment, deployable: other_build) }