-
Notifications
You must be signed in to change notification settings - Fork 26
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
[WIP] Update to Gitbase v0.20.0 #439
base: master
Are you sure you want to change the base?
Conversation
247c1eb
to
c273f26
Compare
The tests are failing due to a bug that will be fixed by #432. |
Looks good so far. |
c273f26
to
0e26c76
Compare
@carlosms thanks I didn't notice. To simplify review I've just rebased to master to solve conflicts, gonna address the tests now and also update to |
@@ -192,81 +162,32 @@ func startGitbaseWithClient(client api.EngineClient) error { | |||
return humanizef(err, "could not start gitbase") | |||
} | |||
|
|||
if err := docker.EnsureInstalled(components.MysqlCli.Image, components.MysqlCli.Version); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function has name startGitbaseWithClient
but it doesn't start client anymore. Just gitbase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker/docker_exec.go
Outdated
} | ||
|
||
defer func() { | ||
err = term.RestoreTerminal(fd, prevState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this error is never returned from the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactored this part here. It should be clearer now and the code is more decoupled.
docker/docker_exec.go
Outdated
return &insResp, nil | ||
} | ||
|
||
func withRawTerminal(in io.ReadCloser, fn func() error) func() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name of this function and arguments below are a little confusing. withRawTerminal
and rawTerminal
. But actually you pass true
and call this function even for non-terminal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
answered here.
err := docker.RemoveContainer(components.MysqlCli.Name) | ||
if err != nil { | ||
log.Warningf("could not stop mysql client: %v", err) | ||
if insResp.ExitCode != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if we have tests for it. What happens when you exit with ctrl-c
or ctrl-d
? Does it exit correctly with exit code 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Now it exits with 0 on ctrl-d
but not on ctrl-c
. Gonna try adding a test for these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's okay to exit with error on ctrl-c
in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a test for Ctrl-D
here.
aef630a
to
4e151e4
Compare
docker/docker_exec.go
Outdated
|
||
return fn() | ||
} | ||
type stdioAttaccher struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attach -> attacher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed here.
docker/docker_exec.go
Outdated
// characters | ||
prevState, err = term.SetRawTerminal(fd) | ||
if err != nil { | ||
done <- err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have deadlock here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😮 eagle's eye! thanks for noticing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed here
@@ -155,7 +155,10 @@ func (sa *stdioAttacher) withRawTerminal(fn attachFn) <-chan error { | |||
// characters | |||
prevState, err = term.SetRawTerminal(fd) | |||
if err != nil { | |||
done <- err | |||
go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's better to make the channel buffered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if in this case would slightly increase readability, I think that using an unbuffered channel keeps the code simpler compared to the readability gain of using a buffered channel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what exactly do you see as a downside of a buffered channel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's just an easier model to think 😄
Signed-off-by: Lou Marvin Caraig <[email protected]>
… containers Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
…cess Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
I've separatead the starting of a component into a different function so that it can be used by other commands as well. Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
c39c87b
to
0369669
Compare
Rebased on |
Signed-off-by: Lou Marvin Caraig <[email protected]>
Signed-off-by: Lou Marvin Caraig <[email protected]>
Updated to |
Closes #424.
Marked as WIP as waiting for final Gitbase v0.20.0 release.
This PR removes the
MysqlCli
component and uses the MySql client provided byGitbase
itself.