summaryrefslogtreecommitdiff
path: root/doc/administration/external_pipeline_validation.md
blob: cb1d35f24d5834fd7401719549e3978b46da0d20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
stage: Verify
group: Continuous Integration
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference, howto
---

# External Pipeline Validation

You can use an external service for validating a pipeline before it's created.

CAUTION: **Warning:**
This is an experimental feature and subject to change without notice.

## Usage

GitLab will send a POST request to the external service URL with the pipeline
data as payload. GitLab will then invalidate the pipeline based on the response
code. If there's an error or the request times out, the pipeline will not be
invalidated.

Response Code Legend:

- `200` - Accepted
- `4xx` - Not Accepted
- Other Codes - Accepted and Logged

## Configuration

Set the `EXTERNAL_VALIDATION_SERVICE_URL` to the external service URL.

## Payload Schema

```json
{
  "type": "object",
  "required" : [
    "project",
    "user",
    "pipeline",
    "builds"
  ],
  "properties" : {
    "project": {
      "type": "object",
      "required": [
        "id",
        "path"
      ],
      "properties": {
        "id": { "type": "integer" },
        "path": { "type": "string" }
      }
    },
    "user": {
      "type": "object",
      "required": [
        "id",
        "username",
        "email"
      ],
      "properties": {
        "id": { "type": "integer" },
        "username": { "type": "string" },
        "email": { "type": "string" }
      }
    },
    "pipeline": {
      "type": "object",
      "required": [
        "sha",
        "ref",
        "type"
      ],
      "properties": {
        "sha": { "type": "string" },
        "ref": { "type": "string" },
        "type": { "type": "string" }
      }
    },
    "builds": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name",
          "stage",
          "image",
          "services",
          "script"
        ],
        "properties": {
          "name": { "type": "string" },
          "stage": { "type": "string" },
          "image": { "type": ["string", "null"] },
          "services": {
            "type": ["array", "null"],
            "items": { "type": "string" }
          },
          "script": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      }
    }
  },
  "additionalProperties": false
}
```