11import { IAction , IActionLevel , IActionType , IAllowFailure , IComponentAction , IHookType , IPluginAction , IRunAction , getInputs } from '@serverless-devs/parse-spec' ;
2- import { isEmpty , filter , includes , set , get } from 'lodash' ;
2+ import { isEmpty , filter , includes , set , get , cloneDeep } from 'lodash' ;
33import * as utils from '@serverless-devs/utils' ;
44import { DevsError , ETrackerType } from '@serverless-devs/utils' ;
55import fs from 'fs-extra' ;
@@ -23,6 +23,7 @@ interface IRecord {
2323 allowFailure : boolean | IAllowFailure ; // step allow_failure > action allow_failure
2424 command : string ; // 记录当前执行的command
2525 startTime : number ; // 记录开始时间
26+ replaceOutput : boolean ;
2627}
2728
2829interface IOptions {
@@ -248,6 +249,10 @@ You can still use them now, but we suggest to modify them.`)
248249 const inputs = isEmpty ( this . record . pluginOutput ) ? this . inputs : this . record . pluginOutput ;
249250 // Execute the plugin with the determined inputs and provided arguments.
250251 this . record . pluginOutput = await instance ( inputs , hook . args , this . logger ) ;
252+ // If prop 'replace_output' is true, replace the record's step output with the plugin output.
253+ if ( hook . replace_output ) {
254+ this . record . step . output = cloneDeep ( this . record . pluginOutput ) ;
255+ }
251256 } catch ( e ) {
252257 const error = e as Error ;
253258 // Check if the failure is allowed based on the record's allowFailure setting.
0 commit comments