#Is it required to export actions taken in exec to the filesystem?

1 messages · Page 1 of 1 (latest)

celest wren
#

Hey! So, I'm trying to just execute some actions within a container but I don't want to get the output. I noticed with all of the Go guides:
https://docs.dagger.io/sdk/go/275922/guides

It either does one of two things:

  • ends with something like output.Export(w.Ctx, path)
  • ends with an exec using .Stdout().Contents(ctx)

What I'm working on I don't really care about the output because I want to keep the host clean and unaware of the build that's running. I have some code that looks like:

    path := "build/"

        // custom function just running some "git ..." commands with a binary
    w.container, err = gitClone(w.container)
    if err != nil {
        return err
    }

    w.container = w.container.Exec(dagger.ContainerExecOpts{
        Args: []string{
            "ls", "-la",
        },
    })

    w.container = w.container.Exec(dagger.ContainerExecOpts{
        Args: []string{
            "./gradlew", "check",
        },
    })

    output := w.container.Directory(path)

    // write contents of container build/ directory to the host
    _, err = output.Export(w.Ctx, path)
    if err != nil {
        return err
    }

Whenever I try to remove the output section I get zero feedback back from the execution. Which I would take as an understanding that the process just isn't running. So, I guess what I'm trying to understand here is, can I run a series of exec actions on a container but not care about the output since my actions will take care of artifact uploads?

  • Work with the Host Filesystem
pliant ridge
celest wren
#

🤦

#

I'll check that out and report back.

#

Thank you!

#

Yep, worked perfectly!

pliant ridge