-
Notifications
You must be signed in to change notification settings - Fork 414
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(api): add grpc plugin action handlers #3308
Conversation
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
fmt.Printf("Error writing content to file: %s\n", errw.Error()) | ||
return "", errw | ||
} | ||
outfile.Sync() |
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.
Error return value of outfile.Sync
is not checked
engine/api/grpc_plugin.go
Outdated
if err != nil { | ||
return sdk.WrapError(err, "postPGRPCluginHandler> Cannot start transaction") | ||
} | ||
defer tx.Rollback() |
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.
Error return value of tx.Rollback
is not checked
engine/api/grpc_plugin.go
Outdated
if err != nil { | ||
return sdk.WrapError(err, "putGRPCluginHandler> Cannot start transaction") | ||
} | ||
defer tx.Rollback() |
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.
Error return value of tx.Rollback
is not checked
|
||
type Common struct { | ||
grpcplugin.Common | ||
conn *grpc.ClientConn |
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.
conn
is unused
import "strings" | ||
|
||
//Escape characters | ||
func Escape(s string) string { |
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.
Escape
is unused
} | ||
|
||
// parseTemplateParameters parses a list of key value pairs separated by new lines | ||
func parseTemplateParameters(s string) (map[string]interface{}, 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.
parseTemplateParameters
is unused
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
sdk/grpcplugin/grpcplugin.go
Outdated
@@ -51,7 +51,7 @@ func (c *Common) Start(ctx context.Context) error { | |||
func (c *Common) start(ctx context.Context, desc *grpc.ServiceDesc, srv interface{}) (Plugin, error) { | |||
//Start the grpc server on unix socket | |||
uuid := sdk.UUID() | |||
c.Socket = filepath.Join(".", "grpcplugin-socket-"+uuid+".sock") | |||
c.Socket = filepath.Join(os.TempDir(), "grpcplugin-socket-"+uuid+".sock") |
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.
fmt.Sprintf
sdk/cdsclient/interface.go
Outdated
PluginGetBinary(string, string, string, io.Writer) error | ||
PluginDeleteBinary(name string, os string, arch string) error | ||
PluginGetBinary(name string, os string, arch string, w io.Writer) error | ||
PluginGetBinaryInfos(name string, os string, arch string) (*sdk.GRPCPluginBinary, 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.
name, os, arch string
grpc.WithDialer(func(address string, timeout time.Duration) (net.Conn, error) { | ||
return net.DialTimeout("unix", socket, timeout) | ||
}, | ||
), |
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.
fmt
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
alters map[string]VariableAlteration | ||
} | ||
|
||
type VariableAlteration func(interface{}) (interface{}, 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.
doc
|
||
type VariableAlteration func(interface{}) (interface{}, error) | ||
|
||
func NewApplications(file string) (*Applications, 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.
doc
} | ||
|
||
buf := new(bytes.Buffer) | ||
err = tmpl.Execute(buf, variables) |
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.
one line
"time" | ||
|
||
"github.com/ovh/cds/sdk/grpcplugin" | ||
"google.golang.org/grpc" |
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.
import
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
CDS Report ut-engine#102.0 ✘
|
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
CDS Report build#103.0 ✘
|
JUST THE API PART, next one will be the worker part
@ovh/cds