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(api): add grpc plugin action handlers #3308

Merged
merged 6 commits into from
Sep 13, 2018
Merged

Conversation

bnjjj
Copy link
Contributor

@bnjjj bnjjj commented Sep 10, 2018

  1. Description
    JUST THE API PART, next one will be the worker part
  2. Related issues
  3. About tests
  4. Mentions

@ovh/cds

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()

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

if err != nil {
return sdk.WrapError(err, "postPGRPCluginHandler> Cannot start transaction")
}
defer tx.Rollback()

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

if err != nil {
return sdk.WrapError(err, "putGRPCluginHandler> Cannot start transaction")
}
defer tx.Rollback()

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

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 {

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) {

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>
@@ -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")
Copy link
Member

Choose a reason for hiding this comment

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

fmt.Sprintf

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)
Copy link
Member

Choose a reason for hiding this comment

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

name, os, arch string

sdk/exportentities/grpc_plugin.go Show resolved Hide resolved
grpc.WithDialer(func(address string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout("unix", socket, timeout)
},
),
Copy link
Member

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)
Copy link
Collaborator

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) {
Copy link
Collaborator

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)
Copy link
Collaborator

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"
Copy link
Collaborator

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>
@bnjjj
Copy link
Contributor Author

bnjjj commented Sep 11, 2018

CDS Report ut-engine#102.0 ✘
*

  • Engine Test with DB ✘

Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
@bnjjj
Copy link
Contributor Author

bnjjj commented Sep 11, 2018

CDS Report build#103.0 ✘

  • Build minimal
    • cds cli legacy ✘
    • cdsctl linux ✘
    • Engine Build linux amd64 ✘
    • tools/debpacker ✘
    • tools/os-ansible-inventory ✘
    • Worker linux amd64 / 386 ✘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants