-
Notifications
You must be signed in to change notification settings - Fork 269
Add CONTEXT.md for AI agent consumption #2919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Debashich
wants to merge
2
commits into
tektoncd:main
Choose a base branch
from
Debashich:context
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+169
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| # tkn CLI Agent Context | ||
|
|
||
| This file describes `tkn` conventions, output formats, and behavioral notes | ||
| for automated and agent-driven workflows. For contributing to tkn itself, | ||
| see `AGENTS.md`. | ||
|
|
||
| --- | ||
|
|
||
| ## Resource Types | ||
|
|
||
| Tekton has two layers: | ||
|
|
||
| - Definitions (`pipeline`, `task`): reusable templates | ||
| - Runs (`pipelinerun`, `taskrun`): execution instances | ||
|
|
||
| Supported verbs per resource type: | ||
|
|
||
| | Resource | Verbs | | ||
| |---|---| | ||
| | `pipeline` | `list`, `describe`, `start`, `logs`, `delete` | | ||
| | `task` | `list`, `describe`, `start`, `logs`, `delete` | | ||
| | `pipelinerun`, `taskrun` | `list`, `describe`, `logs`, `cancel`, `delete` | | ||
|
|
||
| Other resource types (`customrun`, `eventlistener`, `triggerbinding`, | ||
| `triggertemplate`, `clustertriggerbinding`, `bundle`, and `hub`) support | ||
| subsets of `list`, `describe`, and `delete`. | ||
|
|
||
| --- | ||
|
|
||
| ## Common Workflows | ||
|
|
||
| List pipeline runs: | ||
|
|
||
| ```bash | ||
| tkn pipelinerun list --output json | ||
| ``` | ||
|
|
||
| Inspect run status: | ||
|
|
||
| ```bash | ||
| tkn pipelinerun describe <run-name> --output json | ||
| tkn taskrun describe <run-name> --output json | ||
| ``` | ||
|
|
||
| Get logs for the most recent run: | ||
|
|
||
| ```bash | ||
| tkn pipelinerun logs --last | ||
| tkn taskrun logs --last | ||
| ``` | ||
|
|
||
| Start a pipeline non-interactively: | ||
|
|
||
| ```bash | ||
| tkn pipeline start <pipeline-name> \ | ||
| --param <key>=<value> \ | ||
| --workspace name=<ws-name>,claimName=<pvc-name> \ | ||
| --use-param-defaults \ | ||
| --skip-optional-workspace \ | ||
| --showlog | ||
| ``` | ||
|
|
||
| Re-run the most recent pipeline run: | ||
|
|
||
| ```bash | ||
| tkn pipeline start <pipeline-name> --last --use-param-defaults | ||
| ``` | ||
|
|
||
| Delete a run: | ||
|
|
||
| ```bash | ||
| tkn pipelinerun delete <run-name> --force | ||
| tkn taskrun delete <run-name> --force | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Output Formats | ||
|
|
||
| | Command | JSON output | Notes | | ||
| |---|---|---| | ||
| | `list` | Yes | Supported on all resources | | ||
| | `describe` | Yes | Supported on all resources | | ||
| | `start` | Yes | Supported by `pipeline start` and `task start` | | ||
| | `logs` | No | Plain text to stdout only | | ||
| | `delete` | No | Requires `--force` to skip confirmation | | ||
| | `export` | No | Outputs YAML instead of JSON | | ||
|
|
||
| `--output yaml` is available wherever `--output json` is supported. | ||
|
|
||
| --- | ||
|
|
||
| ## Non-Interactive Usage | ||
|
|
||
| `pipeline start` and `task start` prompt for missing parameters and workspaces | ||
| by default. In non-TTY environments, this blocks execution. | ||
|
|
||
| For non-interactive use, pass: | ||
|
|
||
| ```bash | ||
| tkn pipeline start <pipeline-name> \ | ||
| --param <key>=<value> \ | ||
| --use-param-defaults \ | ||
| --skip-optional-workspace | ||
| ``` | ||
|
|
||
| `--use-param-defaults` applies schema defaults for unspecified parameters. If | ||
| a required parameter has no default and is not passed via `--param`, the | ||
| command prompts regardless. | ||
|
|
||
| --- | ||
|
|
||
| ## Exit Codes | ||
|
|
||
| By default, `tkn pipelinerun logs` exits 0 after streaming logs, regardless | ||
| of run outcome. | ||
|
|
||
| With `--exit-with-pipelinerun-error` (`-E`), the exit code reflects run status: | ||
|
|
||
| | Code | Meaning | | ||
| |---|---| | ||
| | 0 | PipelineRun succeeded | | ||
| | 1 | PipelineRun failed | | ||
| | 2 | No status conditions available | | ||
|
|
||
| `-E` is also available on `pipeline start` when used with `--showlog`. | ||
|
|
||
| `taskrun logs` does not support this flag — it always exits 0. | ||
|
|
||
| --- | ||
|
|
||
| ## Behavioral Notes | ||
|
|
||
| **`taskrun logs` has no equivalent of `-E`.** To check TaskRun outcome, | ||
| inspect `.status.conditions[0].status`: | ||
|
|
||
| ```bash | ||
| tkn taskrun describe <run-name> --output json | ||
| ``` | ||
|
|
||
| **`delete` requires `--force` on all resources.** Without `-f`, the command | ||
| prompts for confirmation. | ||
|
|
||
| **`--last` targets the most recent run by creation time.** In concurrent | ||
| environments, capture the run name from `pipeline start` stdout and pass it | ||
| explicitly to subsequent commands. | ||
|
|
||
| **`logs` does not support structured output.** Log content goes to stdout; | ||
| errors go to stderr. | ||
|
|
||
| **`export` outputs YAML only.** Use `describe --output json` for structured | ||
| status inspection. | ||
|
|
||
| --- | ||
|
|
||
| ## Common Flags | ||
|
|
||
| | Flag | Commands | Purpose | | ||
| |---|---|---| | ||
| | `--output json` | `list`, `describe`, `pipeline start` | Machine-readable output | | ||
| | `--last` | `logs`, `start`, `pipelinerun describe`, `taskrun describe` | Target the most recent run | | ||
| | `--use-param-defaults` | `start` | Use schema defaults for unspecified parameters | | ||
| | `--skip-optional-workspace` | `start` | Skip prompts for optional workspaces | | ||
| | `--force`, `-f` | `delete` | Skip confirmation prompt | | ||
| | `--showlog` | `start` | Stream logs after starting | | ||
| | `--exit-with-pipelinerun-error`, `-E` | `pipelinerun logs`, `pipeline start` | Exit with PipelineRun status (0=success, 1=failed, 2=unknown) | | ||
| | `--namespace`, `-n` | all | Override the kubeconfig namespace | | ||
| | `--param`, `-p` | `start` | Pass parameter as `<key>=<value>` | | ||
| | `--workspace`, `-w` | `start` | Pass workspace binding | | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing an important flag for scripting/agent use: --exit-with-pipelinerun-error / -E, available on pipelinerun logs and pipeline start. This flag is essential for the Exit Codes section to be useful, and an agent doing CI automation would need it.
Consider adding:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added!