-
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
Refactor Sidecar Containers Construction If Script Exists #6619
Conversation
5216a55
to
8256fcd
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 Xinru! Do we have test coverage for when both the step and sidecar have scripts, when both have debug breakpoints set, and sidecars with readiness probes/liveness probes or other fields that steps don't have?
Thank you for the review @lbernick, one thing I'd love to confirm is, do breakpoints apply to sidecars? Asking because I noticed perviously when building containers for sidecars, the breakpoint parameter is an empty string array 🤔 Line 119 in 09d422c
|
good point, probably not! I don't see any mention of sidecars in https://github.com/tektoncd/community/blob/main/teps/0097-breakpoints-for-taskruns-and-pipelineruns.md or https://github.com/tektoncd/community/blob/main/teps/0042-taskrun-breakpoint-on-failure.md and it's probably not something that would be useful anyway. |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lbernick 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 |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
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 wonder if we could rearrange the functions in the order when they are called?
e.g. maybe we could move convertListOfSteps
, convertListOfSidecars
and hasScripts
in order after the function convertScripts
. This might improve the readability?
Prior to this commit, in order to reuse the code, we convert v1beta1 Sidecar object to v1beta1.Step and then construct containers out of those steps when the script field is specified. As we are switching the storage version to v1, some fields are deprecated in v1.Step (but not Sidecar), thus it does not make sense to convert sidercar to step. While reusing as much code as possible, this commit refactor the code to seperate the container construction process for steps and sidecars.
Thank you @Yongxuanzhang. Good idea! Updated. |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
Not sure why "Setup metallb" failed. Copied from build-log.txt:
Since this seems unrelated to this change itself, retesting to see if it will pass. /retest |
@XinruZhang it looks like it's an issue with TestPipelineRunTasksTimeout; I created #6624 |
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.
/lgtm
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.
/lgtm
Changes
Prior to this PR, in order to reuse the code, we convert v1beta1 Sidecar object to v1beta1.Step and then construct containers out of those steps when the script field is specified.
pipeline/pkg/pod/script.go
Lines 116 to 119 in 09d422c
As we are switching the storage version to v1, some fields are deprecated in v1.Step (but not Sidecar), thus it does not make sense to convert sidercar to step.
While reusing as much code as possible, this PR refactors the code to seperate the container construction process for steps and sidecars.
Partially fix #6575
/kind bug
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes