Found two things:
Given,
params:
- name: FOO
value: foo
- name: FOOBAR
value: $(params.FOO)-bar
- name: FOOBARBAZ
value: $(params.FOOBAR)-baz
ie, the value of FOOBARBAZ will not fully resolve some times, and will be $(params.FOOBAR)-baz
foo-bar and other times it will be $(params.FOO)-bar like params.FOO has not been processed yet./assign
Thanks @n3wscott.
The first one is definitely something we do not support at that point of time.
The second seems to be a bug as it should work.
Few questions:
v1alpha1) ?Pipeline / PipelineRun objects or also on Task/TaskRun ?/kind bug
/kind feature
I am using the latest release yaml, v1alpha1
It seems to be easer to hit when using Pipelines, but I can get it to happen with Task too but less.
@n3wscott can you share your yamls to reproduce it ?
yeah, I have reworked this a few times, but an older stapshot: https://github.com/n3wscott/chatbot/commit/67ac3c226fbfdc09e171ffb28a95c31f2a3040c4#diff-34cd834803c97715e915dd79c582e49cR54
and a workaround example: https://github.com/n3wscott/chatbot/blob/master/runs/release-0.13/run-update-toml-deps-sample-controller.yaml#L36
Thanks @n3wscott.
The first one is definitely something we do not support at that point of time.
The second seems to be a bug as it should work.Few questions:
- which version of tekton are you using ? of the api (I guess
v1alpha1) ?- is this only on
Pipeline/PipelineRunobjects or also onTask/TaskRun?/kind bug
/kind feature
Having the ability of doing in place modifications of params reduces the need for extra steps / tasks and increases the re-usability of tasks. I didn't know we supported even string interpolation (not-nested), that's good to know.
@skaegi Is this something you're working on as part of the work on parameters that you're doing?
So there are two issues here. We process strings one at a time here: https://github.com/tektoncd/pipeline/blob/master/pkg/substitution/substitution.go#L120
So if one parameter contains a nested reference, it may get expanded twice, depending on the order.
The other issue is that the order is non-deterministic. We iterate over an unsorted map[string]string.
I can think of a couple options here:
input: '$(foo)$(bar)'
replacements:
foo => $(baz
bar => )
baz => bat
I'm leaning toward the final option here.
Sent a PR here for the final option: https://github.com/tektoncd/pipeline/pull/3024
Another challenge to supporting nested expansion: cycles.
foo => bar
bar => foo
How many times would we expand?
This was fixed for now in #3024. If we decide to revisit and do sequential expansion we should file a new feature request.
Most helpful comment
So there are two issues here. We process strings one at a time here: https://github.com/tektoncd/pipeline/blob/master/pkg/substitution/substitution.go#L120
So if one parameter contains a nested reference, it may get expanded twice, depending on the order.
The other issue is that the order is non-deterministic. We iterate over an unsorted
map[string]string.I can think of a couple options here:
I'm leaning toward the final option here.