-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - circleci #15009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Components - circleci #15009
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
components/circleci/actions/get-job-artifacts/get-job-artifacts.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import circleci from "../../circleci.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "circleci-get-job-artifacts", | ||
| name: "Get Job Artifacts", | ||
| description: "Retrieves a job's artifacts. [See the documentation](https://circleci.com/docs/api/v2/index.html#tag/Job/operation/getJobArtifacts).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| circleci, | ||
| projectSlug: { | ||
| propDefinition: [ | ||
| circleci, | ||
| "projectSlug", | ||
| ], | ||
| }, | ||
| pipelineId: { | ||
| propDefinition: [ | ||
| circleci, | ||
| "pipelineId", | ||
| (c) => ({ | ||
| projectSlug: c.projectSlug, | ||
| }), | ||
| ], | ||
| }, | ||
| workflowId: { | ||
| propDefinition: [ | ||
| circleci, | ||
| "workflowId", | ||
| (c) => ({ | ||
| pipelineId: c.pipelineId, | ||
| }), | ||
| ], | ||
| }, | ||
| jobNumber: { | ||
| propDefinition: [ | ||
| circleci, | ||
| "jobNumber", | ||
| (c) => ({ | ||
| workflowId: c.workflowId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.circleci.getJobArtifacts({ | ||
| $, | ||
| projectSlug: this.projectSlug, | ||
| jobNumber: this.jobNumber, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved artifacts for job number: ${this.jobNumber}`); | ||
| return response; | ||
| }, | ||
| }; |
79 changes: 79 additions & 0 deletions
79
components/circleci/actions/rerun-workflow/rerun-workflow.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import circleci from "../../circleci.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "circleci-rerun-workflow", | ||
| name: "Rerun Workflow", | ||
| description: "Reruns the specified workflow. [See the documentation](https://circleci.com/docs/api/v2/index.html#tag/Workflow/operation/rerunWorkflow)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| circleci, | ||
| projectSlug: { | ||
| propDefinition: [ | ||
| circleci, | ||
| "projectSlug", | ||
| ], | ||
| }, | ||
| pipelineId: { | ||
| propDefinition: [ | ||
| circleci, | ||
| "pipelineId", | ||
| (c) => ({ | ||
| projectSlug: c.projectSlug, | ||
| }), | ||
| ], | ||
| }, | ||
| workflowId: { | ||
| propDefinition: [ | ||
| circleci, | ||
| "workflowId", | ||
| (c) => ({ | ||
| pipelineId: c.pipelineId, | ||
| }), | ||
| ], | ||
| }, | ||
| enableSsh: { | ||
| type: "boolean", | ||
| label: "Enable SSH", | ||
| description: "Whether to enable SSH access for the triggering user on the newly-rerun job. Requires the jobs parameter to be used and so is mutually exclusive with the from_failed parameter.", | ||
| optional: true, | ||
| }, | ||
| fromFailed: { | ||
| type: "boolean", | ||
| label: "From Failed", | ||
| description: "Whether to rerun the workflow from the failed job. Mutually exclusive with the jobs parameter.", | ||
| optional: true, | ||
| }, | ||
| jobIds: { | ||
| propDefinition: [ | ||
| circleci, | ||
| "jobIds", | ||
| (c) => ({ | ||
| workflowId: c.workflowId, | ||
| }), | ||
| ], | ||
| }, | ||
| sparseTree: { | ||
| type: "boolean", | ||
| label: "Sparse Tree", | ||
| description: "", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.circleci.rerunWorkflow({ | ||
| $, | ||
| workflowId: this.workflowId, | ||
| data: { | ||
| enable_ssh: this.enableSsh, | ||
| from_failed: this.from_failed, | ||
| jobs: typeof this.jobIds === "string" | ||
| ? JSON.parse(this.jobIds) | ||
| : this.jobIds, | ||
| sparse_tree: this.sparseTree, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully started a rerun of workflow with ID: ${this.workflowId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
82 changes: 82 additions & 0 deletions
82
components/circleci/actions/trigger-pipeline/trigger-pipeline.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import circleci from "../../circleci.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "circleci-trigger-pipeline", | ||
| name: "Trigger a Pipeline", | ||
| description: "Trigger a pipeline given a pipeline definition ID. Supports all integrations except GitLab. [See the documentation](https://circleci.com/docs/api/v2/index.html#tag/Pipeline/operation/triggerPipelineRun)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| circleci, | ||
| projectSlug: { | ||
| propDefinition: [ | ||
| circleci, | ||
| "projectSlug", | ||
| ], | ||
| }, | ||
| definitionId: { | ||
| type: "string", | ||
| label: "Definition ID", | ||
| description: "The unique ID for the pipeline definition. This can be found in the page Project Settings > Pipelines.", | ||
| }, | ||
| configBranch: { | ||
| type: "string", | ||
| label: "Config Branch", | ||
| description: "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//head for the PR ref or pull//merge for the merge ref (GitHub only)", | ||
| optional: true, | ||
| }, | ||
| configTag: { | ||
| type: "string", | ||
| label: "Config Tag", | ||
| description: "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.", | ||
| optional: true, | ||
| }, | ||
| checkoutBranch: { | ||
| type: "string", | ||
| label: "Checkout Branch", | ||
| description: "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//head for the PR ref or pull//merge for the merge ref (GitHub only)", | ||
| optional: true, | ||
| }, | ||
| checkoutTag: { | ||
| type: "string", | ||
| label: "Checkout Tag", | ||
| description: "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.", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| parameters: { | ||
| type: "object", | ||
| label: "Parameters", | ||
| description: "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.", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.circleci.triggerPipeline({ | ||
| $, | ||
| projectSlug: this.projectSlug, | ||
| data: { | ||
| definition_id: this.definitionId, | ||
| config: this.configBranch || this.configTag | ||
| ? { | ||
| branch: this.configBranch, | ||
| tag: this.configTag, | ||
| } | ||
| : undefined, | ||
| checkout: this.checkoutBranch || this.checkoutTag | ||
| ? { | ||
| branch: this.checkoutBranch, | ||
| tag: this.checkoutTag, | ||
| } | ||
| : undefined, | ||
| parameters: typeof this.parameters === "string" | ||
| ? JSON.parse(this.parameters) | ||
| : this.parameters, | ||
| }, | ||
| }); | ||
|
|
||
| if (response?.id) { | ||
| $.export("$summary", `Successfully triggered pipeline with ID: ${response.id}`); | ||
| } | ||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.