File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -69,11 +69,13 @@ module.exports = {
69
69
const type = funcObject . events [ 0 ] . event . eventType ;
70
70
const path = funcObject . events [ 0 ] . event . path ; //eslint-disable-line
71
71
const resource = funcObject . events [ 0 ] . event . resource ;
72
+ const failurePolicy = funcObject . events [ 0 ] . event . failurePolicy
72
73
73
74
funcTemplate . properties . eventTrigger = { } ;
74
75
funcTemplate . properties . eventTrigger . eventType = type ;
75
76
if ( path ) funcTemplate . properties . eventTrigger . path = path ;
76
77
funcTemplate . properties . eventTrigger . resource = resource ;
78
+ if ( failurePolicy ) funcTemplate . properties . eventTrigger . failurePolicy = failurePolicy ;
77
79
}
78
80
79
81
this . serverless . service . provider . compiledConfigurationTemplate . resources . push ( funcTemplate ) ;
Original file line number Diff line number Diff line change @@ -499,6 +499,20 @@ describe('CompileFunctions', () => {
499
499
} ,
500
500
] ,
501
501
} ,
502
+ func3 : {
503
+ handler : 'func3' ,
504
+ events : [
505
+ {
506
+ event : {
507
+ eventType : 'foo' ,
508
+ resource : 'some-resource' ,
509
+ failurePolicy : {
510
+ retry : { } ,
511
+ } ,
512
+ } ,
513
+ } ,
514
+ ] ,
515
+ } ,
502
516
} ;
503
517
504
518
const compiledResources = [
@@ -537,6 +551,26 @@ describe('CompileFunctions', () => {
537
551
labels : { } ,
538
552
} ,
539
553
} ,
554
+ {
555
+ type : 'cloudfunctions.v1beta2.function' ,
556
+ name : 'my-service-dev-func3' ,
557
+ properties : {
558
+ location : 'us-central1' ,
559
+ runtime : 'nodejs8' ,
560
+ function : 'func3' ,
561
+ availableMemoryMb : 256 ,
562
+ timeout : '60s' ,
563
+ sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
564
+ eventTrigger : {
565
+ eventType : 'foo' ,
566
+ resource : 'some-resource' ,
567
+ failurePolicy : {
568
+ retry : { } ,
569
+ } ,
570
+ } ,
571
+ labels : { } ,
572
+ } ,
573
+ } ,
540
574
] ;
541
575
542
576
return googlePackage . compileFunctions ( ) . then ( ( ) => {
You can’t perform that action at this time.
0 commit comments