Skip to content
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

Invalid Validation of StepTemplate with StepAction Ref #7981

Closed
chitrangpatel opened this issue May 23, 2024 · 0 comments · Fixed by #7982
Closed

Invalid Validation of StepTemplate with StepAction Ref #7981

chitrangpatel opened this issue May 23, 2024 · 0 comments · Fixed by #7982
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@chitrangpatel
Copy link
Contributor

Expected Behavior

When using StepTemplates in Steps referencing StepActions, there shouldn't be a validation error if the StepTemplate uses fields that conflict with StepActions (e.g. env)

e.g. The following should work be passed by the validation web hook. After the StepAction is fetched, it should naturally be merged with the underlying StepTemplate.

kind: TaskRun
metadata:
  name: task-run
spec:
  taskSpec:
    steps:
      - ref:
          name: step-action
    stepTemplate:
      env:
        - name: foo
          value: bar
---
apiVersion: tekton.dev/v1beta1
kind: StepAction
metadata:
  name: step-action
spec:
  image: ubuntu
  command: ["env"]

Actual Behavior

A web hook validation error is thrown that env cannot be used with ref. This is wrong since the user did not explicitly provide the env with the ref field in the Step. The purpose of StepTemplate is to add values to Steps. This should only happen after the StepAction is fetched and inlined.

Steps to Reproduce the Problem

  1. Run the above yaml kubectl apply -f <above yaml>

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-14T09:47:38Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"darwin/arm64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.12-gke.1115000", GitCommit:"885327b7f1bebce409c843425b4688e3eeed33f4", GitTreeState:"clean", BuildDate:"2024-03-28T09:16:53Z", GoVersion:"go1.21.8 X:boringcrypto", Compiler:"gc", Platform:"linux/amd64"}
  • Tekton Pipeline version:

    Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'

Client version: 0.34.0
Chains version: v0.21.0
Pipeline version: v0.60.0
@chitrangpatel chitrangpatel added the kind/bug Categorizes issue or PR as related to a bug. label May 23, 2024
@chitrangpatel chitrangpatel self-assigned this May 23, 2024
chitrangpatel added a commit to chitrangpatel/pipeline that referenced this issue May 23, 2024
This PR fixes the validation error when using StepTemplates with Steps
referencing StepActions.

Fixes: tektoncd#7981
chitrangpatel added a commit to chitrangpatel/pipeline that referenced this issue May 24, 2024
This PR fixes the validation error when using StepTemplates with Steps
referencing StepActions.

Fixes: tektoncd#7981
chitrangpatel added a commit to chitrangpatel/pipeline that referenced this issue May 24, 2024
This PR fixes the validation error when using StepTemplates with Steps
referencing StepActions.

Fixes: tektoncd#7981
tekton-robot pushed a commit that referenced this issue Jun 3, 2024
This PR fixes the validation error when using StepTemplates with Steps
referencing StepActions.

Fixes: #7981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant