-
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
TEP-0090 Matrix: Refactor Matrix FanOut() to use the Matrix Struct #6246
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we please declare this function as a member function:
just like:
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.
/hold for now until we clarify how this works since the existing logic has matrix.FanOut()
matrixCombinations := matrix.FanOut(rpt.PipelineTask.Matrix.Params).ToMap()
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.
Chatted with Priti and decided for now we will leave as is. The way that Matrix pkg is right now does not make it is easy to simply refactor
FanOut()
as a member function./hold cancel
/assign @pritidesai
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.
@EmmaMunley is it because of import cycle?
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. We would have to move
FanOut()
to where the type Matrix is defined inPipeline_types.go
, however Combinations is defined within Matrix and it doesn't make sense to have Combinations defined in the API.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 @EmmaMunley!
Yup, it results in cyclic imports 🙃 and bringing
combinations
inpkg/apis/
might not be desirable based on recent discussions of avoiding copy/paste in multiple APIs.@jerop I am happy to merge this for now but wanted to understand this package
github.com/tektoncd/pipeline/pkg/matrix
. Also, the package namematrix
being same as the typeMatrix
caused confusion in https://github.com/tektoncd/pipeline/blob/main/pkg/reconciler/pipelinerun/pipelinerun.go#L837There 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.
Matrix type is defined in
pkg/apis/pipeline/v1beta1/
with a couple of member functions. Matrix type has two fields: Params []Param and Include []MatrixIncludehttps://github.com/tektoncd/pipeline/blob/main/pkg/apis/pipeline/v1beta1/pipeline_types.go#L165
pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go
Line 329 in 90f33a6
pipeline/pkg/apis/pipeline/v1beta1/pipeline_types.go
Line 334 in 90f33a6
There is a matrix package with
matrix.go
andmatrix_types.go
with acombinations
defined. Combination type has two fields: MatrixID string and Params []v1beta1.Param.Can we replace
combination
type with matrix struct and add MatrixID to matrix struct? This way we do not have maintain a separate struct and a package.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.
@pritidesai thanks for the suggestions, refactored the implementation - #6282