I'm using dagger with the Go SDK with dagger run (learnt from the old docs). I'm programming the pipeline and want to run the chained functions before performing further control logic outside the pipeline and then run further commands.
So my code is:
container, err = container.
WithDirectory("/packages", client.Host().Directory(buildParameters.OutputDirectoryPath)).
WithExec([]string{"apt", "update", "-y"}).
Sync(ctx)
if err != nil {
return container, err
}
// Glob debian packages
directory := container.Directory("/packages")
files, err := directory.Glob(ctx, "**.deb")
aptInstallCommand := []string{"apt", "install", "-y"}
for _, file := range files {
aptInstallCommand = append(aptInstallCommand, "/packages/"+file)
}
container, err = container.
WithExec(aptInstallCommand).
Sync(ctx)
however, in my output, I'm getting:
4: in exec apt update -y
4: Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [273 kB]
4: Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [18.8 kB]
4: Fetched 8568 kB in 1s (8659 kB/s)
4: Reading package lists...
5: in exec apt install -y ...packages removed for message length...
5: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
5: Reading package lists...
4: in exec apt update -y
The 4, then 5, then 4 again task references in the left suggest the first sync hadn't been completed before the API call returned and continued with further pipeline calls.
Is my conclusion that Sync is non-blocking correct? Am I using this wrong?