@@ -91,7 +91,7 @@ type DeployOptions struct {
91
91
92
92
files * deployFiles
93
93
functions * deployFiles
94
- functionSchedules []models.FunctionSchedule
94
+ functionSchedules []* models.FunctionSchedule
95
95
}
96
96
97
97
type uploadError struct {
@@ -212,7 +212,7 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
212
212
213
213
options .files = files
214
214
215
- functions , schedules , err := bundle (options .FunctionsDir , options .Observer )
215
+ functions , schedules , err := bundle (ctx , options .FunctionsDir , options .Observer )
216
216
if err != nil {
217
217
if options .Observer != nil {
218
218
options .Observer .OnFailedWalk ()
@@ -238,10 +238,15 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
238
238
}
239
239
}
240
240
241
+ if len (schedules ) > 0 {
242
+ deployFiles .FunctionSchedules = schedules
243
+ }
244
+
241
245
l := context .GetLogger (ctx )
242
246
l .WithFields (logrus.Fields {
243
- "site_id" : options .SiteID ,
244
- "deploy_files" : len (options .files .Sums ),
247
+ "site_id" : options .SiteID ,
248
+ "deploy_files" : len (options .files .Sums ),
249
+ "scheduled_functions" : len (schedules ),
245
250
}).Debug ("Starting to deploy files" )
246
251
authInfo := context .GetAuthInfo (ctx )
247
252
@@ -580,7 +585,7 @@ func walk(dir string, observer DeployObserver, useLargeMedia, ignoreInstallDirs
580
585
return files , err
581
586
}
582
587
583
- func bundle (functionDir string , observer DeployObserver ) (* deployFiles , []models.FunctionSchedule , error ) {
588
+ func bundle (ctx context. Context , functionDir string , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , error ) {
584
589
if functionDir == "" {
585
590
return nil , nil , nil
586
591
}
@@ -592,7 +597,7 @@ func bundle(functionDir string, observer DeployObserver) (*deployFiles, []models
592
597
if err == nil {
593
598
defer manifestFile .Close ()
594
599
595
- return bundleFromManifest (manifestFile , observer )
600
+ return bundleFromManifest (ctx , manifestFile , observer )
596
601
}
597
602
598
603
functions := newDeployFiles ()
@@ -638,13 +643,16 @@ func bundle(functionDir string, observer DeployObserver) (*deployFiles, []models
638
643
return functions , nil , nil
639
644
}
640
645
641
- func bundleFromManifest (manifestFile * os.File , observer DeployObserver ) (* deployFiles , []models.FunctionSchedule , error ) {
646
+ func bundleFromManifest (ctx context. Context , manifestFile * os.File , observer DeployObserver ) (* deployFiles , []* models.FunctionSchedule , error ) {
642
647
manifestBytes , err := ioutil .ReadAll (manifestFile )
643
648
644
649
if err != nil {
645
650
return nil , nil , err
646
651
}
647
652
653
+ logger := context .GetLogger (ctx )
654
+ logger .Debug ("Found functions manifest file" )
655
+
648
656
var manifest functionsManifest
649
657
650
658
err = json .Unmarshal (manifestBytes , & manifest )
@@ -653,7 +661,7 @@ func bundleFromManifest(manifestFile *os.File, observer DeployObserver) (*deploy
653
661
return nil , nil , fmt .Errorf ("malformed functions manifest file: %w" , err )
654
662
}
655
663
656
- schedules := make ([]models.FunctionSchedule , 0 , len (manifest .Functions ))
664
+ schedules := make ([]* models.FunctionSchedule , 0 , len (manifest .Functions ))
657
665
functions := newDeployFiles ()
658
666
659
667
for _ , function := range manifest .Functions {
@@ -670,7 +678,7 @@ func bundleFromManifest(manifestFile *os.File, observer DeployObserver) (*deploy
670
678
}
671
679
672
680
if function .Schedule != "" {
673
- schedules = append (schedules , models.FunctionSchedule {
681
+ schedules = append (schedules , & models.FunctionSchedule {
674
682
Cron : function .Schedule ,
675
683
Name : function .Name ,
676
684
})
0 commit comments