@@ -525,6 +525,8 @@ func (svc *Service) ExecuteDiceAutotestSceneStep(req apistructs.AutotestExecuteS
525525 apiTestStr = strings .ReplaceAll (apiTestStr , expression .OldLeftPlaceholder + expression .Params + "." + param .Name + expression .OldRightPlaceholder , expression .ReplaceRandomParams (param .Temp ))
526526 }
527527
528+ apiTestStr = svc .renderPreSceneStepsOutput (step .SceneID , apiTestStr )
529+
528530 for _ , conf := range configs .Data {
529531 switch conf .Key {
530532 case autotest .CmsCfgKeyAPIGlobalConfig :
@@ -596,6 +598,50 @@ func (svc *Service) ExecuteDiceAutotestSceneStep(req apistructs.AutotestExecuteS
596598 return & respData , nil
597599}
598600
601+ func (svc * Service ) renderPreSceneStepsOutput (sceneID uint64 , replaceYml string ) string {
602+ var pipelinePageListRequest = apistructs.PipelinePageListRequest {
603+ PageNum : 1 ,
604+ PageSize : 1 ,
605+ Sources : []apistructs.PipelineSource {
606+ apistructs .PipelineSourceAutoTest ,
607+ },
608+ YmlNames : []string {
609+ strconv .Itoa (int (sceneID )),
610+ },
611+ Statuses : []string {apistructs .PipelineStatusSuccess .String (), apistructs .PipelineStatusFailed .String ()},
612+ DescCols : []string {"id" },
613+ }
614+ pagePipeline , err := svc .bdl .PageListPipeline (pipelinePageListRequest )
615+ if err != nil {
616+ logrus .Errorf ("renderPreSceneStepsOutput, pageListPipeline error %v" , err )
617+ return replaceYml
618+ }
619+
620+ if pagePipeline == nil || len (pagePipeline .Pipelines ) <= 0 {
621+ return replaceYml
622+ }
623+
624+ pipeline , err := svc .bdl .GetPipeline (pagePipeline .Pipelines [0 ].ID )
625+ if err != nil {
626+ logrus .Errorf ("renderPreSceneStepsOutput, GetPipeline error %v" , err )
627+ return replaceYml
628+ }
629+
630+ if pipeline == nil {
631+ return replaceYml
632+ }
633+
634+ for _ , stage := range pipeline .PipelineStages {
635+ for _ , task := range stage .PipelineTasks {
636+ for _ , result := range task .Result .Metadata {
637+ replaceYml = strings .ReplaceAll (replaceYml , expression .GenOutputRef (task .Name , result .Name ), result .Value )
638+ }
639+ }
640+ }
641+
642+ return replaceYml
643+ }
644+
599645func (svc * Service ) SceneToYml (scene uint64 ) (string , error ) {
600646 sceneInputs , err := svc .ListAutoTestSceneInput (scene )
601647 if err != nil {
0 commit comments