-
Notifications
You must be signed in to change notification settings - Fork 428
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
Conversation
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>
engine/worker/builtin.go
Outdated
select { | ||
case <-ctx.Done(): | ||
log.Error("CDS Worker execution canceled: %v", ctx.Err()) | ||
w.sendLog(buildID, "CDS Worker execution canceled\n", stepOrder, false) |
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 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) { |
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
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.
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) |
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 cli.ShowAppHelp
is not checked
args = append(args, c.Args().Tail()...) | ||
|
||
if len(args) != 4 { | ||
cli.ShowCommandHelp(c, "listen") |
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 cli.ShowCommandHelp
is not checked
} | ||
|
||
if !c.IsSet("kafka-password") && c.String("kafka-password") == "" { | ||
cli.ShowCommandHelp(c, "listen") |
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 cli.ShowCommandHelp
is not checked
args := []string{c.Args().First()} | ||
args = append(args, c.Args().Tail()...) | ||
if len(args) != 5 { | ||
cli.ShowCommandHelp(c, "ack") |
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 cli.ShowCommandHelp
is not checked
panic(err) | ||
} | ||
}) | ||
app.Run(os.Args) |
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 app.Run
is not checked
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
} | ||
|
||
//Send a plan file to kafka | ||
func sendFileOnKafka(producer sarama.SyncProducer, topic string, r io.ReadCloser) (int, int, 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.
sendFileOnKafka
is unused
if err != nil { | ||
return schema1.SignedManifest{}, err | ||
} | ||
histories, err := client.ImageHistory(context.Background(), imageName) |
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.
ineffectual assignment to err
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.
done
fmt.Printf("Unable to read bytes: %s\n", err) | ||
continue | ||
} | ||
fmt.Println("Chunk received - action %d", actionID) |
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.
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>
engine/worker/requirement.go
Outdated
if _, err := os.Stat(pluginBinary); os.IsNotExist(err) { | ||
log.Info("Downloading the plugin %s", binary.Name) |
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.
Debug
engine/worker/requirement.go
Outdated
return false, err | ||
} | ||
if err := os.Chmod(pluginBinary, 0700); err != nil { | ||
|
||
log.Info("Get the binary plugin %s", r.Name) |
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.
Debug?
engine/worker/run.go
Outdated
@@ -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") |
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.
Debug
engine/worker/builtin.go
Outdated
@@ -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) |
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.
Debug
engine/worker/builtin.go
Outdated
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) |
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.
Debug
engine/worker/builtin.go
Outdated
pluginFail(chanRes, sendLog, fmt.Sprintf("Unable to call grpc plugin manifest... Aborting (%v)", err)) | ||
return | ||
} | ||
log.Info("plugin successfully initialized: %#v", m) |
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.
Debug
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
DO NOT MERGE NOW, need to test on preprod.
Only check changes in engine/worker
@ovh/cds