diff --git a/client/services/InsightsService.ts b/client/services/InsightsService.ts index e0ad40d..bcac610 100644 --- a/client/services/InsightsService.ts +++ b/client/services/InsightsService.ts @@ -880,6 +880,7 @@ export class InsightsService { allBranches, branch, reportingWindow, + jobName, }: { /** * Project slug in the form `vcs-slug/org-name/repo-name`. The `/` characters may be URL-escaped. For projects that use GitLab or GitHub App, use `circleci` as the `vcs-slug`, replace `org-name` with the organization ID (found in Organization Settings), and replace `repo-name` with the project ID (found in Project Settings). @@ -910,6 +911,10 @@ export class InsightsService { | "last-24-hours" | "last-30-days" | "last-60-days"; + /** + * The name of the jobs you would like to filter from your workflow. If not specified, all workflow jobs will be returned. The job name can either be the full job name or just a substring of the job name. + */ + jobName?: string; }): CancelablePromise<{ /** * Job summary metrics. @@ -1000,6 +1005,7 @@ export class InsightsService { "all-branches": allBranches, branch: branch, "reporting-window": reportingWindow, + "job-name": jobName, }, }); } diff --git a/client/services/JobService.ts b/client/services/JobService.ts index 81f3a1b..bf1df95 100644 --- a/client/services/JobService.ts +++ b/client/services/JobService.ts @@ -187,12 +187,12 @@ export class JobService { }); } /** - * Cancel job + * Cancel job by job number * Cancel job with a given job number. * @returns any * @throws ApiError */ - public static cancelJob({ + public static cancelJobByJobNumber({ jobNumber, projectSlug, }: { diff --git a/swagger.json b/swagger.json index 3919901..3ad82ae 100644 --- a/swagger.json +++ b/swagger.json @@ -3492,6 +3492,16 @@ ], "type": "string" } + }, + { + "description": "The name of the jobs you would like to filter from your workflow. If not specified, all workflow jobs will be returned. The job name can either be the full job name or just a substring of the job name.", + "example": "lint", + "in": "query", + "name": "job-name", + "required": false, + "schema": { + "type": "string" + } } ], "responses": { @@ -7299,7 +7309,7 @@ "/project/{project-slug}/job/{job-number}/cancel": { "post": { "description": "Cancel job with a given job number.", - "operationId": "cancelJob", + "operationId": "cancelJobByJobNumber", "parameters": [ { "description": "The number of the job.", @@ -7357,7 +7367,7 @@ "description": "Error response." } }, - "summary": "Cancel job", + "summary": "Cancel job by job number", "tags": ["Job"] } }, @@ -11610,7 +11620,7 @@ "name": "Project" }, { - "description": "[__EXPERIMENTAL__] Endpoints related to organization usage exports.\n\nThe Usage API is an API provided by CircleCI to customers to access all of their usage data on CircleCI. It contains all the metadata (org, project, pipeline, workflow, and job dimensions) as well as credit consumption data. It is provided at the near lowest level of granularity (at the job run level).\n\n__Restrictions__\n\n* Max result set size of 100MB\n* Query timeout of 4 hours.\n* Max date window of 32 days\n* No PII is surfaced in the Usage API (e.g. email address, Github login name)\n* The POST endpoint can only be queried up to (i.e. is rate limited to) 10 times per hour per org\n* The GET endpoint can only be queried up to (i.e. is rate limited to) 10 times per minute per org\n* To increase performance the API can generate multiple CSV files that need to be merged after download\n\n__Requirements__\n\n* organization ID - To get your organization ID go to to Organization Settings tab in the CircleCI app. ie https://app.circleci.com/settings/organization///overview\n* API Personal Access Token - https://circleci.com/docs/managing-api-tokens/\n\n__Report Fields__\n\n| | Field | Description |\n|---------------------------------------|-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | organization_id | The org ID |\n| | organization_name | The org name |\n| | organization_created_date | The date that the org was created |\n| Project-level attributes | project_id | The project ID / token |\n| | project_name | The project name. For classic orgs, the project name is inherited from Github. For standalone, the org is set by the user. |\n| | project_created_date | The date that the project was created. For classic orgs, this is the date that the repo was authorized on CircleCI. For standalone orgs, this is the date that the project was created on CircleCI |\n| | last_build_finished_at | The date of the last pipeline run on this project |\n| Pipeline-level attributes | vcs_name | The name of the VCS connected to the project on which the pipeline was run |\n| | vcs_url | The URL of the VCS on which the pipeline was run |\n| | vcs_branch | The branch on which the pipeline was run |\n| | pipeline_id | The ID of the pipeline instance that was triggered. If a pipeline is re-run, it will share the same pipeline ID as the original pipeline instance |\n| | pipeline_created_at | The date the pipeline instance was first triggered |\n| | pipeline_number | The pipeline number |\n| | is_unregistered_user | Y/N flag of whether the pipeline was triggered by a CircleCI user or a user not registered on CircleCI. Examples of the latter include users who commit on a connected VCS and consume credits on CircleCI. |\n| | pipeline_trigger_source | The source of the pipeline instance trigger (API, webhook, etc.) |\n| | pipeline_trigger_user_id | The user ID / token of the user who triggered the pipeline |\n| Workflow-level attributes | workflow_id | The ID of the workflow instance that was triggered |\n| | workflow_name | The name of the workflow |\n| | workflow_first_job_queued_at | The timestamp of when the workflow instance started to queue |\n| | workflow_first_job_started_at | The timestamp of when the workflow instance started to run |\n| | workflow_stopped_at | The timestamp of when the workflow instance stopped |\n| | is_workflow_successful | Y/N flag of whether all jobs in the workflow were successfully ran |\n| Job-level attributes | job_name | The name of the job (the name the customer sees in the UI) |\n| | job_id | The ID of the job run instance that was triggered |\n| | job_run_number | The number of the job run instance that was triggered |\n| | job_run_date | The date of the job run instance began |\n| | job_build_status | The status of the job run instance |\n| | resource_class | The resource class of the job run instance |\n| | operating_system | The operating system of the job run instance |\n| | executor | The executor of the job run instance |\n| | parallelism | The parallelism of the job run instance |\n| | job_run_seconds | The duration in seconds of the job run instance |\n| | median_cpu_utilization_pct | The median CPU utilization calculated over the course of the entire job run instance. CPU utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. |\n| | max_cpu_utilization_pct | The max CPU utilization logged over the course of the entire job run instance. CPU utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. |\n| | median_ram_utilization_pct | The median RAM utilization calculated over the course of the entire job run instance. RAM utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. |\n| | max_ram_utilization_pct | The max RAM utilization logged over the course of the entire job run instance. RAM utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. |\n| Credit consumption metrics | compute_credits | The compute credits consumed by this job run instance |\n| | dlc_credits | The docker-layer caching credits consumed by this job run instance |\n| | user_credits | The user credits consumed by this job run instance |\n| | storage_credits | The storage credits consumed by this job run instance |\n| | network_credits | The network credits consumed by this job run instance |\n| | lease_credits | The lease credits consumed by this job run instance |\n| | lease_overage_credits | The lease overage credits consumed by this job run instance |\n| | ipranges_credits | The IP ranges credits consumed by this job run instance |\n| | total_credits | The total credits consumed by this job run instance |\n", + "description": "Endpoints related to organization usage exports.\n\nThe Usage API is an API provided by CircleCI to customers to access all of their usage data on CircleCI. It contains all the metadata (org, project, pipeline, workflow, and job dimensions) as well as credit consumption data. It is provided at the near lowest level of granularity (at the job run level).\n\n__Restrictions__\n\n* Max result set size of 100MB\n* Query timeout of 4 hours.\n* Max date window of 32 days\n* No PII is surfaced in the Usage API (e.g. email address, Github login name)\n* The POST endpoint can only be queried up to (i.e. is rate limited to) 10 times per hour per org\n* The GET endpoint can only be queried up to (i.e. is rate limited to) 10 times per minute per org\n* To increase performance the API can generate multiple CSV files that need to be merged after download\n\n__Requirements__\n\n* organization ID - To get your organization ID go to to Organization Settings tab in the CircleCI app. ie https://app.circleci.com/settings/organization///overview\n* API Personal Access Token - https://circleci.com/docs/managing-api-tokens/\n\n__Report Fields__\n\n| | Field | Description |\n|---------------------------------------|-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | organization_id | The org ID |\n| | organization_name | The org name |\n| | organization_created_date | The date that the org was created |\n| Project-level attributes | project_id | The project ID / token |\n| | project_name | The project name. For classic orgs, the project name is inherited from Github. For standalone, the org is set by the user. |\n| | project_created_date | The date that the project was created. For classic orgs, this is the date that the repo was authorized on CircleCI. For standalone orgs, this is the date that the project was created on CircleCI |\n| | last_build_finished_at | The date of the last pipeline run on this project |\n| Pipeline-level attributes | vcs_name | The name of the VCS connected to the project on which the pipeline was run |\n| | vcs_url | The URL of the VCS on which the pipeline was run |\n| | vcs_branch | The branch on which the pipeline was run |\n| | pipeline_id | The ID of the pipeline instance that was triggered. If a pipeline is re-run, it will share the same pipeline ID as the original pipeline instance |\n| | pipeline_created_at | The date the pipeline instance was first triggered |\n| | pipeline_number | The pipeline number |\n| | is_unregistered_user | Y/N flag of whether the pipeline was triggered by a CircleCI user or a user not registered on CircleCI. Examples of the latter include users who commit on a connected VCS and consume credits on CircleCI. |\n| | pipeline_trigger_source | The source of the pipeline instance trigger (API, webhook, etc.) |\n| | pipeline_trigger_user_id | The user ID / token of the user who triggered the pipeline |\n| Workflow-level attributes | workflow_id | The ID of the workflow instance that was triggered |\n| | workflow_name | The name of the workflow |\n| | workflow_first_job_queued_at | The timestamp of when the workflow instance started to queue |\n| | workflow_first_job_started_at | The timestamp of when the workflow instance started to run |\n| | workflow_stopped_at | The timestamp of when the workflow instance stopped |\n| | is_workflow_successful | Y/N flag of whether all jobs in the workflow were successfully ran |\n| Job-level attributes | job_name | The name of the job (the name the customer sees in the UI) |\n| | job_id | The ID of the job run instance that was triggered |\n| | job_run_number | The number of the job run instance that was triggered |\n| | job_run_date | The date of the job run instance began |\n| | job_build_status | The status of the job run instance |\n| | resource_class | The resource class of the job run instance |\n| | operating_system | The operating system of the job run instance |\n| | executor | The executor of the job run instance |\n| | parallelism | The parallelism of the job run instance |\n| | job_run_seconds | The duration in seconds of the job run instance |\n| | median_cpu_utilization_pct | The median CPU utilization calculated over the course of the entire job run instance. CPU utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. |\n| | max_cpu_utilization_pct | The max CPU utilization logged over the course of the entire job run instance. CPU utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. |\n| | median_ram_utilization_pct | The median RAM utilization calculated over the course of the entire job run instance. RAM utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. |\n| | max_ram_utilization_pct | The max RAM utilization logged over the course of the entire job run instance. RAM utilization is logged every 15 seconds. It will not be available for any jobs under 15 seconds and occasionally will not be available for jobs greater than 15 seconds. |\n| Credit consumption metrics | compute_credits | The compute credits consumed by this job run instance |\n| | dlc_credits | The docker-layer caching credits consumed by this job run instance |\n| | user_credits | The user credits consumed by this job run instance |\n| | storage_credits | The storage credits consumed by this job run instance |\n| | network_credits | The network credits consumed by this job run instance |\n| | lease_credits | The lease credits consumed by this job run instance |\n| | lease_overage_credits | The lease overage credits consumed by this job run instance |\n| | ipranges_credits | The IP ranges credits consumed by this job run instance |\n| | total_credits | The total credits consumed by this job run instance |\n", "name": "Usage" } ]