Condukt.Sandbox.Transfer (Condukt v3.0.0)

Copy Markdown View Source

Moves directories in and out of a sandbox as tar archives, a chunk at a time, so an .xcresult bundle or a built .app never sits in memory whole.

Both directions run tar in the sandbox as a process (Condukt.Sandbox.start_process/4), base64-encoded so the bytes survive sandboxes whose output is text, such as a remote exec. export/3 follows the process's log; import_archive/4 writes the archive to its stdin, so it needs Condukt.Sandbox.write_process/4 too. The sandbox needs tar and base64.

sandbox
|> Condukt.Sandbox.export("build/App.app")
|> Stream.into(File.stream!("App.app.tar"))
|> Stream.run()

Condukt.Sandbox.import_archive(mac, "work/repo", Condukt.Sandbox.export(linux, "repo"))

Summary

Functions

A stream of the tar archive of path, relative to the sandbox's working directory. Enumerating it raises when the sandbox cannot run processes or tar fails.

Unpacks chunks, an enumerable of a tar archive's bytes such as export/3 returns, into the directory path, creating it. Returns :ok or {:error, reason}.

Functions

export(sandbox, path, opts \\ [])

A stream of the tar archive of path, relative to the sandbox's working directory. Enumerating it raises when the sandbox cannot run processes or tar fails.

Options: :timeout in milliseconds (default one hour), and :exclude, a list of tar --exclude patterns.

import_archive(sandbox, path, chunks, opts \\ [])

Unpacks chunks, an enumerable of a tar archive's bytes such as export/3 returns, into the directory path, creating it. Returns :ok or {:error, reason}.