-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Missing validation when referencing unknown params with bracket notation #4787
Comments
Proposed SolutionModify the Example:current functionality
expect functionality
|
Just found an issue that the validation against unknown params using the dot notion reference |
To allow bracket notation to extract the variable properly, I think the regex pattern needs to be updated to
And line needs to be replaced by something like:
I'm happy to take a stab at this and add some unit tests if you are not working on it @chuangw6. |
sgtm! Go for it! @chitrangpatel thanks for doing this. |
/assign |
After implementing the above fixes, I now get errors from the webhook if the names are inconsistent even with the bracket notation when I run this task:
|
There is a PR for this: #4811 |
The change in #4833 seems to have broken bracket notation with |
@imjasonh, I don't think it was an intentional breakage. I think we only wanted to enable extraction of variables properly from the three different notations. The issue earlier was that it was not extracting any variable if we didn't use the My guess is that the extraction should return |
The error we get downstream is
But the param is defined:
This worked prior to picking up the change in #4833. |
It seems that #4833 may have broken param names that include dots, using bracket notation with either
Should we revert that change to undo this regression? |
Hi @imjasonh I dug into this and I think I found the issue. Let me summarize here: However, if you see the code before specifically There is clearly a bug that has surfaced since #4833 (but it always existed, just not noticed 🙂 ). I think we should revert this change and implement the fix that resolves the |
There is a PR that addresses these bugs @imjasonh.
If you just use the Let me know if I missed anything. |
I think #4880 shouldn't regard anything like @chitrangpatel IIUC, by the following line, you mean when you see anything like
cc @imjasonh |
fixed in #4833 and #4880 - thanks @chitrangpatel! |
Expected Behavior
There are three ways to reference a parameter in task steps.
If task steps use an unknown
<name>
in any 3 reference forms (means the parameter name is not declared inparams
), the webhook should validate against it and report an error like the following when applying a taskrun.Actual Behavior
$(params.<name>)
dot notation reference$(params['<name>'])
$(params["<name>"])
bracket notation reference. If I use wrong parameter name, the taskrun still succeeds, but the unknown param reference has some bad behaviour i.e. when echo to result.Steps to Reproduce the Problem
echo-params
references an unknown parameter namefooo
using the bracket notation.kubectl get tr <TASKRUN_NAME> -o yaml
taskResults
echo-output
has unexpected content because the parameterfooo
doesn't exits. And this should not happen.Additional Info
Normal behaviour when using unknown name in dot notation
$(params.<name>)
.echo
command in step1's yaml toecho $(params.fooo) | tee $(results.echo-output.path)
Kubernetes version:
Output of
kubectl version
:Tekton Pipeline version:
Output of
tkn version
orkubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'
The text was updated successfully, but these errors were encountered: