From d17bb5cf560b9e293db70f19aad722bce20d5a2b Mon Sep 17 00:00:00 2001 From: RoyPaarMS <86677937+RoyPaarMS@users.noreply.github.com> Date: Tue, 27 Sep 2022 19:39:52 -0500 Subject: [PATCH] GitLab (Independent Publisher) (#1848) * GitLab (Independent Publisher) Added support triggering pipelines, creating a pipeline trigger, linking a runner to a project, and updating a merge request. * GitLab (Independent Publisher) Fixed swagger issues * GitLab (Independent Publisher) Updated summaries * GitLab (Independent Publisher) Removed warnings --- .../GitLab/apiDefinition.swagger.json | 271 ++++++++++++++---- .../GitLab/readme.md | 14 +- 2 files changed, 230 insertions(+), 55 deletions(-) diff --git a/independent-publisher-connectors/GitLab/apiDefinition.swagger.json b/independent-publisher-connectors/GitLab/apiDefinition.swagger.json index f3dd3f53b..01fb3131d 100644 --- a/independent-publisher-connectors/GitLab/apiDefinition.swagger.json +++ b/independent-publisher-connectors/GitLab/apiDefinition.swagger.json @@ -39,12 +39,6 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/VersionResponse" - }, - "examples": { - "application/json": { - "version": "13.3.0-pre", - "revision": "f2b05afebb0" - } } }, "401": { @@ -97,12 +91,6 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/ProjectResponse" - }, - "examples": { - "application/json": { - "version": "13.3.0-pre", - "revision": "f2b05afebb0" - } } }, "401": { @@ -155,12 +143,6 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/ProjectResponse" - }, - "examples": { - "application/json": { - "version": "13.3.0-pre", - "revision": "f2b05afebb0" - } } }, "401": { @@ -221,12 +203,6 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/CompareResponse" - }, - "examples": { - "application/json": { - "version": "13.3.0-pre", - "revision": "f2b05afebb0" - } } }, "401": { @@ -280,12 +256,6 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/BranchResponse" - }, - "examples": { - "application/json": { - "version": "13.3.0-pre", - "revision": "f2b05afebb0" - } } }, "401": { @@ -347,12 +317,6 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/CommitResponse" - }, - "examples": { - "application/json": { - "version": "13.3.0-pre", - "revision": "f2b05afebb0" - } } }, "401": { @@ -413,12 +377,6 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/MergeResponse" - }, - "examples": { - "application/json": { - "version": "13.3.0-pre", - "revision": "f2b05afebb0" - } } }, "401": { @@ -490,12 +448,59 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/MergeResponse" - }, - "examples": { - "application/json": { - "version": "13.3.0-pre", - "revision": "f2b05afebb0" - } + } + }, + "401": { + "description": "unauthorized operation" + } + } + } + }, + "/projects/{id}/merge_requests/{merge_request_iid}": { + "put": { + "description": "Update a merge request.", + "summary": "updateMergeRequest", + "tags": [ + "project" + ], + "operationId": "updateMergeRequest", + "deprecated": false, + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "type": "integer", + "x-ms-summary": "The ID or URL-encoded path of the project owned by the authenticated user.", + "description": "The ID or URL-encoded path of the project owned by the authenticated user.", + "x-ms-url-encoding": "single" + }, + { + "name": "merge_request_iid", + "required": true, + "in": "path", + "type": "integer", + "x-ms-summary": "The internal ID of the merge request.", + "description": "The internal ID of the merge request.", + "x-ms-url-encoding": "single" + }, + { + "name": "state_event", + "required": false, + "in": "query", + "type": "string", + "x-ms-summary": "Update the status of the merge request ie close or reopen.", + "description": "Update the status of the merge request ie close or reopen." + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/MergeResponse" } }, "401": { @@ -549,12 +554,146 @@ "description": "successful operation", "schema": { "$ref": "#/definitions/GetFileResponse" - }, - "examples": { - "application/json": { - "version": "13.3.0-pre", - "revision": "f2b05afebb0" - } + } + }, + "401": { + "description": "unauthorized operation" + } + } + } + }, + "/projects/{id}/triggers": { + "post": { + "description": "Create a trigger for a project", + "summary": "createTrigger", + "tags": [ + "project" + ], + "operationId": "createTrigger", + "deprecated": false, + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "type": "integer", + "x-ms-summary": "The ID or URL-encoded path of the project owned by the authenticated user.", + "description": "The ID or URL-encoded path of the project owned by the authenticated user.", + "x-ms-url-encoding": "single" + }, + { + "name": "description", + "required": true, + "in": "query", + "type": "string", + "x-ms-summary": "The trigger name.", + "description": "The trigger name." + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/CreateTriggerResponse" + } + }, + "401": { + "description": "unauthorized operation" + } + } + } + }, + "/projects/{id}/trigger/pipeline": { + "post": { + "description": "Trigger a CICD Pipeline.", + "summary": "triggerPipeline", + "tags": [ + "project" + ], + "operationId": "triggerPipeline", + "deprecated": false, + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "type": "integer", + "x-ms-summary": "The ID or URL-encoded path of the project owned by the authenticated user.", + "description": "The ID or URL-encoded path of the project owned by the authenticated user.", + "x-ms-url-encoding": "single" + }, + { + "name": "token", + "required": true, + "in": "query", + "type": "string", + "x-ms-summary": "URL encoded full path to new file.", + "description": "URL encoded full path to new file." + }, + { + "name": "ref", + "required": true, + "in": "query", + "type": "string", + "x-ms-summary": "The name of branch tag or commit.", + "description": "The name of branch tag or commit." + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/TriggerPipelineResponse" + } + }, + "401": { + "description": "unauthorized operation" + } + } + } + }, + "/projects/{id}/runners": { + "post": { + "description": "Enable a runner in project.", + "summary": "enableRunner", + "tags": [ + "project" + ], + "operationId": "enableRunner", + "deprecated": false, + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "type": "integer", + "x-ms-summary": "The ID or URL-encoded path of the project owned by the authenticated user.", + "description": "The ID or URL-encoded path of the project owned by the authenticated user.", + "x-ms-url-encoding": "single" + }, + { + "name": "runner_id", + "required": true, + "in": "query", + "type": "integer", + "x-ms-summary": "The ID of a runner.", + "description": "The ID of a runner." + } + ], + "responses": { + "200": { + "description": "successful operation", + "schema": { + "$ref": "#/definitions/EnableRunnerResponse" } }, "401": { @@ -621,6 +760,30 @@ } } }, + "CreateTriggerResponse": { + "type": "object", + "properties": { + "statusDetails": { + "$ref": "#/definitions/statusDetails" + } + } + }, + "TriggerPipelineResponse": { + "type": "object", + "properties": { + "statusDetails": { + "$ref": "#/definitions/statusDetails" + } + } + }, + "EnableRunnerResponse": { + "type": "object", + "properties": { + "statusDetails": { + "$ref": "#/definitions/statusDetails" + } + } + }, "statusDetails": { "type": "object", "properties": { diff --git a/independent-publisher-connectors/GitLab/readme.md b/independent-publisher-connectors/GitLab/readme.md index 5d67524ef..bc9986a27 100644 --- a/independent-publisher-connectors/GitLab/readme.md +++ b/independent-publisher-connectors/GitLab/readme.md @@ -31,12 +31,24 @@ Create a commit by posting a JSON payload. ### Create a Merge Request Create a new merge request. -### Marge a Marge Request +### Merge a Merge Request Accept and merge changes submitted with MR. +### Update a Merge Request +Update a merge request, for example close or reopen an MR. + ### Get a File From a Repository Fetch, create, update, and delete files in your repository. +### Create a CI/CD Pipeline Trigger +Create a pipeline trigger so that you can trigger your CI/CD pipeline with a webservice call. + +### Trigger a CI/CD Pipeline +Use your pipeline trigger to trigger a CI/CD pipeline. + +### Enable a Runner +Pass in the ID of a shared runner with the image and tools you need to execute your pipeline so that your project can build on that runner. + ## API Documentation https://docs.gitlab.com/ee/api/