@@ -398,23 +398,26 @@ func (server *Server) UpdateJob(ctx context.Context, request *proto.UpdateJobReq
398
398
}
399
399
400
400
var variableValues []* sdkproto.VariableValue
401
- server .Logger .Info (ctx , "variable values from request" , slog .F ("template_version_id" , templateVersion .ID ), slog .F ("variable_values" , request .VariableValues ))
402
-
403
401
for _ , templateVariable := range request .TemplateVariables {
404
- server .Logger .Info (ctx , "insert template variable" , slog .F ("template_version_id" , templateVersion .ID ), slog .F ("template_variable" , templateVariable ))
402
+ server .Logger .Debug (ctx , "insert template variable" , slog .F ("template_version_id" , templateVersion .ID ), slog .F ("template_variable" , templateVariable ))
405
403
406
404
var value = templateVariable .DefaultValue
407
405
for _ , v := range request .VariableValues {
408
406
if v .Name == templateVariable .Name {
409
407
value = v .Value
410
- variableValues = append (variableValues , & sdkproto.VariableValue {
411
- Name : v .Name ,
412
- Value : v .Value ,
413
- })
414
408
break
415
409
}
416
410
}
417
411
412
+ if templateVariable .Required && value == "" {
413
+ return nil , xerrors .Errorf ("template variable %q is required but it is missing" , templateVariable .Name )
414
+ }
415
+
416
+ variableValues = append (variableValues , & sdkproto.VariableValue {
417
+ Name : templateVariable .Name ,
418
+ Value : value ,
419
+ })
420
+
418
421
_ , err = server .Database .InsertTemplateVersionVariable (ctx , database.InsertTemplateVersionVariableParams {
419
422
TemplateVersionID : templateVersion .ID ,
420
423
Name : templateVariable .Name ,
0 commit comments