# Test Plan: Pipeline (`pipeline`)


| Field                 | Value                             |
| --------------------- | --------------------------------- |
| **Resource Type**     | `pipeline`                        |
| **Display Name**      | Pipeline                          |
| **Toolset**           | pipelines                         |
| **Scope**             | project                           |
| **Operations**        | list, get, create, update, delete |
| **Execute Actions**   | run, retry, import                |
| **Identifier Fields** | pipeline_id                       |
| **Filter Fields**     | search_term, module, filter_type  |
| **Deep Link**         | Yes                               |


## Test Cases


| Test ID         | Category | Description                                    | Prompt                                                                                                                                                                                                                                                      | Expected Result                                                      |
| --------------- | -------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| TC-pipeline-001 | List     | List all pipelines with defaults               | `harness_list(resource_type="pipeline")`                                                                                                                                                                                                                    | Returns paginated list of pipelines with items array and total count |
| TC-pipeline-002 | List     | List pipelines with pagination                 | `harness_list(resource_type="pipeline", page=1, size=5)`                                                                                                                                                                                                    | Returns page 1 with up to 5 pipelines                                |
| TC-pipeline-003 | List     | List pipelines filtered by search_term         | `harness_list(resource_type="pipeline", filters={search_term: "deploy"})`                                                                                                                                                                                   | Returns only pipelines matching "deploy" keyword                     |
| TC-pipeline-004 | List     | List pipelines filtered by module CD           | `harness_list(resource_type="pipeline", filters={module: "CD"})`                                                                                                                                                                                            | Returns only CD module pipelines                                     |
| TC-pipeline-005 | List     | List pipelines filtered by module CI           | `harness_list(resource_type="pipeline", filters={module: "CI"})`                                                                                                                                                                                            | Returns only CI module pipelines                                     |
| TC-pipeline-006 | List     | List pipelines with filter_type                | `harness_list(resource_type="pipeline", filters={filter_type: "PipelineSetup"})`                                                                                                                                                                            | Returns pipelines with PipelineSetup filter type                     |
| TC-pipeline-007 | List     | List pipelines with combined filters           | `harness_list(resource_type="pipeline", filters={search_term: "build", module: "CI"}, page=0, size=10)`                                                                                                                                                     | Returns CI pipelines matching "build" with pagination                |
| TC-pipeline-008 | List     | List pipelines with scope override             | `harness_list(resource_type="pipeline", org_id="custom_org", project_id="custom_project")`                                                                                                                                                                  | Returns pipelines from the specified org/project                     |
| TC-pipeline-009 | Get      | Get pipeline by identifier                     | `harness_get(resource_type="pipeline", resource_id="my_pipeline")`                                                                                                                                                                                          | Returns full pipeline details including YAML definition              |
| TC-pipeline-010 | Get      | Get pipeline with branch parameter             | `harness_get(resource_type="pipeline", resource_id="my_pipeline", params={branch: "develop"})`                                                                                                                                                              | Returns pipeline YAML from the develop branch                        |
| TC-pipeline-011 | Get      | Get pipeline with scope override               | `harness_get(resource_type="pipeline", resource_id="my_pipeline", org_id="other_org", project_id="other_project")`                                                                                                                                          | Returns pipeline from specified org/project                          |
| TC-pipeline-012 | Create   | Create pipeline with YAML string               | `harness_create(resource_type="pipeline", body={yamlPipeline: "pipeline:\n name: Test\n identifier: test_pipeline\n stages: []"})`                                                                                                                          | Pipeline created successfully, returns pipeline identifier           |
| TC-pipeline-013 | Create   | Create pipeline with JSON object               | `harness_create(resource_type="pipeline", body={pipeline: {name: "Test Pipeline", identifier: "test_pipeline", stages: []}})`                                                                                                                               | Pipeline created successfully with JSON body                         |
| TC-pipeline-014 | Create   | Create pipeline stored in remote Git           | `harness_create(resource_type="pipeline", body={yamlPipeline: "pipeline:\n name: Test\n identifier: test_remote"}, params={store_type: "REMOTE", connector_ref: "git_conn", repo_name: "my-repo", branch: "main", file_path: ".harness/test.yaml"})`        | Pipeline created and stored in remote Git repo                       |
| TC-pipeline-015 | Create   | Create pipeline in Harness Code repo           | `harness_create(resource_type="pipeline", body={yamlPipeline: "pipeline:\n name: Test\n identifier: test_hc"}, params={store_type: "REMOTE", is_harness_code_repo: true, repo_name: "my-repo", branch: "main", file_path: ".harness/test.yaml"})`           | Pipeline created in Harness Code repo                                |
| TC-pipeline-016 | Create   | Create pipeline with missing body              | `harness_create(resource_type="pipeline", body={})`                                                                                                                                                                                                         | Error: body must include either yamlPipeline or pipeline             |
| TC-pipeline-017 | Update   | Update pipeline with YAML string               | `harness_update(resource_type="pipeline", resource_id="my_pipeline", body={yamlPipeline: "pipeline:\n name: Updated\n identifier: my_pipeline\n stages: []"})`                                                                                              | Pipeline updated successfully                                        |
| TC-pipeline-018 | Update   | Update pipeline with conflict detection params | `harness_update(resource_type="pipeline", resource_id="my_pipeline", body={yamlPipeline: "pipeline:\n name: Updated\n identifier: my_pipeline"}, params={last_object_id: "abc123", last_commit_id: "def456"})`                                              | Pipeline updated with conflict detection                             |
| TC-pipeline-019 | Update   | Update remote pipeline                         | `harness_update(resource_type="pipeline", resource_id="my_pipeline", body={yamlPipeline: "..."}, params={store_type: "REMOTE", connector_ref: "git_conn", repo_name: "repo", branch: "main", file_path: ".harness/p.yaml", commit_msg: "update pipeline"})` | Remote pipeline updated with git commit                              |
| TC-pipeline-020 | Update   | Update pipeline with invalid body              | `harness_update(resource_type="pipeline", resource_id="my_pipeline", body={})`                                                                                                                                                                              | Error: body must include either pipeline or yamlPipeline             |
| TC-pipeline-021 | Delete   | Delete pipeline by identifier                  | `harness_delete(resource_type="pipeline", resource_id="my_pipeline")`                                                                                                                                                                                       | Pipeline deleted successfully                                        |
| TC-pipeline-022 | Delete   | Delete pipeline with scope override            | `harness_delete(resource_type="pipeline", resource_id="my_pipeline", org_id="other_org", project_id="other_project")`                                                                                                                                       | Pipeline deleted from specified org/project                          |
| TC-pipeline-023 | Execute  | Run pipeline with no inputs                    | `harness_execute(resource_type="pipeline", action="run", pipeline_id="my_pipeline")`                                                                                                                                                                        | Pipeline execution started, returns executionId and status           |
| TC-pipeline-024 | Execute  | Run pipeline with simple key-value inputs      | `harness_execute(resource_type="pipeline", action="run", pipeline_id="my_pipeline", body={inputs: {branch: "main", env: "prod"}})`                                                                                                                          | Pipeline execution started with resolved runtime inputs              |
| TC-pipeline-025 | Execute  | Run pipeline with input_set_ids                | `harness_execute(resource_type="pipeline", action="run", pipeline_id="my_pipeline", body={input_set_ids: ["input_set_1", "input_set_2"]})`                                                                                                                  | Pipeline execution started using input sets                          |
| TC-pipeline-026 | Execute  | Run pipeline with module param                 | `harness_execute(resource_type="pipeline", action="run", pipeline_id="my_pipeline", params={module: "CD"})`                                                                                                                                                 | Pipeline execution started with CD module context                    |
| TC-pipeline-027 | Execute  | Run pipeline with branch param                 | `harness_execute(resource_type="pipeline", action="run", pipeline_id="my_pipeline", params={branch: "develop"})`                                                                                                                                            | Pipeline execution started from develop branch                       |
| TC-pipeline-028 | Execute  | Retry a failed execution                       | `harness_execute(resource_type="pipeline", action="retry", execution_id="exec_abc123")`                                                                                                                                                                     | Failed execution retried, returns new executionId                    |
| TC-pipeline-029 | Execute  | Import pipeline from external Git              | `harness_execute(resource_type="pipeline", action="import", body={pipelineName: "Imported Pipeline", pipelineDescription: "From Git"}, params={connector_ref: "git_conn", repo_name: "my-repo", branch: "main", file_path: ".harness/pipeline.yaml"})`      | Pipeline imported from Git repo                                      |
| TC-pipeline-030 | Execute  | Import pipeline from Harness Code              | `harness_execute(resource_type="pipeline", action="import", body={pipelineName: "HC Pipeline"}, params={is_harness_code_repo: true, repo_name: "my-repo", branch: "main", file_path: ".harness/pipeline.yaml"})`                                            | Pipeline imported from Harness Code repo                             |
| TC-pipeline-031 | Execute  | Force import pipeline                          | `harness_execute(resource_type="pipeline", action="import", body={pipelineName: "Force Import"}, params={connector_ref: "git_conn", repo_name: "repo", branch: "main", file_path: "p.yaml", is_force_import: true})`                                        | Pipeline force-imported, overwriting existing                        |
| TC-pipeline-032 | Error    | Get pipeline with invalid identifier           | `harness_get(resource_type="pipeline", resource_id="nonexistent_pipeline_xyz")`                                                                                                                                                                             | Error: Pipeline not found (404)                                      |
| TC-pipeline-033 | Error    | List pipelines with invalid module             | `harness_list(resource_type="pipeline", filters={module: "INVALID"})`                                                                                                                                                                                       | Error or empty results for invalid module                            |
| TC-pipeline-034 | Error    | Create pipeline in unauthorized project        | `harness_create(resource_type="pipeline", org_id="no_access_org", project_id="no_access_project", body={yamlPipeline: "pipeline:\n name: X\n identifier: x"})`                                                                                              | Error: Unauthorized or forbidden (401/403)                           |
| TC-pipeline-035 | Edge     | List pipelines with empty results              | `harness_list(resource_type="pipeline", org_id="empty_org", project_id="empty_project")`                                                                                                                                                                    | Returns empty items array with total=0                               |
| TC-pipeline-036 | Edge     | List pipelines with max pagination             | `harness_list(resource_type="pipeline", page=0, size=100)`                                                                                                                                                                                                  | Returns up to 100 pipelines in single page                           |
| TC-pipeline-037 | Edge     | Get pipeline with special characters in params | `harness_get(resource_type="pipeline", resource_id="pipeline-with-dashes_and_underscores")`                                                                                                                                                                 | Returns pipeline with special characters in identifier               |


## Notes

- Pipeline create/update accepts either `yamlPipeline` (YAML string) or `pipeline` (JSON object) in the body
- Remote storage requires `store_type=REMOTE` plus git connector details
- Harness Code repos use `is_harness_code_repo=true` instead of `connector_ref`
- Update supports conflict detection via `last_object_id` and `last_commit_id` params
- The `run` execute action supports both simple key-value `inputs` and `input_set_ids`
- The `import` action brings pipelines from Git into Harness

