|
| 1 | +# Pipeline Resource |
| 2 | + |
| 3 | +The central component of the Codefresh Platform. Pipelines are workflows that contain individual steps. Each step is responsible for a specific action in the process. |
| 4 | +See the [documentation](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/introduction-to-codefresh-pipelines/) for the details. |
| 5 | + |
| 6 | +## Example Usage |
| 7 | + |
| 8 | +```hcl |
| 9 | +resource "codefresh_project" "test" { |
| 10 | + name = "myproject" |
| 11 | +} |
| 12 | +
|
| 13 | +resource "codefresh_pipeline" "test" { |
| 14 | +
|
| 15 | + lifecycle { |
| 16 | + ignore_changes = [ |
| 17 | + revision |
| 18 | + ] |
| 19 | + } |
| 20 | +
|
| 21 | + name = "${codefresh_project.test.name}/react-sample-app" |
| 22 | +
|
| 23 | + tags = [ |
| 24 | + "production", |
| 25 | + "docker", |
| 26 | + ] |
| 27 | +
|
| 28 | + spec { |
| 29 | + concurrency = 1 |
| 30 | + priority = 5 |
| 31 | +
|
| 32 | + spec_template { |
| 33 | + repo = "codefresh-contrib/react-sample-app" |
| 34 | + path = "./codefresh.yml" |
| 35 | + revision = "master" |
| 36 | + context = "git" |
| 37 | + } |
| 38 | +
|
| 39 | + trigger { |
| 40 | + branch_regex = "/.*/gi" |
| 41 | + context = "git" |
| 42 | + description = "Trigger for commits" |
| 43 | + disabled = false |
| 44 | + events = [ |
| 45 | + "push.heads" |
| 46 | + ] |
| 47 | + modified_files_glob = "" |
| 48 | + name = "commits" |
| 49 | + provider = "github" |
| 50 | + repo = "codefresh-contrib/react-sample-app" |
| 51 | + type = "git" |
| 52 | + } |
| 53 | +
|
| 54 | + trigger { |
| 55 | + branch_regex = "/.*/gi" |
| 56 | + context = "git" |
| 57 | + description = "Trigger for tags" |
| 58 | + disabled = false |
| 59 | + events = [ |
| 60 | + "push.tags" |
| 61 | + ] |
| 62 | + modified_files_glob = "" |
| 63 | + name = "tags" |
| 64 | + provider = "github" |
| 65 | + repo = "codefresh-contrib/react-sample-app" |
| 66 | + type = "git" |
| 67 | + } |
| 68 | +
|
| 69 | + variables = { |
| 70 | + MY_PIP_VAR = "value" |
| 71 | + ANOTHER_PIP_VAR = "another_value" |
| 72 | + } |
| 73 | + } |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +## Argument Reference |
| 78 | + |
| 79 | +- `name` - (Required) The display name for the pipeline. |
| 80 | +- `revision` - (Optional) The pipeline's revision. Should be added to the **lifecycle/ignore_changes** or incremented mannually each update. |
| 81 | +- `tags` - (Optional) A list of tags to mark a project for easy management and access control. |
| 82 | +- `spec` - (Required) A collection of `spec` blocks as documented below. |
| 83 | +- `original_yaml_string` - (Optional) A string with original yaml pipeline. |
| 84 | + - `original_yaml_string = "version: \"1.0\"\nsteps:\n test:\n image: alpine:latest\n commands:\n - echo \"ACC tests\""` |
| 85 | + - or `original_yaml_string = file("/path/to/my/codefresh.yml")` |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +`spec` supports the following: |
| 90 | + |
| 91 | +- `concurrency` - (Optional) The maximum amount of concurrent builds. |
| 92 | +- `priority` - (optional) Helps to organize the order of builds execution in case of reaching the concurrency limit. |
| 93 | +- `variables` - (Optional) Pipeline variables. |
| 94 | +- `trigger` - (Optional) A collection of `trigger` blocks as documented below. Triggers [documentation](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/triggers/git-triggers/). |
| 95 | +- `spec_template` - (Optional) A collection of `spec_template` blocks as documented below. |
| 96 | +- `runtime_environment` - (Optional) A collection of `runtime_environment` blocks as documented below. |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +`spec_template` supports the following: |
| 101 | + |
| 102 | +- `location` - (Optional) Default value - **git**. |
| 103 | +- `repo` - (Required) The GitHub `account/repo_name`. |
| 104 | +- `path` - (Required) The relative path to the Codefresh pipeline file. |
| 105 | +- `revison` - (Required) The git revision. |
| 106 | +- `context` - (Optional) The Codefresh Git [context](https://codefresh.io/docs/docs/integrations/git-providers/). |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +`trigger` supports the following: |
| 111 | + |
| 112 | +- `name` - (Optional) The display name for the pipeline. |
| 113 | +- `description` - (Optional) The trigger description. |
| 114 | +- `type` - (Optional) The trigger type. Default value - **git**. |
| 115 | +- `repo` - (Optional) The GitHub `account/repo_name`. |
| 116 | +- `branch_regex` - (Optional) A regular expression and will only trigger for branches that match this naming pattern. |
| 117 | +- `modified_files_glob` - (Optional) Allows to constrain the build and trigger it only if the modified files from the commit match this glob expression. |
| 118 | +- `events` - (Optional) A list of GitHub events for which a Pipeline is triggered. Default value - **push.heads**. |
| 119 | +- `provider` - (Optional) Default value - **github**. |
| 120 | +- `context` - (Optional) Codefresh Git context. |
| 121 | +- `variables` - (Optional) Trigger variables. |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +`runtime_environment` supports the following: |
| 126 | + |
| 127 | +- `name` - (Required) A name of runtime. |
| 128 | +- `cpu` - (Optional) A required amount of CPU. |
| 129 | +- `memory` - (Optional) A required amount of memory. |
| 130 | +- `dind_storage` - (Optional) A pipeline shared storage. |
| 131 | + |
| 132 | +## Attributes Reference |
| 133 | + |
| 134 | +- `id` - The Pipeline ID. |
| 135 | + |
| 136 | +## Import |
| 137 | + |
| 138 | +```sh |
| 139 | +terraform import codefresh_pipeline.test xxxxxxxxxxxxxxxxxxx |
| 140 | +``` |
0 commit comments