-
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
"when" expressions do not match user expectations #3345
Comments
thanks @skaegi, it will be great to discuss this sooner, will add it to next API WG discussion (10/12). |
@skaegi to address how to handle tasks that Does the current proposal solve your use cases? It seems to me what you're suggesting is that |
Thanks @jerop and yes, This change will hurt and maybe flipping a global |
yup I agree, we have associated execution status Having @skaegi do you have a use case with combination of |
I think it would be nice discussing this in the next API WG call, but few thoughts
I don't think we really made our mission to have similar behaviour than other CI tools. There is already a "conversion" buy-in when switch to tekton from existing CI tools (some concept are different, …), this is one of them.
It's gonna do more than hurt, it would go against our API change policy : "Any backwards incompatible changes must be introduced in a backwards compatible manner first, with a deprecation warning in the release notes and migration instructions.". If we ever want to switch the default
Same question as @pritidesai, this is going to make the resolution of the dag more and more complex. |
@skaegi one other thought: the current behavior for when expressions is the same behavior we have for the conditions CRD, so this is less about "when expressions" in particular and more about how we've been treating conditional execution in general
maybe another way of solving this is having a config option for controlling the default value for a tekton installation? e.g. you could default the value of continueAfterSkip to true this does have a big downside in portability tho: a pipeline built for a installation with this flag set would not work as expected on one that doesn't have it @skaegi could you tell us more about what kind of scenarios you're envisioning as far as why the default being false would be insurmountable for your users? |
The biggest issue is that you can't do a merge or a synchronize after a Task that contains a "when" expression if the condition fails. For example, Logic like this is really challenging...
Instead you're forced to create a positive and negative Task chain to manage this. (Totally possible there is a better coding pattern here -- please feel free to pipe in)
If you try to write that out in a pipeline CRD it's very complex. This particular shape is very common in our pipelines where the first condition is a check on the existence of a particular tagged image to determine if we need to build it. The second condition is a check on the branch to determine if we need to create an auditable change request entry before promoting to production. It's not "insurmountable" as our teams currently embed logic in steps but this means spinning up a container and not using this feature. I'm genuinely trying to help make this feature useful as it does not currently do what we need. |
@skaegi taking the example you provided above, we can use the ...
tasks:
- name: X
when: # condition1
- input: foo
operator: in
values: ["bar"]
continueAfterSkip: true
taskSpec:
...
- name: Y
runAfter:
- X
taskSpec:
...
- name: A
runAfter:
- Y
when: # condition2
- input: foo
operator: in
values: ["bar"]
continueAfterSkip: true
taskSpec:
...
- name: B
runAfter:
- A
taskSpec:
... The only thing you have to do is set @skaegi does this work for you? we can discuss further in the API WG today |
It seems to me that syntax-wise, when-expressions give users a false impression that they only apply to the associated |
As discussed in the WG today, another consideration when evaluating This concern is currently being discussed in an open pr for supporting results in finally tasks #3242 |
@chhsia0 when the expressions evaluate to false, the pipelinetask is skipped and all the subsequent tasks are skipped by default when a task has ordering dependencies only, |
Also, like @jerop mentioned,
We should avoid any such feature flags controlling the DAG execution flow. |
I think this might be highly subjective? My intuition goes immediately the other way 😄 - I expect a branch of execution to be halted by default if a gating check hasn't passed. In other words, the existing behaviour. It sounded to me like |
Ah, I really like this idea. Keep the declaration of DAG semantics out of the installation configuration but still allow users to make it the default for their pipeline runs. I am +1 on in-addition-to pipelineTask level. |
@pritidesai Yes that would work for me. I have no examples with a mixture of |
@pritidesai @jerop Is there an issue for |
+1 If we allow for a
|
I also like the idea of supporting
@skaegi please share your use cases so that we can find the best way to go forward |
@skaegi |
I suggest we add this at the Pipeline level and NOT in a PipelineRun - PipelineRun configuration is for specifying behavior at runtime, and the continueAfterSkip decision seems fundamental to the expected behavior of a Pipeline, and I'm guessing not something you'd want to go back and forth on at runtime (i wonder if it would make sense to codify something in our design principles about runtime vs authoring time 🤔 ) |
Yes, |
thank you everyone for your contributions to this discussion! it seems to me that the options we've considered are (please let me know if i'm missing something):
what we proposed in the tep is 2a that ensures that all the subsequent tasks are skipped, unless the user explicitly specifies that the ordering-dependent tasks should be executed i'm wondering if anyone prefers the other options after this discussion and if there are more ci/cd use cases to consider note: |
I might prefer 1c, but think I would be fine with 2b even without 2a. I think 2b is a much better alternative than having a global flag. I don't love |
If you have other ideas for the name this is the time! XD I'm not super in love with the name either but it's the clearest name we'd come up with so far. ("keepGoing"? XD)
I agree that the inconsistency is not great and a bit confusing :( Note that 1c with defaults would only help with resource dependencies on "results" - we've been talking about expressing dependencies on workspaces (and we still have PipelineResource "from") (Side note: does 1c below underneath 1? It seems like supporting defaults is something that could be done regardless of the default value of continueAfterSkip?) Also! One nice feature of 2b is that we could still add support for defaults later; I don't think either choice for the default value of continueAfterSkip precludes this :D Since we've brought up this feature several times in different contexts I feel like it might deserve it's own issue (and one day TEP?) |
we can discuss further in the API WG
added 2c for option with default results when continueAfterSkip defaults to false --> #3345 (comment)
I think you might have meant 2a (because 2b is the one with continueAfterSkip at PipelineRun level) |
Going with 1 would break backward compatibility with the way conditions were implemented and brining it up here since we have documented |
thank you everyone for participating in this discussion! will continue forward with option 2a, where as @bobcatfish mentioned, implementing 2a still leaves 2c as an option for the future such that, if we support default results, we can extend it to allow execution of resource-dependent tasks as well when please let me know if you strongly disagree :) |
"when" expressions are great but have introduced a behaviour unfamiliar to existing CI/CD users. The issue is that Tasks set to "runAfter" a Task using a "when" expression do not run. We have many users moving from Travis and Jenkins to Tekton and this is not the way these systems work.
https://www.jenkins.io/doc/book/pipeline/syntax/#when
https://docs.travis-ci.com/user/conditional-builds-stages-jobs
https://argoproj.github.io/argo/examples/#conditionals
https://www.gnu.org/software/make/manual/html_node/Conditional-Example.html#Conditional-Example
In the above system the "when" or "conditional" only applies to the task holding the expression. So long as the Task does not produce a failure the next task executes. Looking at #3139 (comment) -- the behaviour that is consistent with what most other CI/CD provide is ... (2) Use Successful = True for the TaskRun status instead of creating a pseudo failure skipped state.
I recognize this might hurt but I think we need to change the behaviour right away as this will prevent adoption.
The text was updated successfully, but these errors were encountered: