-
-
Notifications
You must be signed in to change notification settings - Fork 866
Simplify atc/worker package and extract runtime abstractions #6597
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
Conversation
FYI the intention is to take logic that previously existed in |
819f0f4
to
113d140
Compare
Hey @aoldershaw, not sure if you have noticed #6495 that may impact this refactor. |
@evanchaoli thanks, i've seen that PR, seems cool! I'm still not sure what will become of this PR, it's still very much a WIP - but if we decide to go forward with this PR, we'll be sure to bring your commits over |
7a5249a
to
8c0d280
Compare
8b95a78
to
f066e18
Compare
@aoldershaw thanks for that great dependency graph! would it be easy enough to produce the same graph for the refactored code? |
@muntac absolutely! I'm planning on writing out more in depth how things are structured, but hopefully this is a decent start: The primary goal is to find a common interface that can be implemented for other runtimes (e.g. a k8s runtime). One thing I didn't illustrate in the original dependency graph is how external packages interact with the So, the The
|
Still wrapping my head around this. Initially tried to account for the interactions of the
Still figuring out the functionality bit, and will then dive back into commits.
Feel free to suggest a different approach. |
@muntac would it help if I went over each of the interactions with
** This is due to the refactor...previously, we used "Artifact" to mean two things - the uploadable/downloadable volumes I've been describing that are used in
So, the high-level flow for
The various delegates in
All that to say the |
@aoldershaw saw this but forgot to respond. This is great. Thanks so much! |
@muntac glad to hear it! still working on it, haven't gotten to the |
8fa5652
to
f10ec1f
Compare
71dc353
to
efb953e
Compare
Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
this commit adds a new abstraction, runtime.Artifact, that is simply some chunk of data that can be streamed out. runtime.Artifact is a generalization of runtime.Volume. the exec package only interacts with runtime.Artifact - it doesn't care whether the Artifact is from a Volume or anything else. note that we don't currently have any types of Artifact that aren't Volumes - however, this means we could support mounting volumes to workers from content that is generated on the ATC in memory (rather than needing a dummy task that creates an output with the file contents, which is much more heavy weight). Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
...for the fewest-build-containers strategy. now that this is cached, it should be very quick to access Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
4fba2ef
to
75fbb36
Compare
#7336 sped up the TSA tests by compiling the test binary with a package constant set. however, this package was moved, so we weren't setting the constant properly. unfortunately, this doesn't result in a compilation error, and fails silently Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
75fbb36
to
e46eb54
Compare
I gather these setting the workdir isn't required for these steps. After #6597, the number of volumes on a given worker shot up by ~50% (on a stress testing environment that solely runs check+get steps) - this is a result of the extra volume per check+get container. these volumes don't have a significant impact since they're empty, but they will mess up people's metrics and placement strategies Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
I gather these setting the workdir isn't required for check steps. After #6597, the number of volumes on a given worker shot up by ~50% (on a stress testing environment that solely runs check+get steps) - this is a result of the extra volume per check container. these volumes don't have a significant impact since they're empty, but they will mess up people's metrics and placement strategies Signed-off-by: Aidan Oldershaw <aoldershaw@pivotal.io>
concourse/concourse#6597 changed how the `path` works in Concourse and allowed users to specify an absolute path. The exact commit is this one: concourse/concourse@2ba0164 This has been the current behaviour since 7.5.0 so I don't think there's any going back on this behaviour now. I think it may make caching stuff a lot easier for folks to work with. I'm generally in favour of this change which I think was kinda snuck in. It was a massive PR. Signed-off-by: Taylor Silva <dev@taydev.net>
The behaviour of this was changed back in 7.5.0 by #6597 Previously only relative paths were allowed. No tests were added to handle these new cases. In testing this I also found that paths with parent directories were also allowed and would work. You'd get the input mounted above the task's CWD. This seems like a bad thing to encourage so I've locked things down to only allow absolute and relative paths. Allowing parent directories seems like an easy footgun for users to fall onto. We now have test coverage for: - Allowing absolute paths in task inputs/outputs - Ignoring paths with parent directory references in them Signed-off-by: Taylor Silva <dev@taydev.net>
What does this PR accomplish?
The current atc/worker package is extremely fragmented with a ton of indirection and internal interfaces, presumably for the sake of easier testing. Here's a (loosely defined) dependency graph for the existing atc/worker package I put together when trying to understand how things currently interact:
The tests all test against these internal interfaces against auto-generated fakes and break upon any sort of code restructuring.
This PR aims to tear out the existing atc/worker package and replace it with the same logic, but with much less indirection - pretty much all abstraction (besides the firm interfaces - Garden, Baggageclaim, and the DB) is limited to method calls. It brings a new test-suite that tests at a higher level against the interfaces that Garden-based workers actually depend on - Garden, Baggageclaim, and the DB - using hand-written in-memory fakes (or, in the case of the DB, an actual Postgres server).
It also introduces tries to come up with some more clean interfaces for implementing other runtimes (esp. k8s) and puts these types in the
atc/runtime
package.Below is the new model of the world:

In particular, the big box in the first diagram has become the two packages
atc/worker
andatc/worker/gardenruntime
above.Changes proposed by this PR:
Still a wip, see the individual commits for much more detailed commit messages
Notes to reviewer:
Release Note
Contributor Checklist
Reviewer Checklist
BOSH and
Helm packaging; otherwise, ignored for
the integration
tests
(for example, if they are Garden configs that are not displayed in the
--help
text).