#Directory Export not working

1 messages · Page 1 of 1 (latest)

thick arrow
#

I'm trying to export some files from my dagger job, but the directory.export('/path') doesn't seem to copy the files locally.

I've tried getting a handle on the individual files and calling export on them directly, and that doesn't seem to work either.
I've tried both relative, and absolute paths for where the files should end up, and still no files.

The commands themselves apparently complete successfully, I just don't know where the files actually landed.
I'm using 0.10.3 and just running dagger locally.
Any suggestions?

#

My code looks something like

@fun() foo() {
  const container = baseContainer.withExec(...)
  await container.directory('/src/.turbo').export('logs')

  return container
}
#

The reason that I'm returning the container is so that I can get stdout from it down the line.

#

I did just try to return the directory and call export on that, and that did properly copy the files locally.

@fun() foo() {
  const container = baseContainer.withExec(...)
  return container.directory('/src/.turbo')
}

> dagger call foo export --path tmp
// expected files are now in ./tmp
pseudo umbra
#

you could select the individual file then export that

thick arrow
#

individual files wasn't working either

pseudo umbra
#

the last snippet is what you want

#

dagger call foo export -> problem solved?

thick arrow
#

I guess I would need to see what the output is like.
Since I'm running this all in CI, my current setup is

dagger call foo stdout

in order to get all of the logs.

It feels "weird" to just return the directory

#

I tried passing in a Directory as an argument (from the command line) and copying the files in that way (since it would be a 'proper' host directory), but I couldn't figure out a way to actually copy them.

#

I guess I could still return the Container and call

dagger call foo directory --path=/src/.turbo export --path=/tmp

That should work nicely. For some reason I had it in my head that I needed to call stdout to get logs

#

ok.. I'm good now. Thanks

pseudo umbra
#

Sorry I'm just catching up now.

You can always start that way, and later if your shell command gets too long, implement that logic in a new function, and call that instead. etc.

#

Also, sometimes you'll start by returning raw stdout, then later you'll add logic to parse it, and expose the structured data in new functions. I did that recently for a linter module

thick arrow
#

Thats pretty cool