Commit 1996a7a5 authored by Robert Speicher's avatar Robert Speicher

Merge branch '323863-add-project-id' into 'master'

Add project_id to pipeline REST api

See merge request gitlab-org/gitlab!56339
parents 8b8b0b43 9e43582c
---
title: Add project_id to pipeline api
merge_request: 56339
author:
type: changed
......@@ -61,6 +61,7 @@ Example of response
"name": "teaspoon",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "master",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
......@@ -114,6 +115,7 @@ Example of response
"name": "rspec:other",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "master",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
......@@ -193,6 +195,7 @@ Example of response
"name": "rspec:other",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "master",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
......@@ -256,6 +259,7 @@ Example of response
"name": "teaspoon",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "master",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
......@@ -338,6 +342,7 @@ Example of response
"name": "teaspoon",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "master",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending",
......@@ -419,6 +424,7 @@ Example of response
"name": "rubocop",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "master",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
......@@ -494,6 +500,7 @@ Example of response
"name": "rubocop",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "master",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
......
......@@ -54,6 +54,7 @@ Example of response
[
{
"id": 47,
"project_id": 1,
"status": "pending",
"ref": "new-pipeline",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
......@@ -63,6 +64,7 @@ Example of response
},
{
"id": 48,
"project_id": 1,
"status": "pending",
"ref": "new-pipeline",
"sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a",
......@@ -95,6 +97,7 @@ Example of response
```json
{
"id": 46,
"project_id": 1,
"status": "success",
"ref": "master",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
......@@ -230,6 +233,7 @@ Example of response
```json
{
"id": 61,
"project_id": 1,
"sha": "384c444e840a515b23f21915ee5766b87068a70d",
"ref": "master",
"status": "pending",
......@@ -277,6 +281,7 @@ Response:
```json
{
"id": 46,
"project_id": 1,
"status": "pending",
"ref": "master",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
......@@ -324,6 +329,7 @@ Response:
```json
{
"id": 46,
"project_id": 1,
"status": "canceled",
"ref": "master",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
......
......@@ -4,7 +4,7 @@ module API
module Entities
module Ci
class PipelineBasic < Grape::Entity
expose :id, :sha, :ref, :status
expose :id, :project_id, :sha, :ref, :status
expose :created_at, :updated_at
expose :web_url do |pipeline, _options|
......
{
"type": "object",
"required": ["id", "sha", "ref", "status", "created_at", "updated_at", "web_url"],
"required": ["id", "project_id", "sha", "ref", "status", "created_at", "updated_at", "web_url"],
"properties": {
"id": {
"type": "integer"
},
"project_id": {
"type": "integer"
},
"sha": {
"type": "string"
},
......
......@@ -34,7 +34,7 @@ RSpec.describe API::Ci::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 created_at updated_at])
expect(json_response.first.keys).to contain_exactly(*%w[id project_id sha ref status web_url created_at updated_at])
end
context 'when parameter is passed' do
......@@ -350,6 +350,7 @@ RSpec.describe API::Ci::Pipelines do
expect(json_job['pipeline']).not_to be_empty
expect(json_job['pipeline']['id']).to eq job.pipeline.id
expect(json_job['pipeline']['project_id']).to eq job.pipeline.project_id
expect(json_job['pipeline']['ref']).to eq job.pipeline.ref
expect(json_job['pipeline']['sha']).to eq job.pipeline.sha
expect(json_job['pipeline']['status']).to eq job.pipeline.status
......@@ -512,6 +513,7 @@ RSpec.describe API::Ci::Pipelines do
expect(json_bridge['pipeline']).not_to be_empty
expect(json_bridge['pipeline']['id']).to eq bridge.pipeline.id
expect(json_bridge['pipeline']['project_id']).to eq bridge.pipeline.project_id
expect(json_bridge['pipeline']['ref']).to eq bridge.pipeline.ref
expect(json_bridge['pipeline']['sha']).to eq bridge.pipeline.sha
expect(json_bridge['pipeline']['status']).to eq bridge.pipeline.status
......@@ -522,6 +524,7 @@ RSpec.describe API::Ci::Pipelines do
expect(json_bridge['downstream_pipeline']).not_to be_empty
expect(json_bridge['downstream_pipeline']['id']).to eq downstream_pipeline.id
expect(json_bridge['downstream_pipeline']['project_id']).to eq downstream_pipeline.project_id
expect(json_bridge['downstream_pipeline']['ref']).to eq downstream_pipeline.ref
expect(json_bridge['downstream_pipeline']['sha']).to eq downstream_pipeline.sha
expect(json_bridge['downstream_pipeline']['status']).to eq downstream_pipeline.status
......
......@@ -44,6 +44,7 @@ RSpec.describe API::Jobs do
it 'returns common pipeline data' do
expect(json_response['pipeline']).not_to be_empty
expect(json_response['pipeline']['id']).to eq jobx.pipeline.id
expect(json_response['pipeline']['project_id']).to eq jobx.pipeline.project_id
expect(json_response['pipeline']['ref']).to eq jobx.pipeline.ref
expect(json_response['pipeline']['sha']).to eq jobx.pipeline.sha
expect(json_response['pipeline']['status']).to eq jobx.pipeline.status
......
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