diff --git a/Makefile b/Makefile index abe6d0c0..49bd35bb 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ git_upstream := $(shell git remote get-url $(shell git config branch.$(shell git export GIT_BRANCH = $(git_branch) export GIT_UPSTREAM = $(git_upstream) -export FUNNEL_VERSION=0.11.1-rc.4 +export FUNNEL_VERSION=0.11.1-rc.5 # LAST_PR_NUMBER is used by the release notes builder to generate notes # based on pull requests (PR) up until the last release. diff --git a/worker/storage.go b/worker/storage.go index 7bacfa26..a82bcc84 100644 --- a/worker/storage.go +++ b/worker/storage.go @@ -250,38 +250,39 @@ func fixLinks(mapper *FileMapper, basepath string) { } // resolveWildcards resolves any wildcards/globs in the output paths. -func resolveWildcards(mapper *FileMapper, output *tes.Output) error { +func resolveWildcards(mapper *FileMapper) error { var outputs []*tes.Output - // If path contains a wildcard, handle globbing and upload each file individually - if strings.Contains(output.Path, "*") { - globs, err := filepath.Glob(output.Path) - if err != nil { - return fmt.Errorf("failed to resolve path %v: %v", output.Path, err) - } - - for _, glob := range globs { - out := proto.Clone(output).(*tes.Output) - out.Path = glob - - // Construct URL by: - // - removing the mapper.WorkDir from the output.Path - // - then removing the PathPrefix - // - then joining the output.URL - globPath := strings.TrimPrefix(glob, mapper.WorkDir) - fixPath := strings.TrimPrefix(globPath, output.PathPrefix) - out.Url, err = url.JoinPath(output.Url, fixPath) + for _, output := range mapper.Outputs { + // If path contains a wildcard, handle globbing and upload each file individually + if strings.Contains(output.Path, "*") { + globs, err := filepath.Glob(output.Path) if err != nil { - return fmt.Errorf("failed to join URL: %v", err) + return fmt.Errorf("failed to resolve path %v: %v", output.Path, err) } - outputs = append(outputs, out) + for _, glob := range globs { + out := proto.Clone(output).(*tes.Output) + out.Path = glob + + // Construct URL by: + // - removing the mapper.WorkDir from the output.Path + // - then removing the PathPrefix + // - then joining the output.URL + globPath := strings.TrimPrefix(glob, mapper.WorkDir) + fixPath := strings.TrimPrefix(globPath, output.PathPrefix) + out.Url, err = url.JoinPath(output.Url, fixPath) + if err != nil { + return fmt.Errorf("failed to join URL: %v", err) + } + + outputs = append(outputs, out) + } + } else { + outputs = append(outputs, output) } - } else { - outputs = append(outputs, output) } mapper.Outputs = outputs - return nil } diff --git a/worker/worker.go b/worker/worker.go index d42a6398..09d500a0 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -214,9 +214,7 @@ func (r *DefaultWorker) Run(pctx context.Context) (runerr error) { if run.ok() { // Resolve wildcards in the output paths - for _, output := range mapper.Outputs { - resolveWildcards(mapper, output) - } + resolveWildcards(mapper) } if run.ok() && r.Conf.ScratchPath != "" {