Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: HTTPNode.Location when building graph #2007

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,10 @@ func TestIncludesRemote(t *testing.T) {
firstRemote: srv.URL + "/first/Taskfile.yml",
secondRemote: "./second/Taskfile.yml",
},
{
firstRemote: srv.URL + "/first/",
secondRemote: srv.URL + "/first/second/",
},
}

tasks := []string{
Expand Down
20 changes: 11 additions & 9 deletions taskfile/node_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import (
// An HTTPNode is a node that reads a Taskfile from a remote location via HTTP.
type HTTPNode struct {
*BaseNode
URL *url.URL
logger *logger.Logger
timeout time.Duration
URL *url.URL // stores url pointing actual remote file. (e.g. with Taskfile.yml)
entrypoint string // stores entrypoint url. used for building graph vertices.
logger *logger.Logger
timeout time.Duration
}

func NewHTTPNode(
Expand All @@ -40,15 +41,16 @@ func NewHTTPNode(
}

return &HTTPNode{
BaseNode: base,
URL: url,
timeout: timeout,
logger: l,
BaseNode: base,
URL: url,
entrypoint: entrypoint,
timeout: timeout,
logger: l,
}, nil
}

func (node *HTTPNode) Location() string {
return node.URL.String()
return node.entrypoint
}

func (node *HTTPNode) Remote() bool {
Expand Down Expand Up @@ -119,6 +121,6 @@ func (node *HTTPNode) ResolveDir(dir string) (string, error) {
}

func (node *HTTPNode) FilenameAndLastDir() (string, string) {
dir, filename := filepath.Split(node.URL.Path)
dir, filename := filepath.Split(node.entrypoint)
return filepath.Base(dir), filename
}
Loading