File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,14 @@ describe('Scf - special', () => {
90
90
expect ( outputs . InstallDependency ) . toBe ( 'TRUE' ) ;
91
91
expect ( outputs . Role ) . toBe ( inputs . role ) ;
92
92
} ) ;
93
+ test ( '[ignoreTriggers = true] update' , async ( ) => {
94
+ await sleep ( 3000 ) ;
95
+ inputs . ignoreTriggers = true ;
96
+ outputs = await scf . deploy ( inputs ) ;
97
+
98
+ // expect triggers result
99
+ expect ( outputs . Triggers ) . toEqual ( [ ] ) ;
100
+ } ) ;
93
101
test ( 'should remove Scf success' , async ( ) => {
94
102
const res = await scf . remove ( {
95
103
functionName : inputs . name ,
Original file line number Diff line number Diff line change @@ -508,6 +508,15 @@ describe('Scf', () => {
508
508
expect ( outputs . ClsTopicId ) . toBe ( '' ) ;
509
509
} ) ;
510
510
511
+ test ( '[ignoreTriggers = true] update' , async ( ) => {
512
+ await sleep ( 3000 ) ;
513
+ inputs . ignoreTriggers = true ;
514
+ outputs = await scf . deploy ( inputs ) ;
515
+
516
+ // expect triggers result
517
+ expect ( outputs . Triggers ) . toEqual ( [ ] ) ;
518
+ } ) ;
519
+
511
520
test ( 'remove' , async ( ) => {
512
521
const res = await scf . remove ( {
513
522
functionName : inputs . name ,
Original file line number Diff line number Diff line change @@ -231,6 +231,7 @@ export default class Scf {
231
231
async deploy ( inputs : ScfDeployInputs ) : Promise < ScfDeployOutputs > {
232
232
const namespace = inputs . namespace ?? CONFIGS . defaultNamespace ;
233
233
const functionName = inputs . name ;
234
+ const { ignoreTriggers = false } = inputs ;
234
235
235
236
// 在部署前,检查函数初始状态,如果初始为 CreateFailed,尝试先删除,再重新创建
236
237
let funcInfo = await this . scf . getInitialStatus ( { namespace, functionName } ) ;
@@ -327,8 +328,10 @@ export default class Scf {
327
328
}
328
329
329
330
// create/update/delete triggers
330
- if ( inputs . events ) {
331
+ if ( inputs . events && ! ignoreTriggers ) {
331
332
outputs . Triggers = await this . deployTrigger ( funcInfo ! , inputs ) ;
333
+ } else {
334
+ outputs . Triggers = [ ] ;
332
335
}
333
336
334
337
console . log ( `Deploy function ${ functionName } success.` ) ;
Original file line number Diff line number Diff line change @@ -179,6 +179,9 @@ export interface ScfDeployInputs extends ScfCreateFunctionInputs {
179
179
180
180
// FIXME: apigw event type
181
181
events ?: OriginTriggerType [ ] ;
182
+
183
+ // 是否忽略触发器操作流程
184
+ ignoreTriggers ?: boolean ;
182
185
}
183
186
184
187
export interface ScfDeployOutputs {
You can’t perform that action at this time.
0 commit comments