summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/unreleased/add-timestamps-to-api-pipelines-response.yml5
-rw-r--r--doc/api/pipelines.md8
-rw-r--r--doc/development/database_review.md8
-rw-r--r--lib/api/entities.rb1
-rw-r--r--spec/requests/api/pipelines_spec.rb2
5 files changed, 19 insertions, 5 deletions
diff --git a/changelogs/unreleased/add-timestamps-to-api-pipelines-response.yml b/changelogs/unreleased/add-timestamps-to-api-pipelines-response.yml
new file mode 100644
index 00000000000..54975d3229d
--- /dev/null
+++ b/changelogs/unreleased/add-timestamps-to-api-pipelines-response.yml
@@ -0,0 +1,5 @@
+---
+title: Added timestamps (created_at and updated_at) to API pipelines response
+merge_request: 17911
+author:
+type: added
diff --git a/doc/api/pipelines.md b/doc/api/pipelines.md
index c012c947c3a..90a4f8d6e26 100644
--- a/doc/api/pipelines.md
+++ b/doc/api/pipelines.md
@@ -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",
}
]
```
diff --git a/doc/development/database_review.md b/doc/development/database_review.md
index 1ff23e2935e..39236ab1910 100644
--- a/doc/development/database_review.md
+++ b/doc/development/database_review.md
@@ -95,7 +95,7 @@ and details for a database reviewer:
- Check queries timing (If any): Queries executed in a migration
need to fit comfortably within `15s` - preferably much less than that - on GitLab.com.
- Check [background migrations](background_migrations.md):
- - Establish a time estimate for execution
+ - Establish a time estimate for execution on GitLab.com.
- They should only be used when migrating data in larger tables.
- If a single `update` is below than `1s` the query can be placed
directly in a regular migration (inside `db/migrate`).
@@ -106,7 +106,11 @@ and details for a database reviewer:
that post migrations are executed post-deployment in production.
- Check [timing guidelines for migrations](#timing-guidelines-for-migrations)
- Check migrations are reversible and implement a `#down` method
-- Data migrations should be reversible too or come with a description of how to reverse, when possible. This applies to all types of migrations (regular, post-deploy, background).
+- Check data migrations:
+ - Establish a time estimate for execution on GitLab.com.
+ - Depending on timing, data migrations can be placed on regular, post-deploy or background migrations.
+ - Data migrations should be reversible too or come with a description of how to reverse, when possible.
+ This applies to all types of migrations (regular, post-deploy, background).
- Query performance
- Check for any obviously complex queries and queries the author specifically
points out for review (if any)
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 876dcfa48c6..16cc20e95c5 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -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)
diff --git a/spec/requests/api/pipelines_spec.rb b/spec/requests/api/pipelines_spec.rb
index 3a3f0e970a4..3ac63dc381b 100644
--- a/spec/requests/api/pipelines_spec.rb
+++ b/spec/requests/api/pipelines_spec.rb
@@ -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