Skip to content

Commit

Permalink
added support for latest tag
Browse files Browse the repository at this point in the history
  • Loading branch information
seanshahkarami committed Jun 6, 2022
1 parent 0b1e4d3 commit fd738ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const timeShasumPattern = "[0-9]*-[0-9a-f]*"
func scanForJobs(ctx context.Context, jobs chan<- Job, root string) error {
patterns := []string{
filepath.Join(root, "node-*", "uploads", "*", versionPattern, timeShasumPattern, "data"), // uploads without a namespace
filepath.Join(root, "node-*", "uploads", "*", "latest", timeShasumPattern, "data"), // uploads without a namespace (latest tag)
filepath.Join(root, "node-*", "uploads", "*", "*", versionPattern, timeShasumPattern, "data"), // uploads with a namespace
filepath.Join(root, "node-*", "uploads", "*", "*", "latest", timeShasumPattern, "data"), // uploads with a namespace (latest tag)
}

err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
Expand Down
12 changes: 12 additions & 0 deletions worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ func TestScanAndProcess(t *testing.T) {
data: []byte(`{"ts":1638576647406523064,"labels":{"filename":"wow1.txt"}}`),
},
},
"Latest": {
{
path: "node-000048b02d15bc7c/uploads/Pluginctl/imagesampler-top/latest/1638576647406523064-9801739daae44ec5293d4e1f53d3f4d2d426d91c/data",
upload: "node-data/Pluginctl/sage-imagesampler-top-latest/000048b02d15bc7c/1638576647406523064-wow1.txt",
data: []byte(`some more data`),
},
{
path: "node-000048b02d15bc7c/uploads/Pluginctl/imagesampler-top/latest/1638576647406523064-9801739daae44ec5293d4e1f53d3f4d2d426d91c/meta",
upload: "node-data/Pluginctl/sage-imagesampler-top-latest/000048b02d15bc7c/1638576647406523064-wow1.txt.meta",
data: []byte(`{"ts":1638576647406523064,"labels":{"filename":"wow1.txt"}}`),
},
},
"SkipNoData": {
{
path: "node-000048b02d15bc7c/uploads/Pluginctl/imagesampler-top/0.2.5/1638576647406523064-9801739daae44ec5293d4e1f53d3f4d2d426d91c/meta",
Expand Down

0 comments on commit fd738ec

Please sign in to comment.