Commit de46afcc authored by Dan Jensen's avatar Dan Jensen Committed by Michael Kozono

Add timestamps to API pipelines responses

Adds the created_at and updated_at attributes to responses from the
API pipelines endpoints.
parent eba6b1cc
---
title: Added timestamps (created_at and updated_at) to API pipelines response
merge_request: 17911
author:
type: added
......@@ -34,14 +34,18 @@ Example of response
"status": "pending",
"ref": "new-pipeline",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"web_url": "https://example.com/foo/bar/pipelines/47"
"web_url": "https://example.com/foo/bar/pipelines/47",
"created_at": "2016-08-11T11:28:34.085Z",
"updated_at": "2016-08-11T11:32:35.169Z",
},
{
"id": 48,
"status": "pending",
"ref": "new-pipeline",
"sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a",
"web_url": "https://example.com/foo/bar/pipelines/48"
"web_url": "https://example.com/foo/bar/pipelines/48",
"created_at": "2016-08-12T10:06:04.561Z",
"updated_at": "2016-08-12T10:09:56.223Z",
}
]
```
......
......@@ -682,6 +682,7 @@ module API
class PipelineBasic < Grape::Entity
expose :id, :sha, :ref, :status
expose :created_at, :updated_at
expose :web_url do |pipeline, _options|
Gitlab::Routing.url_helpers.project_pipeline_url(pipeline.project, pipeline)
......
......@@ -29,7 +29,7 @@ describe API::Pipelines do
expect(json_response.first['sha']).to match /\A\h{40}\z/
expect(json_response.first['id']).to eq pipeline.id
expect(json_response.first['web_url']).to be_present
expect(json_response.first.keys).to contain_exactly(*%w[id sha ref status web_url])
expect(json_response.first.keys).to contain_exactly(*%w[id sha ref status web_url created_at updated_at])
end
context 'when parameter is passed' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment