@@ -37,7 +37,7 @@ type StageExecutorImpl struct {
37
37
}
38
38
39
39
type StageExecutor interface {
40
- RunCiCdSteps (stepType helper.StepType , ciCdRequest * helper.CommonWorkflowRequest , steps []* helper.StepObject , refStageMap map [int ][]* helper.StepObject , scriptEnvVariables * util2.ScriptEnvVariables , preCiStageVariable map [int ]map [string ]* commonBean.VariableObject ) (pluginArtifacts * helper.PluginArtifacts , outVars map [int ]map [string ]* commonBean.VariableObject , failedStep * helper.StepObject , err error )
40
+ RunCiCdSteps (stepType helper.StepType , ciCdRequest * helper.CommonWorkflowRequest , steps []* helper.StepObject , refStageMap map [int ][]* helper.StepObject , scriptEnvVariables * util2.ScriptEnvVariables , preCiStageVariable map [int ]map [string ]* commonBean.VariableObject , resetEnvVariable bool ) (pluginArtifacts * helper.PluginArtifacts , outVars map [int ]map [string ]* commonBean.VariableObject , failedStep * helper.StepObject , err error )
41
41
RunCdStageTasks (ciContext cictx.CiContext , tasks []* helper.Task , scriptEnvVariables * util2.ScriptEnvVariables , stageType helper.PipelineType ) error
42
42
}
43
43
@@ -48,7 +48,7 @@ func NewStageExecutorImpl(cmdExecutor helper.CommandExecutor, scriptExecutor Scr
48
48
}
49
49
}
50
50
51
- func (impl * StageExecutorImpl ) RunCiCdSteps (stepType helper.StepType , ciCdRequest * helper.CommonWorkflowRequest , steps []* helper.StepObject , refStageMap map [int ][]* helper.StepObject , scriptEnvVariables * util2.ScriptEnvVariables , preCiStageVariable map [int ]map [string ]* commonBean.VariableObject ) (* helper.PluginArtifacts , map [int ]map [string ]* commonBean.VariableObject , * helper.StepObject , error ) {
51
+ func (impl * StageExecutorImpl ) RunCiCdSteps (stepType helper.StepType , ciCdRequest * helper.CommonWorkflowRequest , steps []* helper.StepObject , refStageMap map [int ][]* helper.StepObject , scriptEnvVariables * util2.ScriptEnvVariables , preCiStageVariable map [int ]map [string ]* commonBean.VariableObject , resetEnvVariable bool ) (* helper.PluginArtifacts , map [int ]map [string ]* commonBean.VariableObject , * helper.StepObject , error ) {
52
52
/*if stageType == STEP_TYPE_POST {
53
53
postCiStageVariable = make(map[int]map[string]*VariableObject) // [stepId]name[]value
54
54
}*/
@@ -65,7 +65,7 @@ func (impl *StageExecutorImpl) RunCiCdSteps(stepType helper.StepType, ciCdReques
65
65
)
66
66
67
67
executeStep := func () error {
68
- refPluginArtifacts , failedStep , err = impl .RunCiCdStep (stepType , * ciCdRequest , i , step , refStageMap , scriptEnvVariables , preCiStageVariable , stageVariable )
68
+ refPluginArtifacts , failedStep , err = impl .RunCiCdStep (stepType , * ciCdRequest , i , step , refStageMap , scriptEnvVariables , preCiStageVariable , stageVariable , resetEnvVariable )
69
69
if err != nil {
70
70
return err
71
71
}
@@ -140,7 +140,7 @@ func getScriptVariables(step *helper.StepObject, scriptEnvVariables *util2.Scrip
140
140
141
141
func (impl * StageExecutorImpl ) RunCiCdStep (stepType helper.StepType , ciCdRequest helper.CommonWorkflowRequest , index int , step * helper.StepObject ,
142
142
refStageMap map [int ][]* helper.StepObject , scriptEnvVariables * util2.ScriptEnvVariables , preCiStageVariable map [int ]map [string ]* commonBean.VariableObject ,
143
- stageVariable map [int ]map [string ]* commonBean.VariableObject ) (artifacts * helper.PluginArtifacts , failedStep * helper.StepObject , err error ) {
143
+ stageVariable map [int ]map [string ]* commonBean.VariableObject , resetEnvVariable bool ) (artifacts * helper.PluginArtifacts , failedStep * helper.StepObject , err error ) {
144
144
var vars []* commonBean.VariableObject
145
145
if stepType == helper .STEP_TYPE_REF_PLUGIN {
146
146
vars , err = deduceVariables (step .InputVars , scriptEnvVariables , nil , nil , stageVariable )
@@ -317,7 +317,7 @@ func (impl *StageExecutorImpl) RunCiCdStep(stepType helper.StepType, ciCdRequest
317
317
}
318
318
}
319
319
}
320
- refPluginArtifacts , opt , _ , err := impl .RunCiCdSteps (helper .STEP_TYPE_REF_PLUGIN , & ciCdRequest , steps , refStageMap , scriptEnvVariables , nil )
320
+ refPluginArtifacts , opt , _ , err := impl .RunCiCdSteps (helper .STEP_TYPE_REF_PLUGIN , & ciCdRequest , steps , refStageMap , scriptEnvVariables , nil , false )
321
321
if err != nil {
322
322
fmt .Println (err )
323
323
return nil , step , err
@@ -358,6 +358,10 @@ func (impl *StageExecutorImpl) RunCiCdStep(stepType helper.StepType, ciCdRequest
358
358
finalOutVarMap [out .Name ] = out
359
359
}
360
360
stageVariable [step .Index ] = finalOutVarMap
361
+ // TODO Prakhar: test and restructure
362
+ if resetEnvVariable {
363
+ scriptEnvVariables = scriptEnvVariables .ResetExistingScriptEnv ()
364
+ }
361
365
return pluginArtifacts , nil , nil
362
366
}
363
367
0 commit comments