Skip to main content
StepAction is currently at v1beta1 stability level.
A StepAction represents the actionable components of a Step that can be referenced from Tasks. StepActions enable reusable step logic across multiple Tasks.

Resource Definition

apiVersion
string
required
tekton.dev/v1beta1
kind
string
required
StepAction
metadata
ObjectMeta
required
Standard Kubernetes metadata.
spec
StepActionSpec
required
Defines the desired state of the StepAction.

StepActionSpec

description
string
A user-facing description of the step action.
image
string
Container image reference to run for this StepAction.
command
[]string
Entrypoint array. Not executed within a shell. The image’s ENTRYPOINT is used if not provided.
args
[]string
Arguments to the entrypoint. The image’s CMD is used if not provided.
script
string
Script is the contents of an executable file to execute. If Script is not empty, the StepAction cannot have a Command and the Args will be passed to the Script.
workingDir
string
Working directory for the step.
env
[]EnvVar
List of environment variables to set in the container.
params
[]ParamSpec
Input parameters required to run the StepAction. Parameters must be supplied when referencing this StepAction from a Step.See Parameter Types for details.
results
[]StepResult
Values that this StepAction can output.
securityContext
SecurityContext
Security options the Step should run with. Takes precedence over Task-level security context.
volumeMounts
[]VolumeMount
Volumes to mount into the Step’s filesystem.

Using StepActions in Steps

Steps can reference StepActions using the ref field:
steps:
  - name: use-stepaction
    ref:
      name: my-stepaction
    params:
      - name: param1
        value: value1

Example

apiVersion: tekton.dev/v1beta1
kind: StepAction
metadata:
  name: git-clone-action
spec:
  description: "Clone a git repository"
  params:
    - name: url
      type: string
      description: Repository URL
    - name: revision
      type: string
      description: Git revision to checkout
      default: "main"
  image: gcr.io/tekton-releases/github.com/tektoncd/pipeline/cmd/git-init:latest
  command:
    - /ko-app/git-init
  args:
    - "-url=$(params.url)"
    - "-revision=$(params.revision)"
  results:
    - name: commit
      description: The commit SHA that was checked out

Build docs developers (and LLMs) love