Skip to content

feat: add tkn stepaction list, describe and delete - #3429

Open
cvas22 wants to merge 3 commits into
tektoncd:mainfrom
cvas22:feat/2576-stepaction-commands
Open

cvas22 wants to merge 3 commits into
tektoncd:mainfrom
cvas22:feat/2576-stepaction-commands

Conversation

@cvas22

@cvas22 cvas22 commented Nov 16, 2026

Copy link
Copy Markdown

Changes

Adds a tkn stepaction command group with list, describe and delete, as asked in #2576. I followed the customrun commands so the flags and output options match the rest of tkn.

  • list shows name, description and age, sorted by namespace and name, with -A, --label, --limit, --reverse, --no-headers and the usual -o formats
  • describe shows image, command, args, working dir, labels/annotations, params (with defaults) and results, and lets you pick one interactively (or with --fzf) when no name is given
  • delete removes one or more StepActions and supports -o json|yaml

It reads tekton.dev/v1beta1 StepActions through the dynamic client like the other commands.

Fixes #2576

/kind feature

Notes

I wrote the docs and man pages to match what make docs generates (same flags as the customrun pages), but I couldn't run the generator here, so if the generated check complains I'll regenerate. Tests are added under pkg/cmd/stepaction, CI will be the first run for them.

I used some help from AI, please don't yell at me. Thx.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

Added tkn stepaction list, describe and delete commands for StepActions.

@tekton-robot tekton-robot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Nov 16, 2026
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign divyansh42 after the PR has been reviewed.
You can assign the PR to them by writing /assign @divyansh42 in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 16, 2026
@divyansh42
divyansh42 requested a balanced review from Copilot November 22, 2026 13:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Interactive selection corrupts JSON/YAML output with stdout feedback, template-only requests are ignored, and deleting a missing resource returns the wrong exit code.

3 open issues
What changed in this PR

Adds StepAction management to tkn, addressing #2576 through the existing command tree and dynamic Kubernetes client.

Changes:

  • Adds stepaction list, describe, and delete, with filtering, interactive selection, and structured output.
  • Adds command tests and shared StepAction test helpers.
  • Updates command references, man pages, and root help output.
File Description
README.md Links the StepAction command reference.
pkg/​test/​dynamic/​dynamictestclient.go Registers StepAction lists in the fake client.
pkg/​test/​builder/​unstructured.go Adds an unstructured StepAction builder.
pkg/​options/​resource_names.go Defines the StepAction resource name.
pkg/​options/​describe.go Supports StepAction selection.
pkg/​cmd/​testdata/​TestPluginList.golden Adds StepAction to expected root help.
pkg/​cmd/​stepaction/​stepaction.go Defines the command group and resource endpoint.
pkg/​cmd/​stepaction/​stepaction_test.go Tests listing, description, and deletion.
pkg/​cmd/​stepaction/​list.go Implements listing, sorting, filtering, and output.
pkg/​cmd/​stepaction/​describe.go Implements selection and detailed resource output.
pkg/​cmd/​stepaction/​delete.go Implements deletion and structured results.
pkg/​cmd/​root.go Registers the StepAction command group.
docs/​man/​man1/​tkn.1 Links the StepAction man page.
docs/​man/​man1/​tkn-stepaction.1 Documents the command group.
docs/​man/​man1/​tkn-stepaction-list.1 Documents listing flags and examples.
docs/​man/​man1/​tkn-stepaction-describe.1 Documents description flags and examples.
docs/​man/​man1/​tkn-stepaction-delete.1 Documents deletion flags and examples.
docs/​cmd/​tkn.md Links the StepAction command reference.
docs/​cmd/​tkn_stepaction.md Documents the command group.
docs/​cmd/​tkn_stepaction_list.md Documents listing usage and options.
docs/​cmd/​tkn_stepaction_describe.md Documents description usage and options.
docs/​cmd/​tkn_stepaction_delete.md Documents deletion usage and options.

Review effort: Balanced

Comment thread pkg/options/describe.go
Comment on lines +172 to +173
case ResourceNameStepAction:
opts.StepActionName = ans

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, the selection now goes to stderr so stdout only has the object. Fixed in ed0229e.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, the selection now goes to stderr so stdout only has the object. Fixed in ed0229e.

Comment thread pkg/cmd/stepaction/delete.go Outdated
if !errors.IsNotFound(err) {
return err
}
return fmt.Errorf("StepAction %s not found in namespace %s", name, namespace)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 024379b, a missing StepAction now exits with NotFound and keeps the API error wrapped. The delete test checks the code.

}
}
return nil
} else if output != "" {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this as is for now. task and pipeline list/describe only print the template with -o too, so stepaction matches them. If we want --template alone to work it's better fixed for all of them in one PR.

StepActions are a Tekton CRD like Tasks, but tkn had no commands for them.
Add a stepaction command group with list, describe and delete, following
the customrun commands for flags and output options.

list shows name, description and age, sorted by namespace and name, with
the usual -A, --label, --limit, --reverse, --no-headers and -o flags.
describe shows the image, command, args, params and results. delete
removes one or more StepActions and supports -o json|yaml.

Fixes tektoncd#2576

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
@cvas22
cvas22 force-pushed the feat/2576-stepaction-commands branch from 11cbcd4 to 3acc74e Compare November 22, 2026 17:51
The selected name was written to stdout, which broke -o json and -o yaml
output when picking from several resources.

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support cli command for StepAction CRD

3 participants