Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Close backend engine after execution #20

Open
wants to merge 1 commit into
base: master
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
1 change: 1 addition & 0 deletions pipec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func executeAction(c *cli.Context) (err error) {
return err
}
}
defer engine.Close()

ctx, cancel := context.WithTimeout(context.Background(), c.Duration("timeout"))
defer cancel()
Expand Down
2 changes: 2 additions & 0 deletions pipeline/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ type Engine interface {
Tail(*Step) (io.ReadCloser, error)
// Destroy the pipeline environment.
Destroy(*Config) error
// Close the engine
Close() error
}
8 changes: 6 additions & 2 deletions pipeline/backend/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
)

type engine struct {
client client.APIClient
client *client.Client
}

// New returns a new Docker Engine using the given client.
func New(cli client.APIClient) backend.Engine {
func New(cli *client.Client) backend.Engine {
return &engine{
client: cli,
}
Expand Down Expand Up @@ -183,6 +183,10 @@ func (e *engine) Destroy(conf *backend.Config) error {
return nil
}

func (e *engine) Close() error {
return e.client.Close()
}

var (
noContext = context.Background()

Expand Down
4 changes: 4 additions & 0 deletions pipeline/backend/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ func (e *engine) Destroy(*backend.Config) error {
// DELETE /api/v1/namespaces/{name}
return nil
}

func (e *engine) Close() error {
return nil
}