-
Notifications
You must be signed in to change notification settings - Fork 221
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
TEP-0147 Dynamic Matrix #1081
base: main
Are you sure you want to change the base?
TEP-0147 Dynamic Matrix #1081
Conversation
d68baad
to
7ea1903
Compare
/assign @afrittoli |
351b457
to
18ede4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem statement makes sense to me. I was curious about why the JSON syntax is a bit different from regular implicit combinations.
18ede4d
to
eaf1428
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pritidesai - this will be a nice addition to the matrix functionality,
Do you see this as being part of the scope for matrix beta?
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: afrittoli The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks @afrittoli, yes this is being part of the scope for matrix beta. As an end users, we will be able to cater many more use cases using |
Hey @dibyom, please take a look, its ready for one more round of review, thanks 🙏 |
Thanks @pritidesai. I think we should capture the future work/alternatives around using object params, CEL etc in the TEP itself. Otherwise, LGTM! |
I have CEL described as a future work in one of the paragraphs, I am adding a dedicated section for future work as it might be easier to read to include nested params and CEL support. Thanks! |
eaf1428
to
560864c
Compare
Proposing a new section for matrix which allows to specify the explicit list of combinations dyanmically Signed-off-by: Priti Desai <[email protected]>
560864c
to
33d6cf8
Compare
Done adding two additional sections on alternatives and future work, thanks! |
params: | ||
- name: matrix-strategy | ||
value: $(tasks.read-matrix-strategy.results.matrix-strategy) | ||
taskRef: | ||
name: kaniko | ||
workspaces: | ||
- name: source | ||
workspace: shared-workspace | ||
matrix: | ||
strategy: $(params.matrix-strategy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me why the result is passed to a pt.param then passed to pt.matrix.strategy, I'd have expected the result to be consumed directly in pt.matrix.strategy just like they are in pt.when for when expressions
params: | |
- name: matrix-strategy | |
value: $(tasks.read-matrix-strategy.results.matrix-strategy) | |
taskRef: | |
name: kaniko | |
workspaces: | |
- name: source | |
workspace: shared-workspace | |
matrix: | |
strategy: $(params.matrix-strategy) | |
taskRef: | |
name: kaniko | |
workspaces: | |
- name: source | |
workspace: shared-workspace | |
matrix: | |
strategy: $(tasks.read-matrix-strategy.results.matrix-strategy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think we can support both results and params replacements for this new strategy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, its up to the users how they would like to design their pipelines, both params
and results
are supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now that matrix is in beta, will this feature be an alpha feature gated by its own feature flag?
Matrix as a mechanism and specifications have gone through a promotion process. Matrix specifications using params and include are promoted recently. The process to fan out a given pipelineTask has been part of many pipelines releases. This proposal is not changing the way fan out functionality is implemented. This proposal is reusing existing matrix functionality and extending a syntax to support dynamism. I do not think this requires an alpha feature gate. What is your expectation? |
I meant that |
params: | ||
- name: matrix-strategy | ||
value: $(tasks.read-matrix-strategy.results.matrix-strategy) | ||
taskRef: | ||
name: kaniko | ||
workspaces: | ||
- name: source | ||
workspace: shared-workspace | ||
matrix: | ||
strategy: $(params.matrix-strategy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think we can support both results and params replacements for this new strategy
We propose adding a field - `strategy` of type `string` - within the `matrix` section. This allows pipeline authors to | ||
maintain a single pipeline in a catalog and allow the users to specify the list of explicit combinations for each | ||
instance dynamically through `pipelineRun` or a trigger template or a task result. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a bit confusing for users who are familiar with github actions, it uses strategy.matrix
but we are proposing matrix.strategy
.
And if we look at the example you linked:
strategy:
matrix: ${{ fromJSON(needs.job1.outputs.matrix) }}
Users can just add an expression string for the matrix. It is also doable for use. We can support:
matrix: ${params.matrix_passed_in}
we can implement unmarshalljson to support this.
Would this be considered an alternative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, it could be confusing to the users directly coming in from Github actions but we have designed it such that it aligns with the pipelineTask
struct.
We have introduced matrix
at the taskRef
level in the pipelineTask
struct. All matrix
related fields are part of pipelineTask.matrix
.
Supporting an expression language is listed as a future action item. As a project, Tekton pipelines can decide which all expressions languages we would like to support and design accordingly. We have a CEL
being adopted in when
expressions. We can support it here as well in matrix.strategy
if we have a use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just wondering if we could have a better naming than strategy
? The new field is designed to accept dynamic matrix to pass in. I don't see a clear connection between the word strategy
and its purpose.
yes, my earlier response was in context of
|
We have a control in place to limit the number of combinations generated so we should not be worried about creating unlimited combinations using As a project, we might need a further discussion on how supplemental changes to an an existing |
thanks for the clarifications @pritidesai -- agreed, let's discuss enhancements to beta and stable features (not brand new features) at the next API WG then we can update TEP-0138 to reflect what we agree on cc @JeromeJu @tektoncd/core-maintainers |
/assign |
Thanks @JeromeJu 👍 This proposal is introducing a new |
a stringified JSON payload in a form of `{"include": a list of combinations}` and creates an equivalent number of | ||
instances based on the length of the specified list. | ||
|
||
When `matrix.strategy` is specified, no other `matrix` fields will be allowed i.e. `matrix.params` and `matrix.include` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like the strategy
feature is mutually exclusive to the existing { params
, include
}. Wondering if this is fully compatible if we are going to put both the existing matrix feature and the new matrix-strategy
feature under enable-api-fields
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, strategy
is mutually exclusive from the existing params
and include
from the usage perspective. From the functionality perspective, it is tightly coupled with include
and follows the similar syntax.
The existing matrix feature is guarded behind enable-api-fields
and strategy
will be guarded behind enable-api-fields
as well.
Is that what you are asking?
Thanks @pritidesai for the discussion at the WG 🙏
|
yes, it would inherit the stability level https://github.com/tektoncd/pipeline/blob/main/pkg/apis/pipeline/v1/pipeline_validation.go#L240
|
Thank you everyone for all the reviews 🙏 Please vote on your preferred solution so that we can make progress with this proposal: Option 1: Introduce a new feature flag to support |
I prefer option 1 since it leaves room for changes. But for sure it will add more complexity and option 3 may be the most simple solution. I think we just need to make the trade-off here. |
Thanks for the listing out the options! Thinking out loud. Some context that might be helpful to taken into consideration when voting:
I would tend to vote for option 1 if we could have the validation implementations(not necessary in the TEP) sorted out in some way 🤔 . |
This would only apply to The disadvantage of option 1 is to the maintenance overhead of the new feature flag. Also, we are not introducing just one new feature for
Should we introduce an additional flags for each of these features? |
Ahh 🤔 that's a good and yet tricky question. Can I check if they'd all be introducing new API fields? I am trying to figure out what could be regarded as enhancement and what should be regarded as a new feature. And the enhancement part could possibly just stick with the existing validation. Looking at matrix.displayname, not sure if might fall under the displayname feature IIUC? |
I am anticipating a new API spec/field for both 😞
I consider it as a matrix enhancement/feature rather than the |
@pritidesai: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
matrix: | ||
include: | ||
- name: build-1 | ||
params: | ||
- name: IMAGE | ||
value: $(params.image-1) | ||
- name: DOCKERFILE | ||
value: $(params.dockerfile-1) | ||
- name: build-2 | ||
params: | ||
- name: IMAGE | ||
value: $(params.image-2) | ||
- name: DOCKERFILE | ||
value: $(params.dockerfile-2) | ||
- name: build-3 | ||
params: | ||
- name: IMAGE | ||
value: $(params.image-3) | ||
- name: DOCKERFILE | ||
value: $(params.dockerfile-3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be replaced by an implicit param ?
matrix:
include:
params: foo
value: ["$(params.image-1):$(params.dockerfile-1)", "$(params.image-1):$(params.dockerfile-1)", "$(params.image-1):$(params.dockerfile-1)"]
And then a Task
that split that ?
Now, running a shared `pipeline` with `matrix` where the values for each instance of fanned out task is dynamically specified | ||
at the runtime is not possible with the existing `matrix` syntax. In this proposal, we would like to extend `matrix` | ||
syntax to provide an option to dynamically specify a list of explicit combinations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably is possible, it's just a bit convoluted 🙃
/assign |
[WG] Race condition for TEP# here spotted by @ericzzzzzzz thanks! |
API WG: Any new updates here @pritidesai? |
Proposing a new section
strategy
undermatrix
which allows to specify the explicit list of combinations dynamically.tektoncd/pipeline#7170
/kind tep