Commit 6cb52964 authored by Robert Speicher's avatar Robert Speicher

Expose web_url attribute in PipelineBasic and JobBasic

parent 1df32177
......@@ -50,6 +50,7 @@ Example of response
"started_at": "2015-12-24T17:54:24.729Z",
"status": "failed",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/6",
"user": {
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"bio": null,
......@@ -82,7 +83,7 @@ Example of response
"size": 1000
},
"finished_at": "2015-12-24T17:54:27.895Z",
"artifacts_expire_at": "2016-01-23T17:54:27.895Z"
"artifacts_expire_at": "2016-01-23T17:54:27.895Z",
"id": 7,
"name": "teaspoon",
"pipeline": {
......@@ -97,6 +98,7 @@ Example of response
"started_at": "2015-12-24T17:54:27.722Z",
"status": "failed",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/7",
"user": {
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"bio": null,
......@@ -151,7 +153,7 @@ Example of response
"created_at": "2015-12-24T15:51:21.727Z",
"artifacts_file": null,
"finished_at": "2015-12-24T17:54:24.921Z",
"artifacts_expire_at": "2016-01-23T17:54:24.921Z"
"artifacts_expire_at": "2016-01-23T17:54:24.921Z",
"id": 6,
"name": "rspec:other",
"pipeline": {
......@@ -166,6 +168,7 @@ Example of response
"started_at": "2015-12-24T17:54:24.729Z",
"status": "failed",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/6",
"user": {
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"bio": null,
......@@ -198,7 +201,7 @@ Example of response
"size": 1000
},
"finished_at": "2015-12-24T17:54:27.895Z",
"artifacts_expire_at": "2016-01-23T17:54:27.895Z"
"artifacts_expire_at": "2016-01-23T17:54:27.895Z",
"id": 7,
"name": "teaspoon",
"pipeline": {
......@@ -213,6 +216,7 @@ Example of response
"started_at": "2015-12-24T17:54:27.722Z",
"status": "failed",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/7",
"user": {
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"bio": null,
......@@ -280,6 +284,7 @@ Example of response
"started_at": "2015-12-24T17:54:30.733Z",
"status": "failed",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/8",
"user": {
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"bio": null,
......@@ -455,7 +460,7 @@ Example of response
"created_at": "2016-01-11T10:13:33.506Z",
"artifacts_file": null,
"finished_at": "2016-01-11T10:14:09.526Z",
"id": 69,
"id": 42,
"name": "rubocop",
"ref": "master",
"runner": null,
......@@ -463,6 +468,7 @@ Example of response
"started_at": null,
"status": "canceled",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/42",
"user": null
}
```
......@@ -501,7 +507,7 @@ Example of response
"created_at": "2016-01-11T10:13:33.506Z",
"artifacts_file": null,
"finished_at": null,
"id": 69,
"id": 42,
"name": "rubocop",
"ref": "master",
"runner": null,
......@@ -509,6 +515,7 @@ Example of response
"started_at": null,
"status": "pending",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/42",
"user": null
}
```
......@@ -549,7 +556,7 @@ Example of response
},
"coverage": null,
"download_url": null,
"id": 69,
"id": 42,
"name": "rubocop",
"ref": "master",
"runner": null,
......@@ -559,6 +566,7 @@ Example of response
"finished_at": "2016-01-11T10:15:10.506Z",
"status": "failed",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/42",
"user": null
}
```
......@@ -599,7 +607,7 @@ Example response:
},
"coverage": null,
"download_url": null,
"id": 69,
"id": 42,
"name": "rubocop",
"ref": "master",
"runner": null,
......@@ -609,6 +617,7 @@ Example response:
"finished_at": "2016-01-11T10:15:10.506Z",
"status": "failed",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/42",
"user": null
}
```
......@@ -647,7 +656,7 @@ Example of response
"created_at": "2016-01-11T10:13:33.506Z",
"artifacts_file": null,
"finished_at": null,
"id": 69,
"id": 42,
"name": "rubocop",
"ref": "master",
"runner": null,
......@@ -655,6 +664,7 @@ Example of response
"started_at": null,
"status": "started",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/42",
"user": null
}
```
......@@ -33,13 +33,15 @@ Example of response
"id": 47,
"status": "pending",
"ref": "new-pipeline",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a"
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"web_url": "https://example.com/foo/bar/pipelines/47"
},
{
"id": 48,
"status": "pending",
"ref": "new-pipeline",
"sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a"
"sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a",
"web_url": "https://example.com/foo/bar/pipelines/48"
}
]
```
......@@ -86,7 +88,8 @@ Example of response
"finished_at": "2016-08-11T11:32:35.145Z",
"committed_at": null,
"duration": null,
"coverage": "30.0"
"coverage": "30.0",
"web_url": "https://example.com/foo/bar/pipelines/46"
}
```
......@@ -133,7 +136,8 @@ Example of response
"finished_at": null,
"committed_at": null,
"duration": null,
"coverage": null
"coverage": null,
"web_url": "https://example.com/foo/bar/pipelines/61"
}
```
......@@ -179,7 +183,8 @@ Response:
"finished_at": "2016-08-11T11:32:35.145Z",
"committed_at": null,
"duration": null,
"coverage": null
"coverage": null,
"web_url": "https://example.com/foo/bar/pipelines/46"
}
```
......@@ -225,7 +230,8 @@ Response:
"finished_at": "2016-08-11T11:32:35.145Z",
"committed_at": null,
"duration": null,
"coverage": null
"coverage": null,
"web_url": "https://example.com/foo/bar/pipelines/46"
}
```
......
......@@ -529,6 +529,10 @@ module API
class PipelineBasic < Grape::Entity
expose :id, :sha, :ref, :status
expose :web_url do |pipeline, _options|
Gitlab::Routing.url_helpers.project_pipeline_url(pipeline.project, pipeline)
end
end
class MergeRequestSimple < ProjectEntity
......@@ -1069,6 +1073,10 @@ module API
expose :user, with: User
expose :commit, with: Commit
expose :pipeline, with: PipelineBasic
expose :web_url do |job, _options|
Gitlab::Routing.url_helpers.project_job_url(job.project, job)
end
end
class Job < JobBasic
......
......@@ -319,6 +319,10 @@
"id": "/properties/updated_at",
"type": "string"
},
"web_url": {
"id": "/properties/web_url",
"type": "string"
},
"user": {
"id": "/properties/user",
"properties": {
......
......@@ -220,6 +220,7 @@ describe API::Jobs do
expect(Time.parse(json_response['finished_at'])).to be_like_time(job.finished_at)
expect(Time.parse(json_response['artifacts_expire_at'])).to be_like_time(job.artifacts_expire_at)
expect(json_response['duration']).to eq(job.duration)
expect(json_response['web_url']).to be_present
end
it 'returns pipeline data' do
......
......@@ -24,7 +24,8 @@ describe API::Pipelines do
expect(json_response).to be_an Array
expect(json_response.first['sha']).to match /\A\h{40}\z/
expect(json_response.first['id']).to eq pipeline.id
expect(json_response.first.keys).to contain_exactly(*%w[id sha ref status])
expect(json_response.first['web_url']).to be_present
expect(json_response.first.keys).to contain_exactly(*%w[id sha ref status web_url])
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