-
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
Initialize working dirs inside workspace dir #726
Conversation
/ok-to-test |
/retest |
config/controller.yaml
Outdated
@@ -35,6 +35,7 @@ spec: | |||
"-git-image", "github.com/tektoncd/pipeline/cmd/git-init", | |||
"-nop-image", "github.com/tektoncd/pipeline/cmd/nop", | |||
"-bash-noop-image", "github.com/tektoncd/pipeline/cmd/bash", | |||
"-bash-working-dir-image", "github.com/tektoncd/pipeline/cmd/bash", |
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.
Why not using bash-noop-image
instead of having a new flag ? (we were also thinking of renaming this one as the noop
make it more scarier than it is)
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.
We could use the noop image, though my thinking was that it's nice to have separate arguments for users to override if necessary. I.e. if for some reason in a user's setup they need to override the image that's used for creating working directories, e.g. to have their own custom logic run, but don't want to change it for the current use of bash-noop-image (inside of the artifact setup). Thoughts?
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.
That SGTM @dicarlo2
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.
(besides @vdemeester I think we can actually get rid of the noop-image now that we're not using init containers right? i'm having deja vu like we already discussed this... 🤔🤔🤔)
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 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.
... and #715 hasn't been merged yet ... i'm going to catch up eventually i promise...
/test pull-tekton-pipeline-integration-tests |
This LGTM except for the question about the prefix check on WorkingDir |
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 for this @dicarlo2 !! I have some feedback about creating some slightly more focused unit tests (and as a result, potentially changing the function interface a bit)
I also want to know, have you checked how much overhead this adds to TaskRuns
that execute the extra container?
config/controller.yaml
Outdated
@@ -35,6 +35,7 @@ spec: | |||
"-git-image", "github.com/tektoncd/pipeline/cmd/git-init", | |||
"-nop-image", "github.com/tektoncd/pipeline/cmd/nop", | |||
"-bash-noop-image", "github.com/tektoncd/pipeline/cmd/bash", | |||
"-bash-working-dir-image", "github.com/tektoncd/pipeline/cmd/bash", |
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.
(besides @vdemeester I think we can actually get rid of the noop-image now that we're not using init containers right? i'm having deja vu like we already discussed this... 🤔🤔🤔)
I might just be blind, but I'm not seeing the question. With that said, I did change the check to look at the relpath rather than the prefix, so maybe I fixed it :) |
@@ -249,6 +251,52 @@ func TestMakePod(t *testing.T) { | |||
}, | |||
Volumes: implicitVolumes, | |||
}, | |||
}, { | |||
desc: "working-dir-in-workspace-dir", |
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 left this test in so that there's at least one test sanity checking that we add the container as expected.
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
workingDirs: []string{"/workspace/foo", "/workspace/bar", "/baz"}, | ||
want: "mkdir -p /workspace/foo /workspace/bar", | ||
}, { | ||
desc: "empty", |
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: maybe add a test that checks for workingDirs and returns empty
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.
Sorry, I'm not following (maybe because I'm tired and it's pretty late here). Can you restate/give an example?
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.
something like this ? https://gist.github.com/chmouel/b1b085d96ffd4b7a620c26ed3708462c
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.
Done, thanks for clarifying 😄
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: chmouel, dicarlo2 If they are not already assigned, you can assign the PR to them by writing 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 container executes in < 1 second (GKE n1-standard-8, fwiw). I'd expect the overhead would be dominated by the time taken to download the container, which will vary across user setups. On that note, it might make sense to combine some of the binaries into a single image by default, in particular for the init container images (place tools, and this one). |
👍 that would be a great optimisation indeed! |
Oh, also, I expect the integration tests will fail since the |
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.
@dicarlo2 I think we don't need to add a new image, just re-use a existing one 👼
Also, small comments on the code 😉
D'oh, yeah I think I didn't hit submit or something. Looks good now! |
Looks like this needs a rebase and has a few comments left to address. @dicarlo2 are you still planning to get this fixed up? |
Yup, sorry about the delay, had another one of those weeks where I had too many things on my plate. |
/test pull-tekton-pipeline-integration-tests |
In order to allow steps to define workingDirs that are subdirectories of the workspace directory we need to make sure they have been created first since they will not exist on startup. Fixes tektoncd#725
Looks like the |
/retest |
@dicarlo2: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
Subsumes tektoncd#726, with a unit test fix and a tweak to make sure that artifact_bucket_test doesn't try to run in parallel, since that messes up various PipelineRun tests. Signed-off-by: Andrew Bayer <[email protected]>
Subsumes #726, with a unit test fix and a tweak to make sure that artifact_bucket_test doesn't try to run in parallel, since that messes up various PipelineRun tests. Signed-off-by: Andrew Bayer <[email protected]>
#843 is merged, we can close this one 😁 |
@vdemeester: Closing this PR. In response to this:
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. |
Subsumes tektoncd#726, with a unit test fix and a tweak to make sure that artifact_bucket_test doesn't try to run in parallel, since that messes up various PipelineRun tests. Signed-off-by: Andrew Bayer <[email protected]>
Add KO_DATA_PATH env to Dockerfiles
Changes
In order to allow steps to define workingDirs that are subdirectories of the workspace directory we need to make sure they have been created first since they will not exist on startup.
Fixes #725
Note: this PR does not solve the general problem of ensuring all valid combinations of workingDir + volumes + volume mounts will not fail, instead opting to keep things simple and solve the most common case as a first pass - setting the working directory to the cloned git repository (or other input resource folder). We also do not check that the
workingDir
path actually refers to the implicit workspace volume (as opposed to a user defined one that they've mounted at the same path) because it keeps the logic simple and the worst case is we have an additional empty directory in the implicit workspace volume.Adds an additional parameter to the controller config for the image to use for this container. We could have reused the other bash image parameter, but it makes for a nice extension point to tekton to keep them separate IMO since it allows overriding specific bits of functionality should the user desire.
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.
Release Notes