#maintainers

1 messages ยท Page 5 of 1

still garnet
#

and since replace is ignored by go get, it'd be looking in vendor/ for version A, which isn't what we want

#

(i'm making a lot of assumptions here)

wild zephyr
#

just checked and indeed vendor contents are not cached by the proxy indeed, so doesn't seem we have an easy way out here

still garnet
#

thanks for checking!

cosmic cove
wet mason
#

@rancid turret should we just go ahead and merge the Python PR as is? We can iterate after that

rancid turret
wet mason
#

Letโ€™s do it then ๐Ÿ™‚

#

Not in front of my computer right now

civic yacht
#

Sanity check as I run into more fun with implementing the new multiplatform api approach:

ctr := c.Container().From("alpine").WithPlatform("x86").Exec("uname -a")
outputA, _ := ctr.Stdout().Contents()

ctr = ctr.WithPlatform("aarch64").Exec("uname -a")
outputB, _ := ctr.Stdout().Contents()

fmt.Println(outputA, outputB)

Would you expect the output of the above to be

  1. "x86 aarch64"
  2. "x86 x86"
    ?
    cc @tepid nova @wet mason @still garnet (but anyone feel free to chime in)
still garnet
#

this feels like a trick question

#

1 seems obvious from the code, is there some catch?

civic yacht
#

Haha I promise I'm not trying to trick anyone, I agree that 1 seems obvious, I needed to verify my sanity in that regard.

There is a case to be made for 2 in that WithPlatform could be viewed as setting the default for new Directories in the container going forward but not apply to directories that have already been put in the container.

The implication of thinking that 1 is the obvious answer is that it means when you call WithPlatform it "retroactively" applies to Directories that were already loaded into the container. So, you already pulled the alpine rootfs and executed it as x86, but now you want to switch to aarch64.

still garnet
#

ah so will that technically run uname -a twice on the second call?

#

since it's descending from a x86 uname -a that gets "rebased" to aarch64

civic yacht
# still garnet ah so will that technically run `uname -a` twice on the second call?

Exactly, it might be possible to avoid that and only execute the second uname -a but it gets really complicated.

Another cool wrench thrown into all this is that buildkit "bakes" the platform in at llb marshal; when you unmarshal later and try to set a different platform, it does not override anything that was marshalled previously. There's some possible ways of dealing with that though.

ancient kettle
#

Oh... that is weird.

still garnet
#

i think it's kinda weird but I'm not sure how often it'll come up, seems like people would branch off for different architectures rather than replacing them in one pipeline chain with repeated commands

#

definitely worth documenting though

civic yacht
still garnet
#

you could kind of sort of spin it as a feature, since it lets you construct a single pipeline and then run it against multiple architectures, without the pipeline constructor having to know that ahead of time

ancient kettle
#

One of the downsides of the design of Container is somewhat odd/edge-casey behavior like this.

still garnet
#

e.g. goBuildPipeline.WithPlatform("x86").Directory("out").Export(ctx, "out")

civic yacht
still garnet
#

unrelated: ๐Ÿงตfor go dependency hell

still garnet
civic yacht
ancient kettle
#

@wet mason @tepid nova @twin crow I ran yarn test from dagger-cue/tests... and I definitely need to make sure this is correct (feels a bit fishy to me currently...) but...

101 tests, 25 failures

oak sandal
ancient kettle
#

al1000 solomon4104 samalba0001 I ran

#

What is the expected behavior of

extend type Query {
    "An http remote"
    http(url: String!): File!
}

if the url is not valid? (gives something other than 200 or 2XX)

#

With core.#HTTPFetch, i get failures if it's an invalid url.

civic yacht
ancient kettle
#

When I run this with a "bad" url, it doesn't fail:

    fileid, err := dgr.HTTP(httpFetch.Source).ID(ctx)
    if err != nil {
        return nil, err
    }
civic yacht
ancient kettle
#

Hmm... the URL is giving a 302

civic yacht
ancient kettle
#

Oh... possibly that, too.

civic yacht
#

One of the reasons to hide ID

ancient kettle
#

I'm also copying that file...

dirId, err := dgr.Directory().WithCopiedFile(httpFetch.Dest, fileid).ID(ctx)
#

But I suppose it's possible that doesn't execute, either.

civic yacht
ancient kettle
#

I'm getting an empty file, it appears:

    file, err := dgr.File(fileid).Contents(ctx)

    fmt.Println("file:", file)

just prints file:

#

๐Ÿ˜•

still garnet
#

are you missing an err check there?

ancient kettle
#

Yes. ๐Ÿ˜›

#

Only the File().Contents() call fails, FWIW.

#

Hmm... Yeah, I'm probably going to need a way to force evaluation.

rancid turret
ancient kettle
#

Turns out that simply relying on the convention that something that returns an errors creates an evaluation is incorrect... as seen in the above example.

#

Which I think is why I was surprised by it.

rancid turret
ancient kettle
civic yacht
ancient kettle
#

I'd personally still like a way to take a Container or Directory and force an evaluation.

tepid nova
#

sync ?

rancid turret
#

With those, you need to select sub fields anyway.

#

In GraphQL you can't return objects without selecting which fields.

civic yacht
ancient kettle
#

Hmm... yeah. If we remove ID, I'm not sure how I can continue my port of dagger-cue (without changing the Europa API).

tepid nova
#

you can still query for ID if needed I guess

ancient kettle
ancient kettle
civic yacht
#

(updating the hide ID issue with this)

ancient kettle
#

Thanks, @civic yacht!

oak sandal
oak sandal
wild zephyr
#

Hey folks just hit a limit from buildkit

ancient kettle
#

@still garnet In the comments in https://github.com/dagger/dagger/pull/3560 you said:

Won't help us if/when we need unreleased Buildkit features. There are already some juicy things merged that it'd be nice to use.

I'm curious what you're most excited by.

still garnet
#

the two things I had in mind are importing OCI archives and propagating container hostname as K8S_POD_NAME to CNI plugins (for container-to-container DNS), but I'm sure there are more, it's been a while since they've shipped a minor version

ancient kettle
#

Nice! Yeah, I remember you mentioning those things.

still garnet
#

also support for adding name/other metadata to exported OCI archives

ancient kettle
still garnet
#

lol, yea that too. fortunately that's client-side only so we can just vendor the change if we want to avoid the dependency hell for now

ancient kettle
tepid nova
obsidian rover
#

Might be a dumb question, but I have a rune in Go, outputed in ascii 50 10 32 32 32 32 32 32 10 32 32 32 32 32 32 32 32 10 32 32 32 32 10 10 32 32 32 32 32 32 32 32 48, I want to Trim all 10 and 32. I tried this func (and the official trimspace), but it doesn't seem to work

noSpace := strings.TrimFunc(repositoryInfos, func(r rune) bool {
            return !unicode.IsNumber(r)
        })

If someone is around to help, interested ๐Ÿ˜‡

still garnet
#

Trim only cares about beginning/end, and all those are in-between, so you probably just want a replace function

#

i don't know of a character filtering func offhand though ๐Ÿค”

civic yacht
still garnet
tepid nova
#

Anything I should prioritize reviewing? Other than 3560 (host API) I'm already on that

obsidian rover
#

I resigned myself to do a regex on that string, that's the only thing that worked ... This is cleaner

still garnet
#

neat. i've never used that interface before

#

engine internals termonology

wild zephyr
#

๐Ÿ‘‹ @wet mason I recall that in one codegendemo you showed a way to see the underlying graphql queries the SDK was doing. Do we still have that capability?

tepid nova
civic yacht
#

Anything I should prioritize reviewing

wet mason
#

@civic yacht Also FYI -- I reworked the dial-stdin. Then got stuck -- not sure what it means for multiplexing, how many times commandconn re-spawns the binary, performance, etc

I'm postponing this for a bit but I'll need some help to talk this through

bronze hollow
#

One of the downsides to the Go SDK - we don't get the running logs from the containers

wet mason
#

dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) <-- this should get you some stuff

bronze hollow
#

๐Ÿ˜ฎ

#

Please stand by ๐Ÿ™‚

#

That's awesome

#

Thank you

wet mason
#

sure!

tepid nova
wet mason
#

@civic yacht @tepid nova @still garnet @rancid turret I have a semi-working implementation of "hide the ID" thing ๐Ÿ™‚

tepid nova
bronze hollow
#
codeDirectory := client.Host().Directory(dagger.HostDirectoryID(path)).Read()

Are there any limitations on what that path can be?

I'm getting "NotFound: no access allowed to dir"

still garnet
#

@bronze hollow currently you have to pre-configure dirs like dagger.Connect(ctx, dagger.WithLocalDir("foo", path)) and then do client.Host().Directory("foo") - that'll be changing in the next release

tepid nova
bronze hollow
#

OK. I got my monorepo working with the Go SDK (Only one service but built from two locations)

It's not bad, but the dir stuff is a little awkward

#

It was really easy to get Doppler and Pulumi working. with the Go SDK too ๐Ÿ™‚

wet mason
#

@still garnet @tepid nova @civic yacht @rancid turret Thoughts on the "synchronous" part of https://github.com/dagger/dagger/issues/3558#issuecomment-1295343511 ?

Basically:

  • Make ID synchronous (consistency with all other scalar resolvers that return an error -- right now ID is the only lazy special case)

  • Have an option in ID to be lazy. This will be used by codegen (needs lazyness). Alternatively, there's a special field for lazy (e.g. serialize)?

  • We codegen func (*r <T>) Sync(ctx) (<T>, error) (or something) to force evaluation in an explicit way

e.g.
c := container.Exec(...) -> async
c, err := container.Exec(...).Sync(ctx) <-- sync

Right now, without this, people are just calling Stdout().Contents(ctx) or whatever and throwing away the result (doing this in our magefile)

still garnet
#

that all feels intuitive to me ๐Ÿ‘ i'm searching for a better name than Sync but nothing is coming to mind

tepid nova
civic yacht
oak sandal
#

This might be too far in the future but I was wondering about it. Considering dagger ecosystem is going to be multi-lingual, would there be a marketplace equivalent of Github actions? Basically, if I want something to run in my pipeline someone else has already created in different SDK than my codebase, how would I run it?

wet mason
#

[for next week] @civic yacht @still garnet @rancid turret I patched upstream graphql-go to keep the argument ordering as defined in the schema: https://github.com/graphql-go/graphql/pull/654

I tried locally to codegen using it and it works

HOWEVER -- the upstream patch is a breaking change, no way it's getting merged. So either we maintain a fork or we find another solution

GitHub

This change allows to preserve the order in which arguments have been
defined in introspection queries.
I realize this is a breaking API change and therefore might not make
sense, just throwing it ...

tepid nova
verbal scroll
#

If I wanted to get an early jump on writing some dagger โ€œextensionsโ€. Where would I look to get information on getting started.

oak sandal
#

Nic's doing a livestream on dagger.
I've literally picked up Go just watching his videos, really an amazing person. He's doing a stream after a year , so I guess he's excited about Dagger too.
https://www.youtube.com/watch?v=w-3K8in9jb4

civic yacht
#

If I wanted to get an early jump on

wet mason
#

Late night idea: so what if we take a shortcut and bundle buildkit with the engine and run it as a container with -v /:/host (and prefix llb.Local calls with /host under the hood)? How terrible is this?

Con: โ€œhostโ€ access is limited to the host running the engine, not the host running the SDK. Performance?

Pro: We get to run the engine as a container in a matter of hours, not weeks/months. We get to shift to this architecture right away (for the first non-Go SDK), rather than figuring out a way to distribute engine binaries somehow

Wasnโ€™t an option before, but with the host directories work of last week itโ€™s now possible since we donโ€™t need to define local dirs ahead of time

civic yacht
#

Engine

still garnet
tepid nova
#

Should we cut a release to get the new host API goodness into the hands of the community ASAP?

still garnet
#

ok just checked and it seems fine (existing tests would be failing) - I do think we should get the above bugfix in too though, it's easy to run into

tidal spire
#

Chatting with @ancient kettle earlier he said in an old version of dagger we had an example pointing the engine's opentelemetry at jaeger. Is that currently possible with 0.3?

wet mason
tepid nova
#

Works for me, depends how short term those things are I guess

#

btw I know technically semver requires changing major version number at breaking change... But pre-1.0 is a special case IMO because the conventional meaning of 1.0 is not compatible with semver

#

In other words: everyone OK with calling it 0.4.0 even though it has breaking changes?

ancient kettle
#

I think we're more than good. ๐Ÿ™‚

tepid nova
#

Ah ๐Ÿ™‚ perfect

tepid nova
# tepid nova Works for me, depends how short term those things are I guess

Actually I think we should cut a release no later than tomorrow. Today would be better IMO.

Combining breaking changes to limit the pain makes sense in general, but we have almost zero users so in this case I think it actually makes more sense to get changes out as fast as possible, to reduce the number of breaking changes encountered by users in average. If we release the new host API now, it will actually result in less pain overall (assuming we are getting a significant number of new users every day)

wet mason
#

@civic yacht @still garnet Does maintaining a fork of graphql-go still sounds like a good idea after the weekend?

still garnet
#

as long as we don't need a replace ๐Ÿ˜›

wet mason
#

hell no ๐Ÿ˜›

civic yacht
wet mason
#

If we're not feeling it, I'll rewrite codegen to work on the SDL directly

wet mason
wet mason
tepid nova
#

@wet mason personally I would merge each PR exactly when we feel it's ready to merge. Release timing should not affect it either way, since we are free to release as frequently and early as we want at this point

#

For the ID thing, obviously I'm eager to have that improvement, but I'm assuming there's some sort of one-way door in those solutions, I wouldn't mind getting a quick live discussion before merging just to understand the tradeoffs there

still garnet
wet mason
civic yacht
wet mason
#

if you have some time to take a look it would be great

still garnet
#

checking now!

wet mason
#

thanks!

still garnet
#

approved ๐Ÿ™‚ API makes sense to me, also cool seeing the internal changes (less need to pass platform around all over the place)

civic yacht
#

Had to resolve a conflict and wait for tests, but now finally merged ๐Ÿ™‚ Thanks for the reviews everyone!

hasty basin
tidal spire
wet mason
#

@civic yacht @still garnet I'm doing the recursive stuff to get rid of ID in option structs (for optional fields), but there's one problem though: top-level query fields (e.g. file, container, directory) now take a File, Container, etc as argument

I can fix it with some weird special casing, not sure if it's worth it though. Thoughts?

civic yacht
#

I forget if @ancient kettle needs the ability to explicitly use IDs at any point for dagger-cue, that's the only possible use case I can think of that might mean it's worth fixing

#

most users of the SDK should not needs those top-level apis anymore though as far as i can think

ancient kettle
#

Itโ€™s possible I could do something elseโ€ฆ but for now I am shoving IDs into the Europa structs.

wet mason
#

I don't know if the answer is we should keep that, or in XDX netlify should just be able to take a *Secret as argument and go

#

@civic yacht It did work though, I just rebased ๐Ÿ™‚

civic yacht
wet mason
#

quick q: i'm converting platform_test.go, not sure what this is for:

WithMountedDirectory("/out", "") --> scratch?

civic yacht
wet mason
#

๐Ÿ‘

wet mason
ancient kettle
#

I'd like to set up a time to chat with people in the community who are interested in a CUE SDK for the latest 0.3+ APIs. Let me know in this thread if you're interested, so we can figure out timing and such!

wet mason
#

Not proud of it, but it is what it is. Wondering if we're going to get rid of those ID-based selectors altogether in the future

#

At least for now nothing breaks (including netlify's secret lookup) -- I think we need to address that (secret management) and hiding IDs in XDX before we can remove top-level ID lookups (otherwise it's impossible for an extension to take a DirectoryID as input -- there's no way to retrieve the underlying Directory back, and there's currently no way to take Directory as input directly)

wet mason
#

@still garnet hey quick q on examples_test.go -- it's a different package, so it's being ignored by go test (I realized I broke everything but tests are green).

Is the different package on purpose?

still garnet
#

@wet mason it's just so that the examples are using e.g. dagger.Connect instead of just Connect which might look misleading in godocs

wet mason
#

(not sure how go doc examples work ๐Ÿ™‚

still garnet
#

it shouldn't be ignored by go tests ๐Ÿค” i've run them myself

wet mason
#

oh nevermind

#

I wrongly assumed

#

it's just that, somehow, the PR didn't break them

#

impressive

wet mason
#

@civic yacht btw โ€” I had a major rewrite of the commandconn PR ongoing, in my git stash somewhere.

It was broken though and I hit some major problems (IIRC I pinged you about those, like spawning a command for every single query etc)

Nothing major and if youโ€™re reworking those bits I can port it over

#

(Saw you commenting on that one โ€” I was halfway then I dropped it to work on hiding IDs)

civic yacht
wet mason
#

TLDR: 1) when testing, I noticed a lot of weirdness โ€” slow downs, etc. I was trying to figure that out 2) dockerโ€™s commandconn discards stderr altogether. I copied the code to our repo and patched it so we can redirect logs to dagger.WithLogOutout

civic yacht
wet mason
#

๐Ÿ˜‚

wet mason
#

The main thing that did work was the commandconn stuff ๐Ÿ™‚

wet mason
civic yacht
wet mason
#

Yeah. I think itโ€™s best to use Go as a test case and then apply to others.

Waiting on your findings on the engine as container โ€” if for instance itโ€™s possible for the engine to be a long running container; then we donโ€™t need commandconn I guess? (Well, we need it โ€œlessโ€)

#

โ€œlessโ€ as in we could tcp to get started, commandconn later

But if exec ing the binary is the only way, then we need commandconn right away

#

(I did read you mentioning sessions etc โ€” do you think we should go with exec for now and figure out the rest later?)

wet mason
#

@civic yacht @still garnet we're the proud new owners of a fork of graphql-go ...

I re-opened the upstream PR here: https://github.com/dagger/graphql/pull/1

If we still think it's a good idea, I'll change dagger/dagger to use it instead

wet mason
still garnet
#

pretty sure you need to change import path

wet mason
#

dang

#

I did that, but then realized that there's a few dependencies (e.g. graphql-go/handler)

#

we'd have to keep 3 forks ... ๐Ÿ˜

#

graphql, graphql-go-tools, handler

still garnet
#

ouch

#

should we just vendor?

#

not like, go vendor, but just yoink them into subpackages

#

is this a dependency of the engine or the sdk?

#

(assuming split/remote/not-embedded engine)

wet mason
#

engine

#

basically, it changes graphql-go's API to pass arguments as an array rather than a map -- to keep ordering as defined in the schema

still garnet
#

well, if it makes you feel any better we might want to fork the handler anyway

#

i've been looking for a way to pass a value as a header and pass it to the router, and I'm not seeing anything yet. (the value is something like a session ID, but for filesyncing)

#

unless y'all have any other bright ideas for that

#

(actually, how does something like this handle auth...?)

#

i guess you can just put it behind an auth checking reverse proxy

civic yacht
# still garnet i've been looking for a way to pass a value as a header and pass it to the route...

It's a while ago now but I did something like that for the old implementation of multiplatform w/out forking. I think these are the relevent parts of the code:

still garnet
#

a ha, good old context.Context ๐Ÿ™‚

wet mason
wet mason
#

@still garnet I just updated all tests ... it now looks like this c.Directory().WithDirectory("with-dir", dir)

I don't know which one was more intuititve, directory first or path first

anyway ๐Ÿ™‚

still garnet
#

party_blob just saw the PR

#

one argument for source first, path second: it's the same as cp, ln, and I think mount --bind

wet mason
#

I think this was for consistency with WithFile, perhaps?

#

I'm fine either way -- the PR makes it "as the API author intended", just wanted to double check that's what you intended ๐Ÿ™‚

still garnet
#

you'd have to ask @tepid nova for that ๐Ÿ˜›

#

seems like WithCopiedFile (now WithFile) should also have its args flipped tbh, but i won't die on this hill if others disagree

wet mason
#

It's everywhere:

WithMountedFile(path string, source *File)
WithMountedCache(path string, cache *CacheVolume)

I think it makes probably more sense for X to be the first argument in WithX

still garnet
#

yeah, this will mean breaking more APIs than the one we originally intended to fix, but i think it's better ๐Ÿ˜›

#

(turns out WithMountedCache was right all along...)

still garnet
#

@wet mason btw are you using gofmt to update all the code? could save you a ton of time if not

tepid nova
#

whatโ€™s the question? intent behind order of args?

wet mason
still garnet
#

i think something like this should work: find . -name '*.go' | xargs gofmt -l -w -r 'x.WithMountedFile(a, b) -> x.WithMountedFile(b, a)'

wet mason
tepid nova
#

I will share my patent pending design process for arg order but please do not share itโ€™s confidential

wet mason
#

live usage (from unit tests):

c.Directory().WithDirectory("with-dir", dir)
#

felt weird when i was rewriting. But not too weird, just wanted to double check

#

that being said -- it is pretty consistent. Path is always first

#

ยฏ_(ใƒ„)_/ยฏ

still garnet
#

btw: the removal of ID is great. there was a time where I typed e.g. WithDirectory(dir, "dest/path") and it interpreted "dest/path" as a DirectoryID const ๐Ÿ˜ฑ

#

...which is partly what set me off on this "all the arg orders are wrong" line of thought, since it's what I typed first

wet mason
still garnet
#

is it time for a community poll? ๐Ÿ˜„

#

jk, i'm good with shipping the smaller change in 0.4 since these are obviously the odd ones out

wet mason
#

I'm fine either way, I can see an argument for both. To me WithDirectory(dir, path) makes more sense. However then it's WithoutDirectory(path) which is not very consistent

still garnet
#

i think that's OK - umount just takes a path for example

civic yacht
#

We can generate one SDK for every permutation of arg ordering

wet mason
#

with replace statements

still garnet
#

just change it to a map!

wet mason
#

"how to get hate mail in 3 simple steps"

wet mason
#

I'm going to merge as is if someone could review (since this is the smaller delta), then we still have some time tomorrow to change our mind before cutting the release

still garnet
#

reviewed+approved

#

btw - do we need to retain license/copyright?

#

for the handler bit that we vendored

wet mason
#

(compression wouldn't hurt for instance)

wet mason
still garnet
#

authors file generated via git log --format='%aN <%aE>' . | LC_ALL=C.UTF-8 sort -u

#

i'm not a lawyer, but at least i can say i tried

tepid nova
#

@wet mason @still garnet @civic yacht @hybrid widget any thoughts on a Go SDK 0.4 release note? The changes are pretty substantial (exciting new features + breaking changes). It feels like it deserves a substantial note.

  • Who should write it?
  • Where should we post it?
  • What should the content be?
wet mason
#

@tepid nova Copy pasting my message about splitting โ€œsending the queryโ€ from โ€œbuilding the queryโ€ in the SDK DX here to avoid hijacking the other thread:

Itโ€™s tricky though. โ€œSendingโ€ doesnโ€™t necessarily equal to โ€œExecutingโ€. Like if you just โ€œsendโ€ an exec, nothing happens (how LLB does it โ€” Solve() of llb.Run doesnโ€™t do anything)

As confusing as the current API is, at least we managed to hide that complexity: the codegen functions that โ€œsendโ€ (the ones that return an error) are strategically placed on functions that โ€œexecuteโ€: you canโ€™t end up in a situation where you send without executing (except for ID)

If we โ€œjustโ€ split build and send it gets more confusing than today because whether it execs or not will depend on which incantation of fields you requested back

So weโ€™ve got to figure that out

Another, smaller problem: DX for getting values back. Right now the best DX there is is the one you proposed, and I canโ€™t find a better one. Thereโ€™s a few drawbacks which I think make the day to day less joyful: youโ€™ve got to declare your variables in advance, you donโ€™t get any code completion when you do that, the variables contain garbage until you hit send (easy to misuse), etc

Lots to think about โ€” there must be a way to make this much more self explanatory

#

Release Notes

tepid nova
#

I noticed that the Github dependency graph for the dagger repo (visible in the web ui) lists a bunch of Go packages in the top-right drop-down menu, none of which are the correct one...

hybrid widget
# wet mason I'm going to merge as is if someone could review (since this is the smaller delt...

Will the new version of the SDK include the new host API from @still garnet? If yes, could someone please review this in-flight PR at the time of release to ensure it's still accurate, as I would like to release this guide at the same time: https://github.com/dagger/dagger/pull/3627

GitHub

When applied, this commit adds a guide for the new host API.
It also adds a sidebar node named "Guides" to the navigation tree and a guides index page.
Closes #3593
Signed-off-by: Vikram...

wet mason
# hybrid widget Will the new version of the SDK include the new host API from <@1080117150770913...

Yes -- also this one https://github.com/dagger/dagger/pull/3598

It should mostly simplify the guides, less code

I've updated the existing snippets in #3634 already

GitHub

Partial implementation of #3558. Example:
Before:
modules := c.Directory()
for _, f := range []string{"go.mod", "go.sum", "sdk/go/go.mod", "sdk/go/go.sum"} {...

obsidian rover
tepid nova
#

Btw @obsidian rover did you know the Go package registry also exposes a list of downstreams?

#

I just learned that yesterday

obsidian rover
tepid nova
#

What's interesting is that it's a completely different list. It looks smaller? If it's not too hard, yes I think it would be good data to have.

obsidian rover
tepid nova
#

โ€œpipeline builderโ€

wild zephyr
#

I noticed that the Github dependency

still garnet
#

@wet mason just fyi all my PRs are merged now ๐Ÿ‘

twin crow
still garnet
#

so that'd be more along the lines of option 1

#

but that's obviously longer term

#

i'm knee-deep in 3 codebases at the moment trying to figure out how this could work (buildkit, buildx, moby)

wet mason
#

Right -- I figured we're going to be something better for secrets, eventually. Extensions or client-side. But definitely not what we were doing in 0.2.x (addSecret) and definitely needs lots of design work. Was wondering what we could do instead to unblock porting the CUE SDK: bring back addsecret in the public API (bleh), have CUE SDK use a "hidden" API (meh), find other workarounds...

still garnet
#

yeah, option 2 isn't very enticing because even if it's hidden it still puts up appearances that it's safe to use (albeit within only one group of users)

wet mason
#

@still garnet btw did you hit this problem with the bass integration of dagger?

still garnet
#

it's one of my last failing tests ๐Ÿ˜›

wet mason
#

yeah, well, same with CUE SDK ๐Ÿ™‚

civic yacht
wet mason
#

@still garnet and hostdirectory .secret is gone correct?

still garnet
#

that was gone for unrelated reasons, it was just redundant with hostdirectory.file.secret. so now that's host.directory.file.secret

wet mason
wet mason
#

so uhm ... write secrets to /tmp, load them back? how long until the pitchforks ๐Ÿ™‚

#

@civic yacht just to avoid the fork thing

still garnet
#

lol, nailed it

civic yacht
#

I don't know if writing the secret to a file is worse than potentially accidentally leaking them through a fork

#

They both are bad in their own special ways

wet mason
#

๐Ÿฅ” ๐Ÿฅ”

still garnet
#

maybe you can make them all fifos so they "burn after reading"

#

does that even work? ๐Ÿค”

civic yacht
wet mason
#

yeah that'd be great

civic yacht
#

fsutil would have to stream the fifo i think

wet mason
#

to "hide" them a little bit -- do that in a c.Directory(), not on the host

still garnet
#

right yea, it'd be nice if it read it as a regular file but it might try to preserve the fifo aspect

wet mason
#

maybe in a mount or something, would that work?

still garnet
wet mason
#

tmp mount? i guess not? won't be able to read back

#

@still garnet right

still garnet
#

i mean, that's probably fine if the user "just" doesn't leak it (assuming we don't systematically somewhere)

#

since the end goal is to just avoid it showing up in layers/etc

civic yacht
#

I've always wondered if you could create a memfd and then do a localdir sync of it from /proc/self/fd/N, but that's reaching new heights of stupidity

still garnet
#

i'll post a summary of these wild thoughts to the issue

ancient kettle
#

Thanks for all of the ideating around this, @wet mason @civic yacht @still garnet. I'm sorry I missed it while I was out on some errands. I'm tempted to try @civic yacht's of creating environment variables...

Also, @still garnet's suggestions are a potential way I could go about this... not my favorite, to be honest, but manageable, especially for the short term.

It all has me very curious about what secrets in Dagger looks like long term.

still garnet
#

i'm pretty bullish on having a pluggable secret provider for dagger.Connect, long-term

ancient kettle
wet mason
wet mason
#

Very basic, but does the job

rancid turret
#

Yes, very easy to port.

wet mason
tepid nova
#

Well 3555 is more on-topic, right?

wet mason
#

Yep

#

I'll continue there

tepid nova
#

If there's relevant content from 3558, maybe just quote it in 3555 so we have all context, and then yeah continue in 3555

wet mason
#

@civic yacht @still garnet @hybrid widget @tepid nova ok to cut a 0.4.0 release now? anything we are waiting for?

still garnet
#

:shipit:

#

all the host API PRs are in

civic yacht
#

Yeah should be good, doc updates are still in PR but that doesn't need to be in lockstep i don't think

wet mason
#

release train inbound

#

^^ /cc @tidal spire @hasty basin

wet mason
#

is that the "hide IDs" PR hanging in there?

wet mason
#

Just removed the ID() reference in the docs -- it's no longer in the snippet

rancid turret
# wet mason <@768585883120173076> Go SDK examples: https://github.com/dagger/dagger/blob/mai...

I ported all those examples pretty quickly. Most passed but I have a bug in deserializing some objects (Directory). This is the part I already knew I need to test more (deserializing responses). I'm loving the flow, and the type hints are really helpful letting you know something is not quite right while you're writing.

async def test_directory():
    async with dagger.Connection() as client:
        dir = (
            client.directory()
            .with_new_file("hello.txt", "Hello, world!")
            .with_new_file("goodbye.txt", "Goodbye, world!")
        )

        entries = await dir.entries()

        assert entries.value == ["goodbye.txt", "hello.txt"]
tidal spire
wet mason
#

https://github.com/dagger/dagger/pull/3644 <-- documented the wonky release process (it should be automated, but for now it should be at least documented -- I think there's only me and @civic yacht that know how to release)

#

... and I already had forgotten half of it ๐Ÿ™‚

tepid nova
#

No 0.4?

#

Oh sorry engine vs go sdk gah

#

(The abstract tradeoffs of coupled vs decoupled releases, becoming tangible before my eyes ๐Ÿ™‚

wet mason
#

so far it's not being too much overhead

tepid nova
#

Honestly I think that might be actually fun to do with Dagger, for real (famous last words)

wet mason
#

btw -- that monorepo decision saved me a couple of times already. Hiding IDs would have been a cross repo nightmare effort

wet mason
still garnet
#

just do it with bass loop once i finish the dagger runtime ๐Ÿ˜ˆ

tepid nova
#

Yeah I was picturing a more narrowly scoped pipeline that, given a git remote (by default github.com/dagger/dagger), fetches all the right directories from the right tags, then builds and deploys the stable docs.

wet mason
tepid nova
#

That way no weird async event loop

#

It's just the multi-tag build primitive that's a pain without dagger

#

(unless docusaurus itself can be configured to do that, but I doubt it)

wet mason
#

Go needs more tests too -- right now it's cheating because the Core API is tested using the SDK, so we get that test suite for free

#

But there's a few edge cases you did catch (array of objects I think?)

still garnet
#

i think that part had tests too (container publish + multi-platform)

#

container export + multi-platform

#

at first i was worried that having the core tests use the SDK was a bit scary (pretty leveraged/circular!), but now you'll have to pry it from me, feels like an efficient way to test both

tepid nova
cosmic cove
wet mason
# tepid nova Merry christmas https://github.com/dagger/dagger/issues/3555#issuecomment-130132...

I don't want to reply to that issue right away to avoid comment explosion right away. So quick comment here:

pipeline := dagger.Container().
  From("alpine").
  Exec([]string{"ls"}).
  GetExitCode(&lsCode).
  GetStdout(&lsStdout).
  Exec([]string{"echo", "something", "else"})

stdout is a File -- what we want is getting the contents field of stdout

Any idea on how to update that snippet to reflect this?

(stdout is just a convenient example of composition -- there's plenty other similar -- so making stdout a string is not the answer :P)

fair ermine
#

However, it makes the code too verbose IMO

wet mason
#

Then the chained GetStdout won't work because there's no stdout on a dagger.File

ancient kettle
#

So... a thought... (and not one I feel 100% on, but maybe worth getting out there): could we return an object from Exec? That would include ExitCode, Stdout, Stderr and a Container object that could be further chained?

#

The problem I see with that is we'd lose chainable parallelism.

#

And we'd always have to pay the penalty of returning ExitCode, Stdout, Stderr

#

๐Ÿ˜•

#

It definitely seems like weโ€™re not having an easy time getting the best of all worldsโ€ฆ parallelism when we want it, and easy access to various resolved scalars when we want it.

fair ermine
tepid nova
#

Last task of the day: write an updated proposal for CLI packaging, which is a must-have dependency for Python SDK, NodeJS SDK, and GraphQL API launch.

Mostly the proposal is a recap of options we already discussed, but cleaned up and updated, with clear next steps.

cc @wet mason as you mentioned it this morning. Sorry it took me so long to get to it.

rancid turret
tidal spire
fair ermine
grave stump
#

Is it possible to include the .git directory in the repo tree from the dagger client git clone?

simple lily
#

Hello i'm trying to figure out what Cloak is. on this page here links to the cloak branch in the dagger repo but it's 404ing for me ๐Ÿ™ƒ is there a different branch I could check out?

obsidian rover
#

Hi, cloak was the name of the internal experimentation around all the multilanguage SDKs. It was mostly the Go SDK, which we renamed to Dagger Go SDK afterwards

simple lily
#

ah okay! that makes sense. much appreciated ๐Ÿ™‚

tepid nova
simple lily
tepid nova
#

@cosmic cove could we redirect that url to the go sdk blog post?

wild zephyr
wet mason
tidal spire
#

I can update the concurrency stuff in the guide. Basically delete the last step, small tweaks to the other steps, and make a note about how it's all happening in parallel

wet mason
#

That's awesome ๐Ÿ™‚ That, plus the removing ID(), plus @still garnet's changes to remove Mkdir, plus @civic yacht's work on removing go mod edit -replace -- the docs will be tiny ๐Ÿ™‚

tidal spire
#

I think it'll make them feel like a more approachable "getting started"

tepid nova
#

OMG I forgot about that. Go SDK will use the helper too, and no more replace?

#

That's huge

wet mason
wet mason
civic yacht
wet mason
#

Yes keep it for last ๐Ÿ˜„ git commit -m "๐Ÿพ"

tepid nova
wet mason
tepid nova
#

Yes exactly

#

Then link to the "Dagger programming model" guide for more explanation

#

@wet mason imagine if we have that "multi-language guides" you were talking about in the call. And every example also includes the DAG ๐Ÿ™‚

#

cc @wild zephyr I know you're into that stuff too

tepid nova
#

What's the process for contributing an API change? Do I re-run codegen on all SDKs? How?

wild zephyr
wet mason
rancid turret
#

@tidal spire trying to wrap my head around the parallelism stuff. Can someone give me some lights? I'm up for a quick video call.

tepid nova
#

Anything I should review or unblock?

civic yacht
still garnet
#

omg omg omg finally (pictured: filesyncing with remote client => dagger engine running in a container)

#

sorry for lack of responsiveness today, i've been really in the weeds. finally some light at the end of the tunnel

tepid nova
#

wow! pass through of buildkit grpc over ws??

still garnet
#

close, no websockets, just a Upgrade: h2c. i'm also 100% cheating by using the buildkit session implementation code in the SDK, but, baby steps.

#

i've had to vendor grpc and buildkit just to figure out what's barfing where at various steps ๐Ÿ˜ตโ€๐Ÿ’ซ

tepid nova
#

impressive

wet mason
#

I opened this channel to share bad news / ask for feedback, glad to have seen this before ๐Ÿ™‚

tepid nova
#

and promising!

wet mason
#

So ... obviously (in retrospect) we can't run dagger tests with dagger, because ... it needs dagger and tests are already running in a container

Idea: what if we do what we did for extensions, but generalize it to every exec? Basically, inject a DAGGER_HOST that talks back to itself -- dagger.Connect() would always work, even inside a dagger container, transparently

thoughts?

#

(and it's turtles all the way down)

#

I'm expecting @civic yacht and @still garnet to either be excited or disgusted by the idea, not sure which way it's leaning yet ๐Ÿ˜„

civic yacht
#

So Dagger-in-Dagger? I imagined previously we'd use services for this (run dagger remote engine in exec and share a socket to it with the "client" container). I believe I did the equivalent of that at one point in Europa, but it involved starting buildkitd in a container and then sharing its socket over a cache mount, but that was just a fun experiment and not something anyone should actually do.

wet mason
#

virtual-dagger-in-dagger -- it's the same dagger instance

#

same trick (and code) we used for extensions: mount a unix socket to talk back to the API, set a DAGGER_HOST

#

basically not making extensions a special case anymore: any container could do that

tepid nova
wet mason
#

@tepid nova only for extensions

still garnet
tepid nova
#

Makes sense to me, my only question is how to sandbox it safely

wet mason
#

@civic yacht @still garnet to be clear -- not suggesting it should be able to launch a brand new instance of dagger/buildkit/etc from a container. I'm suggesting we allow containers to talk back to the same API instance that created them

still garnet
#

yeah, i'm good with reusing the host engine if we find a non hacky way to do it

tepid nova
#

(as reliable sandboxing + nesting is what makes our extension loading model so special)

#

It would be a major improvement on the state of the art of container nesting. Ie safe container nesting. (logical nesting of course)

wet mason
tepid nova
#

Well I believe you guys already sandbox extensions right? Or am I extrapolating again and you plan on doing it but not implemented yet?

civic yacht
wet mason
#

Although extensions are somewhat privileged -- the user loaded them. Here it means any random container can just use the dagger API

civic yacht
tepid nova
tepid nova
wet mason
civic yacht
wet mason
#

well, with what @still garnet's doing, maybe Host() would mean the container's host ๐Ÿ™‚

tepid nova
#

Starting a thread ๐Ÿ™‚

wet mason
#

so sure, go crazy with your own filesystem

still garnet
tepid nova
civic yacht
tepid nova
#

ok in that case I will fix the formatting

#

I was making cosmetic edits initially, then wrote my question in the wrong tab

#

@civic yacht temperature check before suggesting in the issue: would it make sense to separate dagger-engine-helper and dagger-engine-router sooner rather than later, and have the former exec the latter? Would be an incremental step towards the router migration; avoid a future drastic change in the meaning of โ€œhelperโ€, and since we already pull that engine image anyway, overhead of extracting one more binary (which will need to exist soon anyway) would be small.

We could do it right away for python sdk release, or 1-2 weeks later (rough scoping). One more baby step out of the way

#

this in turn makes me wonder if dagger-sdk-helper would perhaps be a more descriptive name, since from day one it would clearly not include engine functionality, but purely client-side functionality

civic yacht
# tepid nova ok in that case I will fix the formatting

Okay thanks! I was getting back to your comment on the issue in the meantime. But to answer the above, I think adding another exec would increase the complexity quite a bit. The helper itself would then have very little purpose left besides just proxying to the router.

I liked the name helper because it currently "helps" you by providing routing of your API calls (๐Ÿ™‚ ) and in the future it may not longer do that but instead just help with some pieces of functionality we haven't implemented yet. dagger-sdk-helper makes more sense than engine-helper though, totally agree, I'll change that

tepid nova
#

do you mind if we chat live about it tomorrow? Iโ€™m hesitating between a bunch of naming & packaging options now..

#

Seems silly to be stuck on such a small thing but naming is weird that way. Itโ€™s small and insignificant until itโ€™s suddenly huge and important

civic yacht
still garnet
wet mason
wet mason
tepid nova
#

Now that "project cloak" is merged, how does everyone feel about renaming this channel to #engine-dev ? Leaves the door open to perhaps creating more #xxx-dev channels in the future

#

Another thing we could do is create a new category "dev" or, perhaps more descriptively, "maintainers", for channels related to the development of dagger, rather than using it or developing on it. I like the collapsible nature of categories, to keep my sidebar light and clean ๐Ÿ™‚

obsidian rover
tepid nova
#

I was wondering about that maintainers channel. Not worrying about it for now, as everyone is busy. But yes doing that would be an option, to be discussed with @stray heron

#

I think the maintenance and feature development work is inextricably mixed. Personally I don't think it works to separate it

#

In other words discussions related to contributing a PR and reviewing it, should take place in the same place since they all involve the same people

#

to be clear @obsidian rover I'm talking about a maintainers "category" rather than a channel. The current #999807040039952515 could of course be moved to that category

obsidian rover
tepid nova
#

So if someone, say, wants to make their first contribution to the engine, they would "visit" the engine maintainers at #1036545971942858812-maintainers to ask for guidance.

Engine maintainers would continue using it to discuss ideas, problems, PR review, release planning, etc

rancid turret
#

@tepid nova I'm always in favor of having more granularity in Discord, sounds good ๐Ÿ‘

rancid turret
#

@civic yacht @tepid nova I believe there's multiple issues relating to the binary dependency for provisioning the engine in the SDKs. Is there one ๐Ÿ’ to rule them all? What can I use to track this dependency in the Python milestone?

tidal spire
#

sneak peek of one of next week's demos

rancid turret
#

@cosmic cove should we continue to use the cloak label in GH for issues?

still garnet
civic yacht
#

Erik Sipsma3294 solomon4104 I believe

tepid nova
#

I find the new label area/graphql confusing. We already have area/engine, area/core, kind/api design which all overlap. If anything we should be removing labels, not adding them.

IMO we can merge the 4 labels above into area/engine (I would personally prefer just engine because I find the current label naming schema to verbose, but saving that for another time ๐Ÿ™‚

cosmic cove
cosmic cove
ancient kettle
# civic yacht commented with one possible alternative (pretty sure it's a really bad idea but ...

So, I tried this... and I'm getting failed: secret "eyJob3N0X2VudiI6ImZjZGUyYjJlZGJhNTZiZjQwODYwMWZiNzIxZmU5YjVjMzM4ZDEwZWU0MjllYTA0ZmFlNTUxMWI2OGZiZjhmYjkifQ==" not found

I decoded that base64, and it's this:

{
  "host_env": "fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9"
}

Which is the correct environment variable... and if I do an os.Getenv("fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9"), it returns the correct value.

Any thoughts, @civic yacht @still garnet @wet mason?

wet mason
#

is there a snippet of code we could look into?

ancient kettle
#

actions.test.usage.secret is failing with the error message I posted.

wet mason
#
func main() {
    ctx := context.Background()
    d, err := dagger.Connect(ctx)
    if err != nil {
        panic(err)
    }
    os.Setenv("FOO", "bar")
    secret := d.Host().EnvVariable("FOO").Secret()
    plaintext, err := secret.Plaintext(ctx)
    if err != nil {
        panic(err)
    }
    fmt.Println(plaintext)
}
#

this seems to be working

ancient kettle
#

Can you try that with loading from the ID?

wet mason
#

@still garnet Depending on golangci version, sometimes I get this complaint:

core/directory.go:37:33: unexported-return: exported method Decode returns unexported type *core.directoryIDPayload, which can be annoying to use (revive)
func (id DirectoryID) Decode() (*directoryIDPayload, error) {

Ok if we make that public?

still garnet
#

I think the reason for Decode being public is just that project/ needed it, it was kind of a short-term hack. would prefer to keep Decode and directoryIDPayload private, but no big deal, no one should be using core/ but us anyway

wet mason
#

@still garnet oh makes a ton of sense -- agree it should be kept private, I'll stick a //nolint for now

#

@still garnet ah! my bad, you explained exactly this in a comment a few inches down my nose

still garnet
#

๐Ÿ˜† oh, didn't remember that. np!

#

we did have some plans to redo project/ using purely the core/ interfaces, instead of direct LLB all over, but I've had a couple false starts with it

wet mason
#

Yeah project is going to move around -- many things it does don't make that much sense now (server side codegen etc)

#

Also with dagger-in-dagger being part of core, that's one less thing project should be doing

wet mason
#

@still garnet Also -- I've been using exclude/include, it's helping a lot

still garnet
#

nice nice

wet mason
#

๐Ÿ™

still garnet
wild zephyr
#

IDK how but I want to find a use-case for tsnet in Dagger ๐Ÿ˜‰ https://tailscale.com/blog/tsnet-virtual-private-services/

rancid turret
#

@wet mason Is there a way to exec a failing command without failing the pipeline? E.g., check stderr, retur_code. Asking for a friend ๐Ÿ˜‰

wet mason
#

no ๐Ÿ˜

except sh -c "cmd || echo MAGIC FAIL"

rancid turret
#

Ok ๐Ÿ™‚

wet mason
#

if strings.Contains(stderr, "MAGIC FAIL")

#

๐Ÿ˜ฌ

civic yacht
#

there's some issues open for all of that (just to preemptively dedupe)

wet mason
#

yep

rancid turret
#

You mean we'll support it?

civic yacht
#

it should be possible

rancid turret
#

Thanks ๐Ÿ‘

#

So it's not just me ๐Ÿ™‚

civic yacht
#

haha no, the exit code field is a little silly until we fix that

wet mason
#

@rancid turret I managed to "fix" test/generate ... now it's just failing because it can't talk to dagger (which is normal)

wet mason
#

@rancid turret #20 1.605 ============================== 54 passed in 1.07s ==============================

#

!!

tepid nova
obsidian rover
tidal spire
hasty basin
rancid turret
obsidian rover
obsidian rover
still garnet
#

here's the latest on remote engine/client sessions: https://github.com/dagger/dagger/pull/3671#issuecomment-1305943293 - this is shaping up to be a pretty hefty PR, might make sense to jump in a call and sync up on it at some point. i'll be in-and-out today though, gotta clean all the ๐Ÿ‚ from the patio. (cc @civic yacht @wet mason )

civic yacht
tepid nova
tepid nova
#

amazing

civic yacht
tepid nova
#

From a launch point of view it's not needed. So it all depends if it helps you organize and prioritize your work ๐Ÿ™‚

#

My thinking, for now was to have a milestone called either "Engine 0.4" or "Engine 0.3.x" to track roughly what is planned next. But not a lot of opinions on the details there, I defer to @wet mason and @cosmic cove on the tooling bikeshedding

#

It's basically a backlog thing

civic yacht
#

0.3.x makes sense to me. Anything that is longer term (someday) can just be labelled w/ engine but not put in a milestone. And when we decide to do a 0.4 then we can create that milestone, etc.

still garnet
#

+1, I'm not dependent on any milestone atm so feel free to reorganize in whatever way makes sense

tepid nova
#

Ok cool

#

Note, there is a separate milestone called "Engine GraphQL release" which tracks specifically what is needed to publicly release the GraphQL API. On the launch side we are using that milestone as a dependency

tawny flicker
hasty basin
tawny flicker
ancient kettle
#

@civic yacht @still garnet Is it possible to Container.Export a tar file into a new Directory? I'm guessing it probably isn't... and I'll likely need to do what we're currently doing in core.#Export (which is export the tar to the host, then reload it using client.Host().Directory(...).

still garnet
#

yeah, it's not possible to do that without first writing it to the host

ancient kettle
tepid nova
#

There is a draft API call for that I believe ๐Ÿ™‚ But we decided to delay implementation for practical reasons

ancient kettle
wet mason
ancient kettle
#

I have an interesting panic:

package main

import (
    "context"
    "fmt"
    "dagger.io/dagger"
)

func main() {
    ctx := context.Background()
    d, err := dagger.Connect(ctx)
    dockerfilepath := "mydockerfile"
    buildcontext := d.Directory().WithNewFile(dockerfilepath, dagger.DirectoryWithNewFileOpts{Contents: "FROM scratch"})
    build := d.Container().Build(buildcontext, dagger.ContainerBuildOpts{Dockerfile: dockerfilepath})
    buildid, err := build.ID(ctx)
    if err != nil {
        panic(err)
    }
    fmt.Println(buildid)
}
$ go run ./cmd/dagger/main.go
panic: input:1: container.build runtime error: invalid memory address or nil pointer dereference

Please visit https://dagger.io/help#go for troubleshooting guidance.

goroutine 1 [running]:
main.main()
    /Users/joel/src/dagger/dagger-cue/cmd/dagger/main.go:41 +0x140
#

Seems like Container.Build isn't dealing with scratch nicely. Maybe the protobuf -> json encode really doesn't like the nil?

tepid nova
ancient kettle
tawny flicker
#

The CI on my PR doesn't trigger except for docs and website

#

I'll rebase, just to check

#

The rebase fixed it

still garnet
#

there might be more info in the dagger-buildkitd container logs

civic yacht
# ancient kettle I have an interesting panic: ``` package main import ( "context" "fmt...

Like @still garnet said there's a chance this is buildkitd. I've fixed 2 bugs upstream that were related to scratch+nil in the last month-ish, apparently some of the other maintainers have pushed even more similar fixes recently (not sure why this is such a thing all of a sudden). But this could easily be our code too, if you can do a recover() in this code you could see where the panic is happening: https://github.com/sipsma/dagger/blob/7544c0e3292d9fcd2de618804e47e2ef4545d186/core/container.go#L261-L261

tepid nova
#

Might be a sign that the buildkit ecosystem is picking up finally!

  • dagger gaining steam
  • earthly definitely getting some extra attention since dagger launched (based on star history)
  • depot.dev: first buildkit hosting service
  • docker itself making a comeback

Maybe itโ€™s adding up ๐Ÿ™‚

civic yacht
tepid nova
#

Oh my, I'm having second thoughts on the CLI/helper thing... I hate when that happens ๐Ÿ˜ฆ

cosmic cove
#

@tepid nova @hasty basin @tidal spire After the livestream today, can you takes a look at this issue for where examples should live? I'd like to make sure that all the directories are clear before the Python launch - https://github.com/dagger/dagger/issues/3446

GitHub

When new users arrive they often look for tutorials, readmes, samples, and examples. We have an examples directory that came from the merge of the cloak codebase into main. It contains examples of ...

bronze hollow
#

Does the Go SDK support CreateSecret yet?

still garnet
tidal spire
still garnet
ancient kettle
tawny flicker
ancient kettle
#

@still garnet @civic yacht I'm getting behavior I'm not expecting trying to add and test functionality to func (dir *Directory) Without(ctx context.Context, path string) (*Directory, error). It appears that my changes aren't running. Do I need to do anything to compile that code and get it running in the engine?

#

I'm running the test using go test -v -count=1 -run TestDirectoryWithoutDirectory $(pwd)/core/integration/

still garnet
#

@ancient kettle hmm try mage engine:dev

civic yacht
ancient kettle
#

So, I think so.

rancid turret
#

Any idea for this error?

#1 resolve image config for docker.io/library/python:3.10-alpine
Error: input:1: container.from error getting credentials - err: signal: killed, out: ``

Please visit https://dagger.io/help#go for troubleshooting guidance.
#1 ERROR: error getting credentials - err: signal: killed, out: ``                                                                                                                                       
------
 > resolve image config for docker.io/library/python:3.10-alpine:
------
ancient kettle
#

Maybe I'll go back one commit?

civic yacht
ancient kettle
rancid turret
still garnet
#

sounds like your docker credential helper is getting killed for some reason? maybe there's something weird in ~/.docker/config.json

rancid turret
#

I've been running tasks all day, it's not that.

#

Full cache reset, still same issue.

#

Should I reboot machine? ๐Ÿคฃ

still garnet
#

maybe. OOM killer? ๐Ÿ˜›

rancid turret
#

Have I reached a rate limit or something?

mellow bolt
#

did you reboot docker ? ๐Ÿคท

rancid turret
#

Am I going to be punished for still using docker desktop? ๐Ÿ˜›

tidal spire
rancid turret
mellow bolt
#

f****

still garnet
#

progress ๐Ÿ‘

tidal spire
#

successfully failed

rancid turret
#

Successful login in docker desktop but still failing in mage. Gonna try docker login.

ancient kettle
rancid turret
#

Man, every time I try to login I get sent to the hub.docker.com page with a "You've been signed out"

#

I even created a new token.

#

Hmmm: ""access is forbidden with a JWT issued from a personal access token"

#

Ok, success logging in via CLI, still same error. How does credentials get passed on to buildkit?

still garnet
rancid turret
#

Hmmm... login succeeds with index.docker.io but not docker.io.

rancid turret
#

I can pull that image locally, but not from go sdk. Any idea?

civic yacht
#

If this is happening in a mage step then there's also the dagger-in-dagger complication

rancid turret
#

Am I doing docker hub login wrong?

civic yacht
rancid turret
#

Same thing with go:

#1 resolve image config for docker.io/library/golang:1.19-alpine
Error: input:1: container.from error getting credentials - err: signal: killed, out: ``

Please visit https://dagger.io/help#go for troubleshooting guidance.
#1 ERROR: error getting credentials - err: signal: killed, out: ``                                                                                                                                       
------
 > resolve image config for docker.io/library/golang:1.19-alpine:
------
civic yacht
#

doesn't happen on linux...

#

(another reason we need to setup mac os runners in our ci)

#

I'll keep digging

ancient kettle
#

@tepid nova @still garnet @civic yacht @wet mason I have a behavioral change (and potential API change discussed) to Directory.withoutDirectory() in this PR: https://github.com/dagger/dagger/pull/3735

I'd appreciate some eyes on it, and any thoughts as well, especially about the API to this change.

GitHub

Allow a user to specify wildcards in their paths for (dir *Directory) Without().
I need at least this for dagger-cue. Even better would be the ability to turn it on/off, but that would require an A...

ancient kettle
#

@civic yacht Should I expect envvar -> secret code to break in the latest main?

civic yacht
ancient kettle
civic yacht
civic yacht
#

@rancid turret @ancient kettle truly mystified by that credential error, here's what I found so far: https://github.com/dagger/dagger/issues/3737

I gotta look at other engine related stuff too asap so temporarily putting it to the side, but if anyone else has time to look into it please feel free

tepid nova
#

@wet mason @wild zephyr idea for the problem you mentioned of multiple releases being messy in github. Maybe we could (in github) only expose โ€œgroup releasesโ€ of the latest engine+all sdks? With one tarball for each artifact in the release. The bundled release would be versioned after the engine.

So for example we could cut right away a โ€œ0.3.0โ€ release which would include:

  • engine 0.3.0
  • go-sdk 0.4.0

Itโ€™s not perfect because not every sdk release would be in a github release, but thatโ€™s ok since github releases are not the source of truth anyway: just a convenience for people visiting the repo as a distribution channel

still garnet
civic yacht
still garnet
#

great, sounds good. I have the latter part done, just need to remove this bit then ๐Ÿ‘

#

there was one wrinkle: rather than relying on 'latest stable SDK' I went with a git submodule (๐Ÿ˜ตโ€๐Ÿ’ซ) so we can depend on main instead. since we're already depending on unreleased features (e.g. dagger-in-dagger)

#

so now we have a lovely blend of Go and Git submodules ๐Ÿ˜… but it works

civic yacht
#

Oh interesting, I would have thought that even if we use a go.mod we could bump it to be something besides a tagged release (like a specific commit) when needed but i'm probably forgetting how that works

still garnet
#

I can give that a try too ๐Ÿ‘ honestly just avoided that since a lot of things have to go right for it to work

civic yacht
still garnet
#

yea, I figure we can always just remove it if/when stable becomes actually stable enough, and it's pretty easy to reason about bumping to commits and/or tagged releases (just git checkout the submodule and commit it)

still garnet
#

@civic yacht a simple go get dagger.io/dagger@main works fine. ๐Ÿ‘ the only gotcha is that updating these files is trickier than bumping a submodule, since you need to move them alongside the code to run go get ...; go mod tidy and then move them back into their separate folder after. but that can be scripted. (they're tracked in a separate folder and copied out just-in-time for the mage re-exec'ing)

#

i'll go with this + a script since I never want to wonder what people mean when they say "submodule" ๐Ÿ˜›

#

also it's really annoying having the git submodule results show up when grepping

strong coral
#

I've looked at the published SDKs and python is gibberish enough to me that I don't understand what it's actually doing. Is there a psudo-code explanation of how codegen gets data and turns it into code?

tepid nova
#

Welcome to the frontier ๐Ÿ™‚

strong coral
#

To soon?

#

Hmm, yes. Mage build doesn't work on Windows

tepid nova
#

No it's a great question to ask, would love to help you get going prototyping a new SDK. Just want to set expectations that it's still rough at the moment. But definitely doable and something we're interested in supporting.

strong coral
#

Actually, the playground is probably a good place to start

#

I just need something that generates GQL queries, right?

tepid nova
#

@strong coral to clarity your goal is to contribute a new SDK for .net?

strong coral
tepid nova
#

It depends whether you want to:

A) contribute a SDK with the goal of having feature parity with other official SDKs (Go etc)
B) develop a custom client library/tool that makes it easier for you to make certain graphql queries, but is domain-specific and not meant to be used by all developers targeting developers in that language

strong coral
#

B>A for me at the moment

#

but all of the SDK implementations seem light enough and I assume would be more flexible as you evolved the engine

tepid nova
#

Ok, that's an easier first step, and yes starting with the playground + a basic functional graphql client in your language, is the way to go

strong coral
tepid nova
#

That way you can ignore the codegen part (additional work for option A), and focus on getting a working session. There's two parts to that:

  1. Dagger-specific bootstrap to establish a connection to the graphql server
  2. Regular graphql client to make the queries
#

Part 1 is where you will need some handholding, as the bootstrap code is 1) not well documented and 2) changing fast

#

I would look at Python as the reference (not Go which is a special case)

wet mason
civic yacht
# wet mason Saw the PR ... I don't have a better solution in mind yet, but I'm concerned abo...

I think embedded would not cover us for all that much longer though since it basically just means that the helper binary (now called dagger-engine-session) part of provisioning can be skipped, but it wouldn't cover all the other stuff in the actual engine image. Currently there's not much in there (just buildkitd and it's associated binaries like qemu+runc). But once we start doing more and more with that it's going to become necessary to rebuild that full image and all the stuff inside and embedded won't work anymore.

#

Haven't looked at PR yet but hopefully the complexity can be isolated to just this bootstrap aspect and completely modularized from the rest of the automation, which can be nice and simple still

#

That's what I think the wrapper idea enables

ancient kettle
#

bkref.ToState() is panicking.

#

I'll keep digging, but wanted to give you a bit of context.

wet mason
wet mason
#

@civic yacht Looks like it's in the "handoff" between versioned and bootstrapped engine, since the line that fails is always pulling golang (first thing we do in the inner loop)

civic yacht
#

bkref ToState is panicking

#

Yeah first we should decide if we want

obsidian rover
civic yacht
# obsidian rover <@949034677610643507>, I can resume my work on https://github.com/dagger/dagger/...

Well I can't say whether it's higher priority than the other stuff you're working on, but it's definitely pretty important IMO, even more so than previously. There's a lot of subtle details that can unexpectedly be different between linux+macos (and windows, which we should also add testing for), and we want to make sure we get those details right in each of our SDKs. Until we have automated testing we have to rely on people manually testing, and only those who actually have macos available to them.

obsidian rover
tepid nova
#

@obsidian rover LANG=en-US nitpick: you probably meant "on my radar". "Under the radar" means "invisible, unnoticed" ๐Ÿ™‚

obsidian rover
civic yacht
still garnet
#

@civic yacht @wet mason @tepid nova just to sync on remote-engine/client-sessions/etc. work (https://github.com/dagger/dagger/pull/3671) in light of my vacation next week - I'm guessing we'll have enough to focus on already with the Python SDK launch + whatever things come up afterwards, so I've been just tending to the PR to keep it from falling too far behind. I'm good with either a) pausing it while I'm out, b) letting y'all scrap it for parts if/when the need comes up, and/or c) chatting about it tomorrow or Friday if someone wants to carry the torch. I haven't been too loud about it since we've got enough distractions ๐Ÿ™‚

wet mason
civic yacht
still garnet
#

no worries at all, this was a side quest ๐Ÿ˜† i'll send an invite

strong coral
tepid nova
strong coral
tepid nova
strong coral
#

nice

#

Is the graphql schema static per build or is it dynamic based on host configuration?

tepid nova
#

Static per build

#

Not 100% sure if that remains the case once we ship extensions, cc @wet mason @civic yacht

obsidian rover
#

@civic yacht, the native macos runner is working/successfully running our integration tests against a Docker Desktop: https://github.com/grouville/dagger/actions/runs/3437568316.
Due to the power of the VM provided (native Github macos-latest runner), it is quite long (1h) per run, on what trigger would you like it to be set ?

wet mason
#

@stray heron ended up not doing self hosted runners for now (need more work to make it happen)

I reworked the PR though to keep some of the changes needed for self hosted and limited the usage of big runners just for engine:test: https://github.com/dagger/dagger/pull/3722

civic yacht
ancient kettle
#

@civic yacht I've updated my local dagger-engine to latest main, but I'm still getting the credential errors. Is there anything I need to do?

civic yacht
ancient kettle
#

Ah. I'll do that and let you know.

#

I rebuilt dagger-cue and it works! Thanks, @civic yacht

ancient kettle
# ancient kettle I rebuilt `dagger-cue` and it works! Thanks, <@949034677610643507>
$ yarn test
yarn run v1.22.19
$ bats --jobs 4 --print-output-on-failure --verbose-run .
./plan.bats
 โœ“ plan/do: action flags help output
 โœ“ plan/do: action sanity checks
 โœ“ plan/do: don't run unspecified tasks
 โœ“ plan/do: nice error message for 0.1.0 projects
 โœ“ plan/do: missing packages suggests project update
 โœ“ plan/do: check flags
 โœ“ plan/hello
 โœ“ plan/client/filesystem/read: fs/usage
 โœ“ plan/client/filesystem/read: fs/not_exists
 โœ“ plan/client/filesystem/read: fs/invalid_fs_input
 โœ“ plan/client/filesystem/read: fs/invalid_fs_type
 โœ“ plan/client/filesystem/read: fs/relative
 โœ“ plan/client/filesystem/read: fs/multiple
 โœ“ plan/client/filesystem/read: fs/dynamic
 โœ“ plan/client/filesystem/read: file
 โœ“ plan/client/filesystem/write: fs
 โœ“ plan/client/filesystem/write: files
 โœ“ plan/client/filesystem/write: multiple
 โœ“ plan/client/filesystem: update
 โœ“ plan/client/env usage
 โœ“ plan/client/env optional set
 โœ“ plan/client/env concrete
 โœ“ plan/client/commands
 โœ“ plan/with
 โœ“ plan/outputs
 โœ“ plan/platform
 โœ“ plan/do: invalid BUILDKIT_HOST results in error
 โœ“ plan/do: cache
 โœ“ plan/validate/concrete
 โœ“ plan/validate/undefined
./project.bats
 โœ“ project init and update and info
 โœ“ project init with template
 โœ“ todoapp project with absolute path
./tasks.bats
 โœ“ task: #Pull
 โœ“ task: #Pull auth
 โœ“ task: #ReadFile
 โœ“ task: #WriteFile
 โœ“ task: #WriteFile failure
 โœ“ task: #Exec args
 โœ“ task: #Exec env
 โœ“ task: #Exec env secret
 โœ“ task: #Exec mount cache
 โœ“ task: #Exec mount fs
 โœ“ task: #Exec mount secret
 โœ“ task: #Exec mount tmp
 โœ“ task: #Exec mount file
 โœ“ task: #Exec workdir
 โœ“ task: #Copy exec
 โœ“ task: #Copy file
 โœ“ task: #Copy exec invalid
 โœ“ task: #Mkdir
 โœ“ task: #Mkdir parents
 โœ“ task: #Dockerfile
 โœ“ task: #Dockerfile inlined
 โœ“ task: #Dockerfile inlined heredoc
 โœ“ task: #Dockerfile path
 โœ“ task: #Scratch
 โœ“ task: #Scratch writefile
 โœ“ task: #Subdir
 โœ“ task: #Subdir invalid path
 โœ“ task: #Subdir invalid exec
 โœ“ task: #GitPull
 โœ“ task: #GitPull invalid
 โœ“ task: #GitPull bad remote
 โœ“ task: #GitPull bad ref
 โœ“ task: #HTTPFetch
 โœ“ task: #HTTPFetch not exist
 โœ“ task: #DecodeSecret
 โœ“ task: #NewSecret
 โœ“ task: #TrimSecret
 โœ“ task: #Source
 โœ“ task: #Source include exclude
 โœ“ task: #Source relative
 โœ“ task: #Source invalid path
 โœ“ task: #Source not exist
 โœ“ task: #Diff
 โœ“ task: #Export
 โœ“ task: #Rm

78 tests, 0 failures

โœจ  Done in 56.47s.
ancient kettle
civic yacht
ancient kettle
still garnet
#

@ancient kettle approved!

ancient kettle
still garnet
#

looks like a good old fashioned timeout

#

hard to tell which test though

civic yacht
civic yacht
#

That's my guess because the last thing in the buildkitd logs is: "> creating tuiqcoecgb7wx1y5fzt384rc4 [/dev/.buildkit_qemu_emulator /bin/sh -c CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .]" span="[build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' ."
And the stack trace of goroutines when the test times out shows it stuck on the registry goroutine

still garnet
#

I see TestContainerMultiPlatformExport in the stack

#

but it is an Export call yeah (there's also a goroutine calling ExitCode but I think that's the one we always background for the lifetime of the registry?)

#

oh dang I guess we don't get the engine stack in these dumps anymore ๐Ÿ˜ข

#

also seems likely this could be only loosely related to the actual test that fails, could be anything that starts a registry

civic yacht
#

Could be coincidence, but suspicious

still garnet
#

and that one's without -race, interesting

#

wonder if we should have an hourly trigger just to suss out flakiness like this (more data to confirm if it's just one test)

ancient kettle
#

Stepping out to do a couple of errands. Let me know if I can help in any way.

civic yacht
# still garnet and that one's without `-race`, interesting

The other interesting thing is that it seems like it might be both were blocked on building the shim. Last progress output from one 3 days ago is:

#33 [build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .

It never completes.
In the newer one that also is one of the last progress outputs and never completes. And in the buildkitd logs you can see the last thing is:

creating tuiqcoecgb7wx1y5fzt384rc4 [/dev/.buildkit_qemu_emulator /bin/sh -c CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' .]" span="[build 6/6] RUN CGO_ENABLED=0 go build -o /_shim -ldflags '-s -d -w' ."

Hmm....

civic yacht
tawny flicker
still garnet
#

hopping in dev-audio for client sessions sync @wet mason @civic yacht @tepid nova

wild zephyr
#

๐Ÿ‘‹ just came across a very recent git bug (https://lore.kernel.org/git/Y2NEeWwnfHnIbNl8@coredump.intra.peff.net/T/) that basically makes goreleaser fails when fetching the contents of the tag description. This only happens when tags are signed, which is something that we don't usually do since we create the tags from github itself. Spent a good amount of time tracking this one. Also, funny quote from the issue (img).

If you get an "Out of memory" error when running goreleaser locally it's because of that

tepid nova
#

Yup, you got it ๐Ÿ™‚

#

Ha ha, meet @strong coral who is thinking along similar lines, but for powershell ๐Ÿ™‚

#

The short answer is: it's possible to contribute a SDK, but it's a non-trivial engineering effort and you would have to work closely with the core developers (who are happy to help you, right here on discord, it's more about your own ability to commit the necessary time and effort)

#

There's a good intermediary step which is to write a custom client targeting the Engine API directly

#

Then you can generalize the client so that it eventually becomes a full blown SDK.

#

That second part is actually the hardest because it involves code generation

#

(All our SDKs are fully generated from the API)

#

To be more specific:

  • The Dagger Engine has a GraphQL API
  • You can target this GraphQL API yourself with a regular graphql client in any language + some dagger-specific bootstrap code
  • Each SDK includes a generated client for the GraphQL API
#

๐Ÿคซ

#

one and the same

#

engine API = graphql API

#

if you try that playground, you can actually run your pipeline straight from the browser, we run an engine for you. It's pretty fun

#

@gleaming portal my pleasure, happy to help any time. We can also get on a call with some of the devs and help you get started

strong coral
#

I got a good bit working today. Hit a couple of road blocks I bet you could help with.

wet mason
#

@civic yacht if I wanted to publish a dummy engine to test things out ... can I use call engine:publish randomtag? is that safe?

civic yacht
#

Which is fine, but annoying relative to having a separate target

wet mason
#

๐Ÿ‘

#

Oh btw, I reverted the self hosted runner changes, need more time to do a proper set up. I converted the PR to add the bits required for self hosted in the future (don't mess with /usr/local/bin) and also reduced the usage of large instances (we don't need them in most cases): https://github.com/dagger/dagger/pull/3722

civic yacht
wet mason
#

It's a bit hacky, does the job though

civic yacht
civic yacht
#

@still garnet @wet mason @tepid nova I couldn't get the idea I tried but failed to articulate earlier out of my head, got it working here though which helped clarify it a bit more: https://github.com/dagger/dagger/pull/3787

That PR successfully runs test / engine via dagger-in-dagger, including the local dirs tests. I had to comment out extension tests for now but they should be easy to fix too, I just didn't bother to update that part of the codebase yet. The other SDK tests fail for the same reason, they are easy to fix I think.

I list the pros/cons in there, let me know what you think. The pros seems really huge, a lot of problems seem to go away, so I think there may be something here? But I also need other brains to double check I'm not just tired and missing something obvious...

still garnet
#

ooh nice, I think I grok it

#

so every level of nesting starts its own router + local buildkit client/session, and they just share the lower-level buildkit host instead

civic yacht
#

And in the future I think we can replace "share the lower-level buildkit" with "share the lower-level dagger-runner" or something, since we probably don't want to directly expose APIs we don't directly control in the long run.

#

But we wanted to wrap buildkitd anyways, so that might fit in perfectly

#

I also have some side-thoughts about whether playground could be implemented as dagger-in-dagger using this approach...

tawny flicker
#

I'm finishing the NodeJS code generation, but I'd be happy to help for C#. I've done a few years of it.
The biggest work where I wouldn't be as fresh would be about the graphql query builder that you would have to create with C#

wet mason
tepid nova
#

so I think thatโ€™s how I thought it worked in the first place ๐Ÿ˜…

#

either that or thereโ€™s a subtlety Iโ€™m missing

wet mason
#

I'm tired, I'm going to call it a day ๐Ÿ™‚ I think that's going to be the main engine topic of next week -- figuring out the engine/session/etc architecture, incremental steps, etc. It's becoming the elephant in the room by the day

tepid nova
#

a cute elephant though

wet mason
#

It's becoming painful -- can't open PRs from our own pipelines because we can't forward the ssh agent. And we can't run the provisioning tests automatically because we can't forward the docker socket inside dagger

wet mason
still garnet
civic yacht
civic yacht
# tepid nova either that or thereโ€™s a subtlety Iโ€™m missing

It's a very subtle change from before, that's why it was hard to articulate. I think the reason it works out nicely is that it makes the behavior of clients outside dagger and clients inside dagger the same, whereas before there was a very subtle asymmetry (clients outside ultimately connected to a buildkit session, whereas clients inside ultimately connect to a router instance).

tepid nova
#

yeah the symmetry is great

civic yacht
# tepid nova yeah the symmetry is great

Along those lines, that change made me see so much symmetry between shim and engine-session that I am starting to wonder if they should be the same thing, but idk about that yet fully

wet mason
wet mason
tepid nova
#

would that make shimโ€ฆ a wrapper? ๐Ÿ˜€

#

I mean it already isโ€ฆ

still garnet
tepid nova
#

but like, other wrapper too

wet mason
#

Thereโ€™s a lot of symmetry. Not sure what to do with it yet.

What @tepid nova was mentioning (e.g. dagger exec go run โ€ฆ that transparently exposes a DAGGER_HOST) and what the shim is doing, especially with extensions/d-in-d (expose a DAGGER_HOST, run the shimmed stuff) are the same, more or less

civic yacht
wet mason
#

But the shim does a bit more. And with networking (the other PR, shim proxying stuff) the shim will diverge further.

Or will it? If socket forwarding is handled by the session both locally to the host and in the shim for exec โ€ฆ

tepid nova
#

Hilariously, in my first proposal for 0.3 CLI, there was a dagger exec which was to be the actual shimโ€ฆ

#

now dagger exec is a client wrapper

civic yacht
tepid nova
#

and they may end up being the same thing ๐Ÿ˜ฌ

wet mason
#

๐Ÿ˜ถโ€๐ŸŒซ๏ธ

civic yacht
tepid nova
#

exactly

#

rings a bell @wet mason ? ๐Ÿ˜€

#

we actively used that spiral metaphor in 2019/2020 to stay motivated through endless iterations of prototypes / feedback / bikeshedding

#

Makes me very happy that you see it that way too

#

the straight line is an illusion

civic yacht
#

Oh totally, things have gradually been making more and more sense, even if there's ups and downs. And honestly that's not always the case with every project, quite often grand ideas just disintegrate, so we've definitely hit on something real

#

mood rn^

tawny flicker
civic yacht
#

I wouldn't be surprised if the extension just needs updates now that the nodejs sdk has changed though

#

And if you run into lots of headaches around that, we don't have to maintain those extensions technically. It's nice to since extensions are coming up in the near-enough future, but it's not worth tons of hassle; we are going to need to re-assess and redo a lot of extension stuff anyways.

tawny flicker
#

true

tawny flicker
strong coral
strong coral
#

Working!

oak sandal
strong coral
#

Ok, I have it working in a user friendly form

$query = Query {
    Container {
        WithFrom alpine {
            WithExec "apk", "add", "curl" {
                WithExec "curl", "https://wttr.in/" {
                    Stdout {
                        Contents
                    }
                }
            }
        }
    }
}

$data = Invoke-GraphQLQuery -Query $query -Uri "http://localhost:8080/query"

$data.data.container.from.exec.exec.stdout.contents
hasty basin
strong coral
hasty basin
#

@strong coral would you be available next week to show this on the Community Call?

tepid nova
tepid nova
#

So, there is a helper tool which you can download and run from your SDK, to open a session which you can then connect to. This is what other SDKs do

tepid nova
#

yes ๐Ÿ‘

tepid nova
hasty basin
#

Update: Nic didn't actually need to write out his built binary to the local FS (prob most people don't want to/need to either), so he mounted the Directory from the go build output and copied it into place in his final Container to Publish.

Orginally Nic was surprised that with a Client connection he only had a point in time snapshot of his host workdir. So when he wrote a binary to the host filesystem and wanted to read that artifact back in, he couldn't. If he closed the Client connection and re-opened it, he could then get a new snapshot of the more recent state of the host workdir that had his binary in it. Here are two gists that show that behavior:

Call for src twice, same client. Doesn't refetch host workdir, but uses original snapshot of host workdir without exported build directory. To test ensure you've remove ./build/ before running.
https://gist.github.com/jpadams/71f542bcd774573799729196771f6622

#21 ls -alh build
#0 0.069 ls: build: No such file or directory
#21 ERROR: process "/_shim ls -alh build" did not complete successfully: exit code: 1
------
 > ls -alh build:
#0 0.069 ls: build: No such file or directory
------
input:1: container.from.withMountedDirectory.withWorkdir.withEnvVariable.exec.stdout.contents process "/_shim ls -alh build" did not complete successfully: exit code: 1

Call for client twice. Works. Implicit client close between function calls to build() and list().
https://gist.github.com/jpadams/2a18c70c6e4a555325caf594e21fe031

rancid turret
#

Hey guys ๐Ÿ‘‹ I've been thinking about the logs that come from the engine. Do we support getting those logs in JSON form? If not, can we? I remember seeing somewhere that it's not just logs from buildkit. Is it the API router? Are we sending both at the moment or just buildkit? Use case is to allow for better observability in an SDK. So instead of just streaming everything to screen or a file, would be very interesting to be able to "parse" the logs into user friendly messages. Something like the tty logger from Europa. \cc @civic yacht

lyric jasper
#

Local Dev

civic yacht
#

I updated this discussion from a while back with a synthesis what we've been talking about in terms of engine architecture, including the most recent discussions end of last week: https://github.com/dagger/dagger/discussions/3280

Nothing revolutionary if familiar with the past discussions, small differences are: using the name "session router" for the local binary, expanding its possible future scope a bit (could also be used to distribute work to multiple backend runners in the future) and using DAGGER_RUNNER_HOST instead of DAGGER_HOST.

It's not complete at all since it can really encompass so much, just did a first pass this morning. Hoping to use it as an anchor for discussions we were planning to have this week. Next step for me is to go take a look at the CLI PR from @wild zephyr and related issues now to see how this all fits together in the details. cc @wet mason @tepid nova

tepid nova
wild zephyr
tepid nova
#

FYI @wet mason @obsidian rover I'm opening a separate issue about the "mount unix socket", starting with @wet mason 's API proposal. Looks like we can solve 2 user problems at once: ssh forwarding + docker engine access

tepid nova
#

@wet mason maybe we should have an overarching "improve networking" issue similar to your "improve logging"

#

(observing the different threads related to that this morning)

wet mason
#

@tepid nova Would like your opinion on https://github.com/dagger/dagger/pull/3691#issuecomment-1311145961

I raised the question: does it make sense to have container-to-container networking in anything other than services (e.g. regular Execs):

Regular Execs are:

  • short lived
  • eventual (when do you connect to the socket? might be right away, might be in 10 mins)
  • cached (you might never be able to connect if the Exec is cached)

See the startRegistry we use internally for test -- we do weird hacks with random env variable for cache busting, go-routines to make it long-lived, for loop shell coordination to make it consistent

I believe host-to-container and container-container networking is relevant for services only

tepid nova
#

Seems reasonable to support outbound traffic for Exec, but not inbound maybe? Knowing that if a user wants it badly enough, they'll find a way to work around the limitation (reverse connect, something)

tepid nova
#

OK, I moved the discussion to the issue and shared some thoughts

strong coral
#

I'm struggling to use dagger-engine-session. It either blocks the shell or shuts down after a couple of seconds.

#

I assume shut down is triggered by

    go func() {
        io.Copy(io.Discard, os.Stdin)
        l.Close()
    }()
ancient kettle
#

@wet mason @civic yacht Is there any way to force Container.EnvVariables to execute?

package main

import (
    "context"
    "fmt"
    "os"

    "dagger.io/dagger"
)

func main() {
    ctx := context.Background()
    fmt.Println("Connecting")
    d, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
    if err != nil {
        panic(err)
    }

    fmt.Println("Getting EnvVariables from nginx:1.23.2")
    nginx := d.Container().From("nginx:1.23.2")

    vars, err := nginx.EnvVariables(ctx)

    fmt.Println("Printing ", len(vars), "environment variables")
    for _, env := range vars {
        name, err := env.Name(ctx)
        if err != nil {
            panic(err)
        }
        val, err := env.Value(ctx)
        if err != nil {
            panic(err)
        }
        fmt.Println(name, "=", val)
    }
}
Connecting
Getting EnvVariables from nginx:1.23.2
Printing 0 environment variables
wet mason
#

did err return an error?

ancient kettle
wet mason
#

it should have executed given that it takes a ctx

ancient kettle
#

Maybe something weird is happening in the query builder for that one?

wet mason
#

Yeah, returning a lists of objects doesn't work ...

I don't know if it's fixable or if EnvVariables should return a list of strings instead

/cc @civic yacht

ancient kettle
wet mason
#

I think EnvVariables is the only one in the API

#

Could you log an issue please?

rancid turret
wet mason
strong coral
#

Is engine-session supposed to write buildkit output to stderr?

civic yacht
tepid nova
#

@wet mason @civic yacht did we release the version of the Go SDK that doesn't require go mod edit yet?

  • If not, can we?
  • If yes: docs need to be updated
civic yacht
tepid nova
#

Wouldn't it be a Go-only release though?

#

ie something that wouldn't affect other SDKs or the engine

#

(but maybe more complicated than that because of the engine/session helper dependency)

#

As long as it's on your radar ๐Ÿ‘

civic yacht
#

Yeah I think we probably could in theory do the release independently even given the new session binary, it just felt like a lot in the midst of everything else. It's definitely not forgotten, I'm excited to delete lines of documentation ๐Ÿ™‚

wet mason
#

Yeah, just because too much was going on at the same time

wild zephyr
#

CLI PR is ready for ๐Ÿ‘€ whenever you have a sec @civic yacht @tepid nova @stray heron . I'll open a new PR to work on the distribution changes as agreed with Andrea and Erik https://github.com/dagger/dagger/pull/3748

wet mason
civic yacht
tepid nova
civic yacht
civic yacht
#

Hahaha it's converging though! It makes more sense than ever

tepid nova
#

Going to memorialize that one

#

"We have never been closer to knowing what the hell we're doing"

civic yacht
tepid nova
wet mason
#

@civic yacht Ugh. Was trying to debug why all tests were broken after renaming a field. Turns out I also renamed it in the bootstrapped code, which used the last release (and the field was not renamed). In a weird catch 22 where the old field is now deprecated and therefore the linter won't pass if I don't switch to the new name in the bootstrap code

#

I'll just //nolint for now but yeah

civic yacht
#

Basically, the problem is that right now all the code is intermixed so it's not possible to change "dev" code without also changing the code we use to bootstrap dev dagger?

wet mason
#

@civic yacht Yeah. Or with the separate session binary you were thinking, we could go build by hand dagger then run everything using bin://

#

to avoid bootstrapping shenanigans

#

or maybe not, it's good to use dagger for everything

wet mason
#

The path handling of containers/mounts/workdir is mind boggling

civic yacht
wet mason
#

Oh yeah no rush! Thank you!

wet mason
civic yacht
obsidian rover
rancid turret
obsidian rover
rancid turret
#

We should test all versions. It's being done in mage (sdk:python:test).

obsidian rover
rancid turret
#

I'm more concerned about windows vs "unix". So ideally yes, but if resource is limited we can test just one. 3.10.

obsidian rover
rancid turret
#

I know we can't have windows in GHA now but I don't know why.

#

Is it because the engine itself needs to work on compatibility yet?

obsidian rover
obsidian rover
rancid turret
#

Still not making sense that error. Just tested using 4 background processes at the same time. Each test should have its own temp dir. As for the CI matrix, if you have multiple python versions, do you know if they run in different VMs?

obsidian rover
rancid turret
#

Well, looking at the log the error is happening on a single ubunbu + Python 3.10 instance.

#

Do you have linux?

obsidian rover
#

You can push on the PR btw if it helps you

rancid turret
#

I don't have access to any linux anymore.

obsidian rover
#

oh, I have a VPS

rancid turret
#

I don't have anything to push, I'd just like to run that command manually in a ubuntu host.

obsidian rover
rancid turret
obsidian rover
rancid turret
#

Fails in VM.

civic yacht
#

@obsidian rover @rancid turret I mention that "text busy" error in the PR description of the provisioning test here: https://github.com/dagger/dagger/pull/3763

tl;dr it's essentially a flaw in Linux and there's many-years-old still-open issues for Go, Java, various build systems, etc. for it: https://github.com/golang/go/issues/22315

We have the officially suggested workaround (retry in a loop ๐Ÿคทโ€โ™‚๏ธ ) in go: https://github.com/dagger/dagger/blob/cd8c7ef9ed2f0e7d42208547cf31f4ed175dd2e3/sdk/go/internal/engineconn/dockerprovision/dockerprovision.go#L36-L52

I didn't think it was necessary in Python because our provisioning code is sync, but maybe it's still possible for sync code to run in different threads? I thought something about the GIL would stop that but I don't know enough.

It's also possible the "text busy" error could be due to something else, but this seems likely the top suspect initially

#

Good news if that's the case is it's extremely obscure: it can only happen on the first time provisioning a new binary happens and even then it requires that multiple threads in the same process are trying to provision it concurrently and hit a very tight time window

obsidian rover
rancid turret
ancient kettle
#

@civic yacht When I run this snippet:

newDir := c.Directory().WithNewDirectory("/foo").WithNewFile("some-file", dagger.DirectoryWithNewFileOpts{
    Contents: "some-content",
})

Is "some-content" in the ID for newDir?

Asking because... if len(Contents) is large (say megabytes or more), that could get really nasty, really quickly.

civic yacht
ancient kettle
#

Cool. Just wanted to make sure I understood it correctly. Thanks!

civic yacht
wet mason
rancid turret
civic yacht
wet mason
#

@rancid turret re deprecation warnings: I implemented this Replaced by @rootfs which codegen replaces by the native symbol for the language (e.g. Replaced by Rootfs in Go). Thoughts? /cc @tawny flicker

tawny flicker
#

This community call was packed with demos!!

tawny flicker
rancid turret
wet mason
#

Nice ๐Ÿ™‚

strong coral
#

Do you have an example of what the query looks like for a go build?

civic yacht
#

Yeah you re right It s in a thread but

wet mason
#

Trying to regroup small API wins we can do quick:

Anything else @tepid nova @hasty basin @civic yacht @cosmic cove ?

tepid nova
#

checking the size/small label just in case...

civic yacht
tepid nova
#

(not sure if that's an easy win though)

civic yacht
cosmic cove
tawny flicker
cosmic cove
wet mason
civic yacht
#

I just thought of what I think is a relatively easy way of being able to mount the shim binary into exec ops direct from the engine image host fs (oci runtime hooks), updated this issue's description with the idea: https://github.com/dagger/dagger/issues/3733

Should solve that problem of building the shim on the fly (and also help out with the remaining ugliness mentioned in the dagger-in-dagger pr: https://github.com/dagger/dagger/pull/3787)

@wet mason @tepid nova I think this is a pretty robust approach actually (all my other previous ideas were either huge hacks or huge efforts), but let me know if you disagree or have any experience with oci runtime hooks. Before this I knew they existed but haven't used them yet.

wet mason
civic yacht
wet mason
#

Right -- I forgot for a second we're actively rebuilding it, not just "rebranding" it

#

So there's our hook

tepid nova
#

Speaking of third-party images, I remember seeing that we pull a binfmt image from tonis's personal docker hub account or something, for multi-platform? Is that right and if so, is there an issue to track changing that?

tepid nova
#

Ah currently users have to run it manually?

#

So our "source of truth" is a guide somewhere in our docs I'm guessing

civic yacht
#

So we need a language agnostic section or something. @cosmic cove do you know if there's any existing issue for this? I forget what was mentioned in the Zoom chat

cosmic cove
tepid nova
#

What would be useful is an issue tracking all the documentation content that may be needed outside a SDK section. (including this one). That would help avoid one-off decisions we regret later

cosmic cove
tepid nova
#

Thanks! I replied there

wet mason
tepid nova
#

Didn't we discuss that in an issue already?

wet mason
#

Yep, just triple checking before making an API change

#

avoid surprises

tepid nova
#

Right

wet mason
#

thanks

rancid turret
#

Deprecation patterns

obsidian rover
obsidian rover