Skip to content

Upload + Run().StdinFile: ship & load image tars through porter (v0.12.0)#7

Merged
Booyaka101 merged 1 commit into
mainfrom
feat/upload-stdinfile
Jun 10, 2026
Merged

Upload + Run().StdinFile: ship & load image tars through porter (v0.12.0)#7
Booyaka101 merged 1 commit into
mainfrom
feat/upload-stdinfile

Conversation

@Booyaka101

Copy link
Copy Markdown
Owner

Adds Upload(local,remote) (SFTP local→host, with .Sudo/.Mode/.Owner staging) and Run(cmd).StdinFile(local) (pipe a local file into a remote command's stdin, zero disk — e.g. docker load). Sudo+stdin handled via sudo -k -S + MultiReader so the password line doesn't eat the file bytes. Tests + doc example; build/vet/staticcheck/modernize clean.

🤖 Generated with Claude Code

…stdin) — v0.12.0

Two primitives so a consumer can ship and load Docker image tars entirely
through porter tasks (unblocks a fully porter-backed dockerloader):

- Upload(local, remote): enhanced to honor .Sudo()/.Mode()/.Owner(). With any
  of those it uploads into a private mktemp (0600) over SFTP, then places into
  dest via the shared placeStaged (install -m / cp+chown) — so a secret is
  never world-readable mid-transfer. Plain transfers go straight via SFTP.
- Run(cmd).StdinFile(local): streams a local file into the remote command's
  stdin with zero disk staging. Under sudo it runs `sudo -k -S -p '' <cmd>`
  with stdin = MultiReader(password+"\n", file), so sudo consumes only the
  password line and the command (e.g. docker load) gets the file bytes intact.

writeFile refactored to share placeStaged. No new dependencies (goph Upload /
NewSftp / NewSession). doc.go example added. Build/vet/staticcheck/modernize/
gofmt all clean; new unit tests for both builders, placeStaged, and the
sudo+stdin interaction.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Booyaka101 Booyaka101 merged commit 755335f into main Jun 10, 2026
1 of 2 checks passed
@Booyaka101 Booyaka101 deleted the feat/upload-stdinfile branch June 10, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants