-
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
Split out entrypoint resolution and injection, and script conversion #1616
Conversation
The following is the coverage report on pkg/.
|
6157f91
to
6338b66
Compare
The following is the coverage report on pkg/.
|
/lgtm |
6338b66
to
54631fd
Compare
The following is the coverage report on pkg/.
|
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.
In general I very much ❤️ this!!! +10000
I'm a bit confused by all these "defensive copies" but mostly b/c I don't know what they are 😅
Might I also add: beautiful commit message!!
Lastly: to tell you the truth I looked in a lot of detail in the first 1/2 of the code and a lot less at the 2nd half so that is what it is 😅
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bobcatfish 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 |
d9522af
to
c0545fe
Compare
The following is the coverage report on pkg/.
|
The following is the coverage report on pkg/.
|
c0545fe
to
796948c
Compare
The following is the coverage report on pkg/.
|
796948c
to
c37efe2
Compare
The following is the coverage report on pkg/.
|
c37efe2
to
83b5374
Compare
This is the next and largest step of the effort to simplify and separate MakePod out into digestible chunks (tektoncd#1605) Behavioral changes: - Script->Command conversion now happens before entrypoint rewriting, rather than converting the rewritten entrypoint args. - Image name->digest lookups are cached locally while resolving a single TaskRun's steps (with test!) - Entrypoint lookups also update the step's digest. This was a race before: if an image was pushed between resolution and pod start, the resolved command might be out-of-date. Some redundant test cases have been removed from taskrun_test.go -- this file should test only behavior of taskrun.go, which is now smaller. Unit tests for individual transformation behavior has been moved into individual test files in pkg/pod, with some integration tests in pod_test.go -- some of these could likely be removed as well, if we feel like it.
83b5374
to
b83dd20
Compare
The following is the coverage report on pkg/.
|
The following is the coverage report on pkg/.
|
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.
This looks gooooood 😻
/lgtm
return nil | ||
} | ||
|
||
func IsContainerStep(name string) bool { return strings.HasPrefix(name, StepPrefix) } |
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.
nit: can we have docstring here too (just for godoc.org 😛 🤗 )
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.
Yeah good point. I'll make sure to have doc strings everywhere before calling this done.
} | ||
e.lru.Add(digest.String(), ep) // Populate the cache. | ||
|
||
d, err = name.NewDigest(imageName+"@"+digest.String(), name.WeakValidation) |
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.
nit: I wonder if we could use name:tag@digest
notation here (thinking outloud, ignore me 👼)
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 not really sure what it would buy us, this string is never surfaced directly to users.
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.
Isn't it surfaced in the final pod spec ? (anyway it's really not that big of a deal)
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 is, but that pod spec is intended to be an implementation detail, and we shouldn't expect users to see it. The user's specified tag will be shown in the TaskRun's .spec
, and the resolved digest will be shown in the TaskRun's .status
, that's all that really matters.
Args: []string{"-c", ""}, | ||
VolumeMounts: []corev1.VolumeMount{scriptsVolumeMount}, | ||
// Zero out non-max resource requests. | ||
// TODO(jasonhall): Split this out so it's more easily testable. |
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.
nit: TODO(#1605) 😝
@@ -23,7 +23,7 @@ import ( | |||
|
|||
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" | |||
listers "github.com/tektoncd/pipeline/pkg/client/listers/pipeline/v1alpha1" | |||
"github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" | |||
podconvert "github.com/tektoncd/pipeline/pkg/pod" |
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.
Any reason for naming it podconvert
instead of pod ?
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.
There's a variable called pod
below that causes problems. When this is all done I hope to avoid this named import.
Split out entrypoint resolution and injection, and script conversion
This is the next and largest step of the effort to simplify and separate
MakePod
out into digestible chunks (#1605)Behavioral changes
rather than converting the rewritten entrypoint args.
TaskRun's steps (with test!)
before: if an image was pushed between resolution and pod start, the
resolved command might be out-of-date.
Some redundant test cases have been removed from taskrun_test.go -- this
file should test only behavior of taskrun.go, which is now smaller.
Unit tests for individual transformation behavior has been moved into
individual test files in pkg/pod, with some integration tests in
pod_test.go -- some of these could likely be removed as well, if we feel
like it.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
/assign @sbwsg