Skip to content

command: add pipe command (#182) - #587

Merged
seruman merged 39 commits into
peak:masterfrom
ahmethakanbesel:stdin-pipe
Jul 27, 2023
Merged

seruman merged 39 commits into
peak:masterfrom
ahmethakanbesel:stdin-pipe

Conversation

@ahmethakanbesel

@ahmethakanbesel ahmethakanbesel commented Jul 6, 2023

Copy link
Copy Markdown
Contributor

Resolves #182 and #522
Added pipe command to upload stdin output to a bucket.

Example usage:
echo "content" | s5cmd pipe s3://bucket/file.txt

@ahmethakanbesel
ahmethakanbesel requested review from a team, igungor and seruman and removed request for a team July 6, 2023 07:46
Comment thread storage/stdin.go Outdated
Comment thread command/pipe.go Outdated
Comment thread command/pipe.go
@hsource

hsource commented Jul 7, 2023

Copy link
Copy Markdown

I tested this in production for uploading a 500 GB file that was the output of tar and it seemed to work well! Just wanted to add my 2 cents here.

I did this by

  1. Forking the branch and running go install github.com/wanderlog/s5cmd/[email protected] to install it
  2. Running this command:
tar -cf - "$INPUT" | zstd -1 --stdout | \
  ~/go/bin/s5cmd --endpoint-url "$S3_ENDPOINT" --credentials-file "$S5CMD_CREDENTIALS_FILE" \
    pipe --part-size "$PART_SIZE_MB" "$S3_DESTINATION"

Verifying the command completed successfully

Comment thread command/pipe.go Outdated
@ahmethakanbesel
ahmethakanbesel requested a review from seruman July 11, 2023 10:57
@seruman

seruman commented Jul 11, 2023

Copy link
Copy Markdown
Contributor

I think with refactoring cp command, we might able to use some of the code for stuff like common flags, content type guessing, override logic but not exactly sure if it worths, what do you think? @ahmethakanbesel @igungor

Comment thread command/pipe.go Outdated
@ahmethakanbesel

ahmethakanbesel commented Jul 11, 2023

Copy link
Copy Markdown
Contributor Author

I think with refactoring cp command, we might able to use some of the code for stuff like common flags, content type guessing, override logic but not exactly sure if it worths, what do you think? @ahmethakanbesel @igungor

cp has the NewSharedFlags function, which defines 18 different common flags for cp and sync. pipe uses 13 of them. We can reduce the number of shared flags to use them all in cp, sync and pipe, but it can affect the user experience.

We can have a common ShouldOverride function. It may take a list of available flags or a parameter to determine called by cp or pipe.

@ahmethakanbesel
ahmethakanbesel requested a review from seruman July 23, 2023 15:57

@seruman seruman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahmethakanbesel Can you update the changelog please?

@ahmethakanbesel

Copy link
Copy Markdown
Contributor Author

@ahmethakanbesel Can you update the changelog please?

I updated the changelog.

Comment thread command/pipe.go Outdated
Comment thread command/pipe.go Outdated
Comment thread command/pipe.go
Comment thread command/pipe.go Outdated
Comment thread command/pipe.go
Comment thread command/pipe.go Outdated
Comment thread command/pipe.go Outdated
Comment thread command/pipe.go Outdated
Comment thread command/pipe.go
Comment thread e2e/pipe_test.go Outdated
@ahmethakanbesel
ahmethakanbesel requested a review from igungor July 27, 2023 10:32
Comment thread command/pipe.go Outdated
@seruman

seruman commented Jul 27, 2023

Copy link
Copy Markdown
Contributor

@ahmethakanbesel There's a conflict on CHANGELOG.

seruman
seruman previously approved these changes Jul 27, 2023
@igungor

igungor commented Jul 27, 2023

Copy link
Copy Markdown
Member

🎖️

@seruman
seruman merged commit 18145bd into peak:master Jul 27, 2023
@mlissner

Copy link
Copy Markdown

So cool, thank you all! I've been waiting for this!

igungor added a commit that referenced this pull request Jul 27, 2023
@ahmethakanbesel
ahmethakanbesel deleted the stdin-pipe branch July 29, 2023 12:39
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.

Add option to stdin to cp

5 participants