|
| 1 | +# pipelinerun start — e2e fixtures |
| 2 | + |
| 3 | +Self-contained Tekton manifests used by the `krci pipelinerun start` e2e rows |
| 4 | +in `../test-cases.md`. Files are the source of truth — apply with |
| 5 | +`kubectl apply -f` and the cluster matches what's checked in (no drift). |
| 6 | + |
| 7 | +All pipelines run a single inline `taskSpec` that calls `busybox` and echoes |
| 8 | +its inputs. None of them reach external systems, push artifacts, or write to |
| 9 | +git. They are safe to start repeatedly. All resource names use a synthetic |
| 10 | +`krci-cli-e2e-*` prefix and the manifests carry no organisation-specific |
| 11 | +identifiers — drop them into any namespace on any KubeRocketCI cluster. |
| 12 | + |
| 13 | +## Bundle |
| 14 | + |
| 15 | +| File | Resource | Purpose | Test rows | |
| 16 | +|---|---|---|---| |
| 17 | +| `pipeline-noop.yaml` | Pipeline `krci-cli-e2e-noop` | Four params, all with defaults; `should-fail=true` makes the run exit non-zero. | `PR-S-1`, `PR-S-2`, `PR-S-3`, `PR-S-LABEL`, `PR-S-DRY-YAML`, `PR-S-DRY-JSON`, `PR-S-RACE`, `PR-S-GENNAME`, `PR-S-COL-EQ` | |
| 18 | +| `pipeline-required.yaml` | Pipeline `krci-cli-e2e-required` | Declares a no-default param. Documents the portal's empty-string synthesis: omitting `--param message=...` produces `spec.params[0].value: ""`, **not** an admission rejection. The fixture's spec.description still references the old (incorrect) intent — left untouched to avoid drift; see `PR-S-PARAM-SYNTHESIZED` for the actual contract. | `PR-S-PARAM-SYNTHESIZED` | |
| 19 | +| `pipeline-broken-tt.yaml` | Pipeline `krci-cli-e2e-broken-tt` | Carries an `app.edp.epam.com/triggertemplate` label pointing at a TT that does not exist. | `PR-S-TT-MISSING` | |
| 20 | +| `pipeline-bare.yaml` | Pipeline `krci-cli-e2e-bare` | No KRCI labels at all. Proves the CLI can start any valid Tekton Pipeline regardless of the KubeRocketCI labelling convention. | `PR-S-BARE` | |
| 21 | +| `pipeline-with-tt.yaml` | Pipeline `krci-cli-e2e-with-tt` | Paired with `trigger-template.yaml`. Exercises the TriggerTemplate branch of `createPipelineRunDraftFromPipeline` — placeholder resolution and label sanitization. | `PR-S-TT-OK`, `PR-S-TT-DRY` | |
| 22 | +| `trigger-template.yaml` | TriggerTemplate `krci-cli-e2e-tt` | Resourcetemplate uses `$(tt.params.X)` placeholders that resolve against `pipeline-with-tt.yaml`'s param defaults. | (paired with above) | |
| 23 | + |
| 24 | +## Apply |
| 25 | + |
| 26 | +Substitute `<namespace>` with whatever namespace you target (e.g. the one your |
| 27 | +portal session points at): |
| 28 | + |
| 29 | +```sh |
| 30 | +kubectl apply -n <namespace> -f source/cli/e2e/pipelinerun/fixtures/ |
| 31 | +``` |
| 32 | + |
| 33 | +Verify: |
| 34 | + |
| 35 | +```sh |
| 36 | +kubectl -n <namespace> get pipeline.tekton.dev,triggertemplate.triggers.tekton.dev \ |
| 37 | + -l app.edp.epam.com/pipelinetype=tests |
| 38 | +``` |
| 39 | + |
| 40 | +## Smoke test (after apply) |
| 41 | + |
| 42 | +```sh |
| 43 | +# Dry-run — proves CLI <-> portal plumbing without creating a PipelineRun. |
| 44 | +./dist/krci pipelinerun start krci-cli-e2e-noop --dry-run -o json | jq . |
| 45 | + |
| 46 | +# Real run with default params. |
| 47 | +./dist/krci pipelinerun start krci-cli-e2e-noop -o json |
| 48 | + |
| 49 | +# Real run overriding a param. |
| 50 | +./dist/krci pipelinerun start krci-cli-e2e-noop \ |
| 51 | + --param git-revision=develop --param count=3 -o json |
| 52 | + |
| 53 | +# Deterministic failure path. |
| 54 | +./dist/krci pipelinerun start krci-cli-e2e-noop --param should-fail=true -o json |
| 55 | + |
| 56 | +# No-default-param path: succeeds with synthesised empty value (exit 0). |
| 57 | +# Demonstrates that "missing required param" is not a reachable failure mode. |
| 58 | +./dist/krci pipelinerun start krci-cli-e2e-required -o json |
| 59 | + |
| 60 | +# TriggerTemplate-not-found path: synthesised "TT does not exist" message, exit 1. |
| 61 | +./dist/krci pipelinerun start krci-cli-e2e-broken-tt |
| 62 | + |
| 63 | +# Bare Tekton Pipeline (no KRCI labels) — must still start. |
| 64 | +./dist/krci pipelinerun start krci-cli-e2e-bare -o json |
| 65 | + |
| 66 | +# TriggerTemplate happy path — dry-run reveals resolved $(tt.params.X) values. |
| 67 | +./dist/krci pipelinerun start krci-cli-e2e-with-tt --dry-run -o json | jq . |
| 68 | + |
| 69 | +# TriggerTemplate happy path — real run. |
| 70 | +./dist/krci pipelinerun start krci-cli-e2e-with-tt -o json |
| 71 | +``` |
| 72 | + |
| 73 | +## Cleanup |
| 74 | + |
| 75 | +The PipelineRun objects created by tests are subject to whatever GC the |
| 76 | +cluster has configured (Tekton Results retention, operator pruning, etc.). |
| 77 | +To remove the fixture resources themselves: |
| 78 | + |
| 79 | +```sh |
| 80 | +kubectl delete -n <namespace> -f source/cli/e2e/pipelinerun/fixtures/ |
| 81 | +``` |
| 82 | + |
| 83 | +To purge accumulated runs (label selector picks up runs from any of the |
| 84 | +fixture pipelines because every fixture sets `pipelinetype: tests` on either |
| 85 | +the Pipeline or — via TT-resolved labels — the resulting PipelineRun): |
| 86 | + |
| 87 | +```sh |
| 88 | +kubectl -n <namespace> delete pipelinerun.tekton.dev \ |
| 89 | + -l app.edp.epam.com/pipelinetype=tests |
| 90 | +``` |
| 91 | + |
| 92 | +## Why these manifests look the way they do |
| 93 | + |
| 94 | +- **Labelled `pipelinetype: tests`.** Distinguishes these fixtures from |
| 95 | + KubeRocketCI's real pipelines (build/review/deploy/clean/security/release). |
| 96 | + Filter via `kubectl get pipeline.tekton.dev |
| 97 | + -l app.edp.epam.com/pipelinetype=tests` or the same selector in the portal |
| 98 | + UI. `tests` is already a valid value in the portal's `pipelineTypeEnum`. |
| 99 | +- **`app.edp.epam.com/*` label keys are upstream KubeRocketCI definitions** |
| 100 | + and cannot be renamed — the portal reads exactly those keys to drive |
| 101 | + TriggerTemplate lookup, codebase filters, and pipelinetype filters. The |
| 102 | + values used in this bundle (`tests`, `krci-cli-e2e`, `""`) are synthetic |
| 103 | + and carry no organisation-specific data. |
| 104 | +- **`triggertemplate` label is empty** on the `noop` and `required` fixtures. |
| 105 | + The portal's Pipeline Zod schema requires both labels to be present, but |
| 106 | + `getTriggerTemplateLabel` treats an empty string as "absent" and skips the |
| 107 | + TT lookup — so `start` works without us having to also create a TT. |
| 108 | + `pipeline-broken-tt.yaml` is the deliberate exception: its label points at |
| 109 | + a TT that does not exist, which is exactly the failure mode it tests. |
| 110 | +- **`pipeline-with-tt.yaml` + `trigger-template.yaml` are a pair.** The |
| 111 | + Pipeline carries `triggertemplate: krci-cli-e2e-tt`; the matching TT's |
| 112 | + `resourcetemplates[0]` uses `$(tt.params.X)` placeholders. The portal's |
| 113 | + draft builder resolves those placeholders against the Pipeline's param |
| 114 | + defaults (not the TT's), so the resulting PipelineRun reflects values |
| 115 | + declared on the Pipeline side. This is the only fixture that exercises |
| 116 | + `createPipelineRunDraftFromPipeline`'s TT branch end-to-end. |
| 117 | +- **Inline `taskSpec`, not `taskRef`.** Decouples the fixtures from |
| 118 | + cluster-installed Tasks/ClusterTasks — apply works on any cluster with |
| 119 | + Tekton Pipelines installed. |
| 120 | +- **Params passed via env, not interpolated into shell.** Tekton substitutes |
| 121 | + `$(params.X)` as text before the shell runs. Routing through `env:` means |
| 122 | + param values land in shell variables, where `"$VAR"` does not re-expand |
| 123 | + command substitutions — so a hostile `--param message='$(reboot)'` is |
| 124 | + echoed literally rather than executed. |
| 125 | +- **Pinned image tag (`busybox:1.36`).** Reproducible across runs. |
0 commit comments