Skip to content

Commit

Permalink
Close plugin connection
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Christensen <kimworking@gmail.com>
  • Loading branch information
kichristensen committed Apr 30, 2024
1 parent 3f0f41a commit ddd49d0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/porter/porter.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func (p *Porter) Close() error {
bigErr = multierror.Append(bigErr, err)
}

err = p.Signer.Close()
if err != nil {
bigErr = multierror.Append(bigErr, err)
}

return bigErr.ErrorOrNil()
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/signing/pluginstore/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,11 @@ func (s *Signer) Connect(ctx context.Context) error {

return nil
}

func (s *Signer) Close() error {
if s.conn != nil {
s.conn.Close(context.Background())
s.conn = nil
}
return nil
}
2 changes: 2 additions & 0 deletions pkg/signing/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import "context"
// Signer is an interface for signing and verifying Porter
// bundles and invocation images.
type Signer interface {
Close() error

// Sign generates a signature for the specified reference, which
// can be a Porter bundle or an invocation image.
Sign(ctx context.Context, ref string) error
Expand Down

0 comments on commit ddd49d0

Please sign in to comment.