Closed ADRFranklin closed 4 years ago
This is probably because pico receives the event from gitwatcher and then uses the URL to find the relevant target. It should use the url and branch name, or maybe even the path.
if t.RepoURL == url
just needs to be either a check against the path or a check against both the URL and branch. Either work.
I think path makes the most sense to do.
so something like this?
func (w GitWatcher) getTarget(path string) (target task.Target, exists bool) {
for _, t := range w.state.Targets {
targetPath := getTargetPath(t)
if targetPath == path {
return t, true
}
}
return
}
With the watcher event passing in e.Path
On second thought, the target struct needs to keep track of the directory it is in, since there is no way to get the full path from just using getTargetPath
which is what the tests expect.
For some reason when Pico see's changes in a repo, it somehow manages to run for all repos of the same url even if they have different branches.
For example today, I pushed to my development branch, and CI passed and pushed a staging container, well what happened was that the production server went down and it seems pico was responsible for doing that.
The production repo should not have been touched at all, since no event changes happened to that branch.