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,worker): migrate all old plugins to new ones #3321

Merged
merged 24 commits into from
Sep 17, 2018

Conversation

bnjjj
Copy link
Contributor

@bnjjj bnjjj commented Sep 13, 2018

  1. Description
    DO NOT MERGE NOW, need to test on preprod.
    Only check changes in engine/worker
  2. Related issues
  3. About tests
  4. Mentions

@ovh/cds

bnjjj and others added 18 commits September 5, 2018 10:23
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
* fix(ui): better label modals

close #3286
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
close #fix_3311
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
There is too many collisions with namegenerator.
This explains the non-detecting worker timeout and the running jobs
since many days in workflow node run jobs.
Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
select {
case <-ctx.Done():
log.Error("CDS Worker execution canceled: %v", ctx.Err())
w.sendLog(buildID, "CDS Worker execution canceled\n", stepOrder, false)

Choose a reason for hiding this comment

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

Error return value of w.sendLog is not checked

}

// 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

Copy link
Member

@fsamin fsamin left a comment

Choose a reason for hiding this comment

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

It is possible to share the same Makefile with all plugins ?

Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
return cli.ShowCommandHelp(c, args.First())
}

cli.ShowAppHelp(c)

Choose a reason for hiding this comment

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

Error return value of cli.ShowAppHelp is not checked

args = append(args, c.Args().Tail()...)

if len(args) != 4 {
cli.ShowCommandHelp(c, "listen")

Choose a reason for hiding this comment

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

Error return value of cli.ShowCommandHelp is not checked

}

if !c.IsSet("kafka-password") && c.String("kafka-password") == "" {
cli.ShowCommandHelp(c, "listen")

Choose a reason for hiding this comment

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

Error return value of cli.ShowCommandHelp is not checked

args := []string{c.Args().First()}
args = append(args, c.Args().Tail()...)
if len(args) != 5 {
cli.ShowCommandHelp(c, "ack")

Choose a reason for hiding this comment

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

Error return value of cli.ShowCommandHelp is not checked

panic(err)
}
})
app.Run(os.Args)

Choose a reason for hiding this comment

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

Error return value of app.Run is not checked

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

}

//Send a plan file to kafka
func sendFileOnKafka(producer sarama.SyncProducer, topic string, r io.ReadCloser) (int, int, error) {

Choose a reason for hiding this comment

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

sendFileOnKafka is unused

if err != nil {
return schema1.SignedManifest{}, err
}
histories, err := client.ImageHistory(context.Background(), imageName)

Choose a reason for hiding this comment

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

ineffectual assignment to err

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

fmt.Printf("Unable to read bytes: %s\n", err)
continue
}
fmt.Println("Chunk received - action %d", actionID)

Choose a reason for hiding this comment

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

Println call has possible formatting directive %d

Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
if _, err := os.Stat(pluginBinary); os.IsNotExist(err) {
log.Info("Downloading the plugin %s", binary.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Debug

return false, err
}
if err := os.Chmod(pluginBinary, 0700); err != nil {

log.Info("Get the binary plugin %s", r.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Debug?

@@ -179,8 +179,9 @@ func (w *currentWorker) runJob(ctx context.Context, a *sdk.Action, buildID int64
case sdk.PluginAction:
//Define a loggin function
sendLog := getLogger(w, buildID, stepOrder)
log.Info("w.runGRPCPlugin")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Debug

@@ -191,3 +194,100 @@ func (w *currentWorker) runPlugin(ctx context.Context, a *sdk.Action, buildID in
return res
}
}

func (w *currentWorker) runGRPCPlugin(ctx context.Context, a *sdk.Action, buildID int64, params *[]sdk.Parameter, stepOrder int, sendLog LoggerFunc) sdk.Result {
log.Info("runPlugin> Begin buildID:%d stepOrder:%d", buildID, stepOrder)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Debug

func (w *currentWorker) runGRPCPlugin(ctx context.Context, a *sdk.Action, buildID int64, params *[]sdk.Parameter, stepOrder int, sendLog LoggerFunc) sdk.Result {
log.Info("runPlugin> Begin buildID:%d stepOrder:%d", buildID, stepOrder)
defer func() {
log.Info("runPlugin> End buildID:%d stepOrder:%d", buildID, stepOrder)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Debug

pluginFail(chanRes, sendLog, fmt.Sprintf("Unable to call grpc plugin manifest... Aborting (%v)", err))
return
}
log.Info("plugin successfully initialized: %#v", m)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Debug

Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
@sguiheux sguiheux merged commit 2ae4672 into master Sep 17, 2018
@bnjjj bnjjj deleted the feat_plugin_os_arch_exec branch October 30, 2018 14:59
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.

5 participants