Skip to content

EPMDEDP-17364: feat: Add --deployment and --env filters to pipelineru… - #43

Merged
SergK merged 3 commits into
mainfrom
EPMDEDP-17364
Oct 2, 2026
Merged

SergK merged 3 commits into
mainfrom
EPMDEDP-17364

Conversation

@geekhubuser

Copy link
Copy Markdown
Contributor

Description

Deploy runs carry no project label, so krci pipelinerun list --project <p> --type deploy is always empty, and no filter selects the runs of one environment. An agent can only scan krci pipelinerun list --type deploy: the runs still in the cluster plus the 10 newest deploy runs of the whole platform. The krci skills work around it by matching run names (krci-overview, references/tooling.md), which misses runs outside that window and deploy runs of custom trigger templates with another name prefix.

  • krci pipelinerun list --deployment <d> --env <e> selects the runs of one environment by the app.edp.epam.com/cdpipeline and app.edp.epam.com/cdstage labels: live runs client-side, history through the Tekton Results filter, which keeps both as annotations. --type deploy keeps deploy runs only, since clean runs carry the same labels. The names are the ones krci env get <deployment> <env> takes.
  • Every run row carries deployment and env in JSON, omitted when absent; the table view of get prints them.
  • --env without --deployment, an empty value, an invalid name and positional arguments fail before any portal call. The flag check runs before the argument check, so --project --pr 53 still reports the flag without a value. The --type help lists deploy, and the --project help points deploy runs to the new flags.

Fixes EPMDEDP-17364

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking change which improves an existing feature or documentation)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)

deployment and env are added JSON fields. pipelinerun list now rejects positional arguments, which it used to ignore.

How Has This Been Tested?

Unit tests cover the Tekton Results filter (including dashed names), live-row matching, both row mappers, a service test with live and history sources, and a listRun test against a mock portal that fails if the flags stop reaching the filter. make ci in golang:1.26 on a clean LF clone of the branch: golangci-lint 0 issues, go test -race ./... passes, build OK.

Testbed measurement: try-kuberocketci with KRCI 3.15.0, a headless agent with the krci skills plugin and kubectl denied, the same prompt and platform state for both CLIs, 3 runs per row. The question: "Did the last deploy to environment dev of deployment demo succeed? When did it run, and if it failed, at which step and why?" That deploy had failed at deploy-app / wait-for-deploy because the application went Degraded.

Platform state CLI Correct answers Agent turns Cost per answer Time
Quiet: the deploy is among the 10 newest deploy runs v0.17.0 3/3 15.0 (12-19) $0.28 78 s
Quiet this PR 3/3 8.7 (7-10) $0.16 53 s
Busy: 10 newer deploys to other environments v0.17.0 1/3 12.7 (9-18) $0.24 96 s
Busy this PR 3/3 11.3 (9-15) $0.21 61 s

On the busy platform two of three v0.17.0 agents answered that the deploy succeeded: they could not reach the run and read the Argo CD sync result instead. With this PR every agent found the run through --deployment demo --env dev --type deploy, most after reading --help. The busy row was repeated with the binary built from this commit: 3/3 correct, 8 to 19 turns.

Live, read-only, on a larger platform: the 10 newest deploy runs all belonged to two environments, so --type deploy showed nothing of any other environment; --deployment <d> --env dev --type deploy returned that environment's last 10 deploy runs, two weeks back.

/e2e per e2e/runner.md, pipelinerun group, binary from this branch, portal rows read-only against a live portal: 74 PASS · 2 FAIL · 1 SKIP. The 8 new rows (PR-H-09, PR-V-15 to PR-V-18, PR-L-24 to PR-L-26) also PASS through one Haiku agent each. PR-A-01 and PR-A-02 fail the same way on main: the rows expect authentication required, the CLI prints not authenticated: run 'krci auth login'. PR-J-05 was skipped: no build run was in the cluster.

Checklist

  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Pull Request contains one commit. I squash my commits.

Screenshots (if appropriate)

N/A

Additional context

Docs: docs/pipelinerun.md (filters, deploy and clean runs, JSON example). e2e: e2e/pipelinerun/test-cases.md gains PR-H-09, PR-V-15 to PR-V-18, PR-L-24 to PR-L-26 and the DEPLOYMENT and ENV placeholders.

Follow-up in KubeRocketCI/skills once this is released: replace the name-matching recipe in krci-overview's references/tooling.md with --deployment and --env.

@geekhubuser
geekhubuser requested a review from SergK October 2, 2026 06:36
…n list

- pipelinerun list --deployment <d> --env <e> selects the runs of one
  environment, live and from Tekton Results, by the cdpipeline and cdstage
  labels; --type deploy keeps deploy runs only. Deploy runs carry no project,
  so --project never found them.
- Run rows carry deployment and env in JSON; the table view of get shows them.
- --env without --deployment, empty values and positional arguments are
  rejected; the --type help lists deploy.
SergK added 2 commits October 2, 2026 12:25
…ton Results limits

- Send cdpipeline/cdstage as a label selector in the live PipelineRun list; values over 63 chars are skipped
- List clean in --type help and docs
- Document that --deployment/--env match archived runs only when the Results watcher records both labels
- Collapse the five header fields in renderRunHeader into one loop
- Use strings.CutPrefix in stageEnv; add a cdStage/stageEnv round-trip test

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
…ors in every command

- Root wraps Args of every runnable leaf, including help and completion, with the flag-value check
- The check also covers stringSlice and stringArray flags
- pipelinerun list drops its local Args wrapper
- Root tests cover NoArgs, ExactArgs, slice flags, help and completion
- e2e rows PR-V-19, PR-S-PARAM-FLAG, SCA-V-14

Signed-off-by: Sergiy Kulanov <sergiy_kulanov@epam.com>
@SergK
SergK merged commit fae4b5e into main Oct 2, 2026
2 checks passed
@SergK
SergK deleted the EPMDEDP-17364 branch October 2, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants