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

feat: replace IsCreated with Exists for Client interface from package docker #558

Merged
merged 1 commit into from
Jul 6, 2022
Merged
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
2 changes: 1 addition & 1 deletion pkg/buildkitd/buildkitd.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (c *generalClient) maybeStart(ctx context.Context,
return "", err
}

created, err := dockerClient.IsCreated(ctx, c.containerName)
created, err := dockerClient.Exists(ctx, c.containerName)
if err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type Client interface {
StartBuildkitd(ctx context.Context, tag, name, mirror string) (string, error)

IsRunning(ctx context.Context, name string) (bool, error)
IsCreated(ctx context.Context, name string) (bool, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to add a new method Exists and mark IsCreated deprecated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are still in alpha, thus I think it also works although we remove it directly.

There is no project that relies on us, currently.

Exists(ctx context.Context, name string) (bool, error)
WaitUntilRunning(ctx context.Context, name string, timeout time.Duration) error

Exec(ctx context.Context, cname string, cmd []string) error
Expand Down Expand Up @@ -448,7 +448,7 @@ func (c generalClient) StartEnvd(ctx context.Context, tag, name, buildContext st
return container.Name, container.NetworkSettings.IPAddress, nil
}

func (c generalClient) IsCreated(ctx context.Context, cname string) (bool, error) {
func (c generalClient) Exists(ctx context.Context, cname string) (bool, error) {
_, err := c.GetContainer(ctx, cname)
if err != nil {
if client.IsErrNotFound(err) {
Expand Down