This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from deliveroo/LOG-1772/canoe-productionise-paddle
LOG-1772: Canoe: productionise Paddle
- Loading branch information
Showing
11 changed files
with
288 additions
and
188 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
tmp | ||
dist | ||
paddle |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,51 @@ | ||
# Paddle | ||
|
||
Paddle is a command line tool for data archival and processing. | ||
Paddle is a command line tool for canoe data archival and processing. | ||
|
||
Work in progress. | ||
## Setup for local development | ||
|
||
Make sure you have Go installed on your machine and that you checkout the repo to | ||
the right folder. By default should be: | ||
|
||
``` | ||
mkdir -p ~/go/src/github.com/deliveroo | ||
cd ~/go/src/github.com/deliveroo | ||
git clone [email protected]:deliveroo/paddle.git | ||
cd paddle | ||
``` | ||
|
||
You will need create a `$HOME/.paddle.yaml` that contains the bucket name, e.g: | ||
|
||
``` | ||
> cat $HOME/.paddle.yaml | ||
bucket: roo-bucket | ||
``` | ||
|
||
or if you prefer specify `BUCKET` as an environment variable | ||
|
||
You will also need to create a `$HOME/.aws/config` or `$HOME/.aws/credentials` so Paddle can connect to AWS, e.g.: | ||
|
||
``` | ||
> cat $HOME/.aws/credentials | ||
[default] | ||
aws_access_key_id=xxx | ||
aws_secret_access_key=yyy | ||
region=eu-west-1 | ||
``` | ||
|
||
``` | ||
$ go build | ||
``` | ||
|
||
## Release | ||
|
||
In order to release a new version, set up github export GITHUB_TOKEN=[YOUR_TOKEN] and do the following steps: | ||
|
||
``` | ||
$ git tag -a vX.X.X -m "[Comment]" | ||
$ git push origin vX.X.X | ||
$ goreleaser | ||
``` | ||
|
||
## Usage | ||
|
||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package data | ||
|
||
import ( | ||
"github.com/spf13/afero" | ||
"reflect" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestFilesToKeys(t *testing.T) { | ||
AppFs = afero.NewMemMapFs() | ||
AppFs.MkdirAll("src/a", 0755) | ||
afero.WriteFile(AppFs, "src/a/b", []byte("file c"), 0644) | ||
afero.WriteFile(AppFs, "src/c", []byte("file c"), 0644) | ||
|
||
list := filesToKeys("src") | ||
expectation := []string{ | ||
"src/a/b", | ||
"src/c", | ||
} | ||
|
||
if !reflect.DeepEqual(list, expectation) { | ||
t.Errorf("list is different got: %s, want: %s.", strings.Join(list, ","), strings.Join(expectation, ",")) | ||
} | ||
} | ||
|
||
func TestFilesToKeysWhenEmptyFolder(t *testing.T) { | ||
AppFs = afero.NewMemMapFs() | ||
AppFs.MkdirAll("src", 0755) | ||
|
||
list := filesToKeys("src") | ||
|
||
if len(list) != 0 { | ||
t.Errorf("expecting empty list but got: %s", strings.Join(list, ",")) | ||
} | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package data | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
type S3Path struct { | ||
bucket string | ||
path string | ||
} | ||
|
||
func (p *S3Path) Basename() string { | ||
components := strings.Split(p.path, "/") | ||
return components[len(components)-1] | ||
} | ||
|
||
func (p *S3Path) Dirname() string { | ||
components := strings.Split(p.path, "/") | ||
if len(components) == 0 { | ||
return "" | ||
} | ||
return strings.Join(components[:len(components)-1], "/") | ||
} |
Oops, something went wrong.