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

Issues with branches and pico updating them #76

Closed
ADRFranklin opened this issue Aug 4, 2020 · 6 comments
Closed

Issues with branches and pico updating them #76

ADRFranklin opened this issue Aug 4, 2020 · 6 comments

Comments

@ADRFranklin
Copy link

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.


ERROR: for sag-sffw-prod-gm  Cannot create container for service sffw: Conflict. The container name "/sag-sffw-dev-gm" is already in use by container "cff9bb1eb6527bd18a47ca1bf84a9d5bd01729e21cf6f5da520a80fc5c24e36b". You have to remove (or rename) that container to be able to reuse that name.,
ROR: for sffw  Cannot create container for service sffw: Conflict. The container name "/sag-sffw-dev-gm" is already in use by container "cff9bb1eb6527bd18a47ca1bf84a9d5bd01729e21cf6f5da520a80fc5c24e36b". You have to remove (or rename) that container to be able to reuse that name.,
{"level":"error","ts":"2020-08-04T14:22:01.131Z","caller":"executor/cmd.go:40","msg":"executor task unsuccessful","target":"sffw-gamemode-dev","shutdown":false,"error":"exit status 1","stacktrace":"github.com/picostack/pico/executor.(*CommandExecutor).Subscribe\n\t/home/runner/work/pico/pico/executor/cmd.go:40\ngithub.com/picostack/pico/service.(*App).Start.func1\n\t/home/runner/work/pico/pico/service/service.go:116"},
Encountered errors while bringing up the project.

The production repo should not have been touched at all, since no event changes happened to that branch.

@Southclaws
Copy link
Collaborator

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.

@Southclaws
Copy link
Collaborator

Problematic function:

func (w GitWatcher) getTarget(url string) (target task.Target, exists bool) {

@Southclaws
Copy link
Collaborator

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.

@ADRFranklin
Copy link
Author

I think path makes the most sense to do.

@ADRFranklin
Copy link
Author

ADRFranklin commented Aug 5, 2020

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

@ADRFranklin
Copy link
Author

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.

Southclaws added a commit that referenced this issue Aug 27, 2020
Southclaws added a commit that referenced this issue Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants