Repository navigation
feat: lift HTTP implementation to dagger - #10317
Conversation
38cf98b to
0dffb31
Compare
6bef4aa to
252cf4e
Compare
| var err error | ||
| engine = dev.Engine().Generate() | ||
| docs, err = engine.Sync(ctx) | ||
| engine, err = engine.Sync(ctx) |
dafd794 to
2c12dff
Compare
| } | ||
|
|
||
| func (s *containerSchema) asTarballPath(ctx context.Context, val dagql.Instance[*core.Container]) (string, error) { | ||
| func (s *containerSchema) asTarballPath(ctx context.Context, val dagql.Instance[*core.Container], _ containerAsTarballArgs) (string, error) { |
There was a problem hiding this comment.
missing what required this change (doesn't matter either way though)
There was a problem hiding this comment.
This function gets passed to dagop - and the HTTP path function uses the args from the main call to determine the path.
So, if you download https://example.com/foo.txt, the filename you download it to is foo.txt (which felt like it made sense, previously the name wasn't significant, because we needed to get certain buildkit caching behavior).
|
|
||
| st := httpdns.HTTP(args.URL, clientMetadata.SessionID, opts...) | ||
| return core.NewFileSt(ctx, parent, st, filename, parent.Platform(), svcs) | ||
| // evaluate now! so that the snapshot definitely lives long enough |
There was a problem hiding this comment.
I guess we lose laziness that we had previously, right? Or is it more complicated.
Not a blocker necessarily, mostly just double checking for now.
There was a problem hiding this comment.
Yeah, more complicated 😢 the way buildkit handles this:
- During
CacheKeyit creates and immediately releases a snapshot, saving it on the source - During
Execit looks for the saved snapshot, if it's not there, it recreates it (by dedownloading)
So previously we were always creating a snapshot in CacheKey - this is pretty much the same kind of behavior, the HTTP source isn't really very lazy (since there's no authoritative way to quickly query the digest of an arbitrary remote URL).
Without this, the function can't be called from the CLI. Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
- Allow passing arbitrary data to dagop directly - Rework digest calculations (so we can control it more precisely in the future) - Remove cache access from dagop, and lift it into the Query (so we can create cache refs outside of dagop) Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Checks for all the behavior we want: - Arg overrides - ETag handling - Timestamps - Caching Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
Signed-off-by: Justin Chadwell <[email protected]>
- Ensure that we correctly propagate + smuggle dagop data in all cases (it's not part of the cache key, but definitely is part of the digest) - Include filename + permissions in the url hash (so that we don't accidentally use the wrong snapshots). - Ensure HTTP snapshots are always freed! (we sometimes weren't) Signed-off-by: Justin Chadwell <[email protected]>
|
Hit a new test flake in |
In #9980, we lifted our custom git implementation entirely into dagger using dagop (#9395). In this PR, we do exactly the same, but for our custom http source.
Additionally, while in the area, I've added a couple features:
TODO:
TODOs