Skip to content

Commit

Permalink
Merge pull request #200 from mkusaka/update-20241102T000312
Browse files Browse the repository at this point in the history
update 20241102T000312
  • Loading branch information
mkusaka authored Nov 2, 2024
2 parents 9e0d83f + 670f328 commit d0eba27
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 2 deletions.
2 changes: 2 additions & 0 deletions client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export type { DecisionSettings } from "./models/DecisionSettings.ts";
export type { get_usage_export_job_status } from "./models/get_usage_export_job_status.ts";
export type { JSONDuration } from "./models/JSONDuration.ts";
export type { PatchClaimsRequest } from "./models/PatchClaimsRequest.ts";
export type { pipeline } from "./models/pipeline.ts";
export type { pipelineRequest } from "./models/pipelineRequest.ts";
export type { Policy } from "./models/Policy.ts";
export type { PolicyBundle } from "./models/PolicyBundle.ts";
export type { project_settings } from "./models/project_settings.ts";
Expand Down
9 changes: 9 additions & 0 deletions client/models/pipeline.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type pipeline = {
created_at?: string;
id?: string;
number?: number;
state?: "created" | "errored" | "setup-pending" | "setup" | "pending";
};
46 changes: 46 additions & 0 deletions client/models/pipelineRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type pipelineRequest = {
checkout?: {
/**
* The branch that should be used to check out code on a checkout step.
* Note that branch and tag are mutually exclusive.
* To trigger a pipeline for a PR by number use pull/<number>/head for the PR ref or pull/<number>/merge for the merge ref (GitHub only)
*
*/
branch?: string;
/**
* The tag that should be used to check out code on a checkout step.
* The commit that this tag points to is used for the pipeline. Note that branch and tag are mutually exclusive.
*
*/
tag?: string;
};
config?: {
/**
* The branch that should be used to fetch the config file.
* Note that branch and tag are mutually exclusive.
* To trigger a pipeline for a PR by number use pull/<number>/head for the PR ref or pull/<number>/merge for the merge ref (GitHub only)
*
*/
branch?: string;
/**
* The tag that should be used to fetch the config file.
* The commit that this tag points to is used for the pipeline.
* Note that branch and tag are mutually exclusive.
*
*/
tag?: string;
};
/**
* The unique id for the pipeline definition. This can be found in the page Project Settings > Pipelines.
*/
definition_id?: string;
/**
* An object containing pipeline parameters and their values.
* Pipeline parameters have the following size limits: 100 max entries, 128 maximum key length, 512 maximum value length.
*
*/
parameters?: any;
};
47 changes: 46 additions & 1 deletion client/services/PipelineService.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { pipeline } from "../models/pipeline.ts";
import type { pipelineRequest } from "../models/pipelineRequest.ts";
import type { CancelablePromise } from "../core/CancelablePromise.ts";
import { OpenAPI } from "../core/OpenAPI.ts";
import { request as __request } from "../core/request.ts";
Expand Down Expand Up @@ -659,7 +661,7 @@ export class PipelineService {
}
/**
* Trigger a new pipeline
* Not yet available to projects that use GitLab or GitHub App. Triggers a new pipeline on the project.
* Not available to projects that use GitLab or GitHub App. Triggers a new pipeline on the project. **GitHub App users should use the [new Trigger Pipeline API](#tag/Pipeline/operation/triggerPipelineRun)**.
* @returns any Error response.
* @throws ApiError
*/
Expand Down Expand Up @@ -1006,4 +1008,47 @@ export class PipelineService {
},
});
}
/**
* [Recommended] Trigger a new pipeline
* Trigger a pipeline given a pipeline definition ID. Supports all integrations except GitLab.
* @returns pipeline Successful response.
* @throws ApiError
*/
public static triggerPipelineRun({
provider,
organization,
project,
requestBody,
}: {
/**
* The `provider` segment of a project or org slug, the first of the three. This may be a VCS. For projects that use GitHub App, use `circleci`.
*/
provider: "github" | "gh" | "bitbucket" | "bb" | "circleci";
/**
* The `organization` segment of a project or org slug, the second of the three. For GitHub OAuth or Bitbucket projects, this is the organization name. For projects that use GitLab or GitHub App, use the organization ID (found in Organization Settings).
*/
organization: string;
/**
* The `project` segment of a project slug, the third of the three. For GitHub OAuth or Bitbucket projects, this is the repository name. For projects that use GitLab or GitHub App, use the project ID (found in Project Settings).
*/
project: string;
requestBody?: pipelineRequest;
}): CancelablePromise<pipeline> {
return __request(OpenAPI, {
method: "POST",
url: "/project/{provider}/{organization}/{project}/pipeline/run",
path: {
provider: provider,
organization: organization,
project: project,
},
body: requestBody,
mediaType: "application/json",
errors: {
400: `Unexpected request body provided.`,
401: `Credentials provided are invalid.`,
404: `Entity not found.`,
},
});
}
}
144 changes: 143 additions & 1 deletion swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@
"type": "string"
}
},
"providerNoGitlab": {
"description": "The `provider` segment of a project or org slug, the first of the three. This may be a VCS. For projects that use GitHub App, use `circleci`.",
"example": "gh",
"in": "path",
"name": "provider",
"required": true,
"schema": {
"enum": ["github", "gh", "bitbucket", "bb", "circleci"],
"type": "string"
}
},
"restriction_id": {
"description": "An opaque identifier of a context restriction.",
"example": "1c23d2cb-07b1-4a28-8af3-e369732050ed",
Expand Down Expand Up @@ -899,6 +910,88 @@
"required": ["usage_export_job_id", "state", "download_urls"],
"type": "object"
},
"pipeline": {
"additionalProperties": false,
"properties": {
"created_at": {
"format": "date-time",
"type": "string"
},
"id": {
"format": "uuid",
"type": "string"
},
"number": {
"example": 25,
"type": "integer"
},
"state": {
"enum": ["created", "errored", "setup-pending", "setup", "pending"],
"type": "string"
}
},
"type": "object"
},
"pipelineRequest": {
"additionalProperties": false,
"properties": {
"checkout": {
"additionalProperties": false,
"example": {
"tag": "v2"
},
"properties": {
"branch": {
"description": "The branch that should be used to check out code on a checkout step.\nNote that branch and tag are mutually exclusive.\nTo trigger a pipeline for a PR by number use pull/<number>/head for the PR ref or pull/<number>/merge for the merge ref (GitHub only)\n",
"example": "main",
"type": "string"
},
"tag": {
"description": "The tag that should be used to check out code on a checkout step.\nThe commit that this tag points to is used for the pipeline. Note that branch and tag are mutually exclusive.\n",
"example": "v2",
"type": "string"
}
},
"type": "object"
},
"config": {
"additionalProperties": false,
"example": {
"branch": "main"
},
"properties": {
"branch": {
"description": "The branch that should be used to fetch the config file.\nNote that branch and tag are mutually exclusive.\nTo trigger a pipeline for a PR by number use pull/<number>/head for the PR ref or pull/<number>/merge for the merge ref (GitHub only)\n",
"example": "main",
"type": "string"
},
"tag": {
"description": "The tag that should be used to fetch the config file.\nThe commit that this tag points to is used for the pipeline.\nNote that branch and tag are mutually exclusive.\n",
"example": "v2",
"type": "string"
}
},
"type": "object"
},
"definition_id": {
"description": "The unique id for the pipeline definition. This can be found in the page Project Settings > Pipelines.",
"example": "2338d0ae-5541-4bbf-88a2-55e9f7281f80",
"format": "uuid",
"type": "string"
},
"parameters": {
"additionalProperties": true,
"description": "An object containing pipeline parameters and their values.\nPipeline parameters have the following size limits: 100 max entries, 128 maximum key length, 512 maximum value length.\n",
"example": {
"example_param": "my value",
"example_param2": true,
"example_param3": 3
},
"type": "object"
}
},
"type": "object"
},
"project_settings": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -7868,7 +7961,7 @@
"tags": ["Pipeline"]
},
"post": {
"description": "Not yet available to projects that use GitLab or GitHub App. Triggers a new pipeline on the project.",
"description": "Not available to projects that use GitLab or GitHub App. Triggers a new pipeline on the project. **GitHub App users should use the [new Trigger Pipeline API](#tag/Pipeline/operation/triggerPipelineRun)**.",
"operationId": "triggerPipeline",
"parameters": [
{
Expand Down Expand Up @@ -9635,6 +9728,55 @@
"tags": ["Project"]
}
},
"/project/{provider}/{organization}/{project}/pipeline/run": {
"post": {
"description": "Trigger a pipeline given a pipeline definition ID. Supports all integrations except GitLab.",
"operationId": "triggerPipelineRun",
"parameters": [
{
"$ref": "#/components/parameters/providerNoGitlab"
},
{
"$ref": "#/components/parameters/organization"
},
{
"$ref": "#/components/parameters/project"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/pipelineRequest"
}
}
}
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/pipeline"
}
}
},
"description": "Successful response."
},
"400": {
"$ref": "#/components/responses/400_unexpected_request_body"
},
"401": {
"$ref": "#/components/responses/401_invalid_token"
},
"404": {
"$ref": "#/components/responses/404_entity_not_found"
}
},
"summary": "[Recommended] Trigger a new pipeline",
"tags": ["Pipeline"]
}
},
"/project/{provider}/{organization}/{project}/settings": {
"get": {
"description": "[__EXPERIMENTAL__] Returns a list of the advanced settings for a CircleCI project, whether enabled (true) or not (false).",
Expand Down

0 comments on commit d0eba27

Please sign in to comment.