Upload + Run().StdinFile: ship & load image tars through porter (v0.12.0)#7
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Upload(local,remote)(SFTP local→host, with .Sudo/.Mode/.Owner staging) andRun(cmd).StdinFile(local)(pipe a local file into a remote command's stdin, zero disk — e.g.docker load). Sudo+stdin handled viasudo -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