@@ -333,7 +333,7 @@ func releaseMutex(ctx context.Context, db gorpmapper.SqlExecutorWithTx, store ca
333333 ORDER BY workflow_run.num ASC
334334 LIMIT 1
335335 `
336- waitingRunID , err := db .SelectInt (mutexQuery , workflowID , nodeName , string ( sdk .StatusWaiting ) )
336+ waitingRunID , err := db .SelectInt (mutexQuery , workflowID , nodeName , sdk .StatusWaiting )
337337 if err != nil && err != sql .ErrNoRows {
338338 err = sdk .WrapError (err , "unable to load mutex-locked workflow node run id" )
339339 ctx = sdk .ContextWithStacktrace (ctx , err )
@@ -427,7 +427,7 @@ func addJobsToQueue(ctx context.Context, db gorp.SqlExecutor, stage *sdk.Stage,
427427 }
428428
429429 _ , next = telemetry .Span (ctx , "workflow.getIntegrationPlugins" )
430- integrationPlugins , err := getIntegrationPlugins (db , wr , nr )
430+ integrationConfigs , integrationPlugins , err := getIntegrationPlugins (db , wr , nr )
431431 if err != nil {
432432 return report , sdk .WrapError (err , "unable to get integration plugins requirement" )
433433 }
@@ -468,7 +468,7 @@ jobLoop:
468468 }
469469
470470 _ , next = telemetry .Span (ctx , "workflow.processNodeJobRunRequirements" )
471- jobRequirements , containsService , wm , err := processNodeJobRunRequirements (ctx , db , * job , nr , sdk .Groups (groups ).ToIDs (), integrationPlugins )
471+ jobRequirements , containsService , wm , err := processNodeJobRunRequirements (ctx , db , * job , nr , sdk .Groups (groups ).ToIDs (), integrationPlugins , integrationConfigs )
472472 next ()
473473 if err != nil {
474474 spawnErrs .Join (* err )
@@ -577,25 +577,28 @@ jobLoop:
577577 return report , nil
578578}
579579
580- func getIntegrationPlugins (db gorp.SqlExecutor , wr * sdk.WorkflowRun , nr * sdk.WorkflowNodeRun ) ([]sdk.GRPCPlugin , error ) {
580+ func getIntegrationPlugins (db gorp.SqlExecutor , wr * sdk.WorkflowRun , nr * sdk.WorkflowNodeRun ) ([]sdk.IntegrationConfig , []sdk. GRPCPlugin , error ) {
581581 plugins := make ([]sdk.GRPCPlugin , 0 )
582- var projectIntegrationModelID int64
582+ mapConfig := make ([]sdk.IntegrationConfig , 0 )
583+
584+ var projectIntegration * sdk.ProjectIntegration
583585 node := wr .Workflow .WorkflowData .NodeByID (nr .WorkflowNodeID )
584586 if node != nil && node .Context != nil {
585587 if node .Context .ProjectIntegrationID != 0 {
586588 pp , has := wr .Workflow .ProjectIntegrations [node .Context .ProjectIntegrationID ]
587589 if has {
588- projectIntegrationModelID = pp . Model . ID
590+ projectIntegration = & pp
589591 }
590592 }
591593 }
592594
593- if projectIntegrationModelID > 0 {
594- plugin , err := plugin .LoadByIntegrationModelIDAndType (db , projectIntegrationModelID , sdk .GRPCPluginDeploymentIntegration )
595+ if projectIntegration != nil && projectIntegration .Model .ID > 0 {
596+ mapConfig = append (mapConfig , projectIntegration .Config )
597+ plg , err := plugin .LoadByIntegrationModelIDAndType (db , projectIntegration .Model .ID , sdk .GRPCPluginDeploymentIntegration )
595598 if err != nil {
596- return nil , sdk .NewErrorFrom (sdk .ErrNotFound , "Cannot find plugin for integration model id %d, %v" , projectIntegrationModelID , err )
599+ return nil , nil , sdk .NewErrorFrom (sdk .ErrNotFound , "Cannot find plugin for integration model id %d, %v" , projectIntegration . Model . ID , err )
597600 }
598- plugins = append (plugins , * plugin )
601+ plugins = append (plugins , * plg )
599602 }
600603
601604 var artifactManagerInteg * sdk.WorkflowProjectIntegration
@@ -605,9 +608,10 @@ func getIntegrationPlugins(db gorp.SqlExecutor, wr *sdk.WorkflowRun, nr *sdk.Wor
605608 }
606609 }
607610 if artifactManagerInteg != nil {
611+ mapConfig = append (mapConfig , artifactManagerInteg .Config )
608612 plgs , err := plugin .LoadAllByIntegrationModelID (db , artifactManagerInteg .ProjectIntegration .Model .ID )
609613 if err != nil {
610- return nil , sdk .NewErrorFrom (sdk .ErrNotFound , "Cannot find plugin for integration model id %d, %v" , projectIntegrationModelID , err )
614+ return nil , nil , sdk .NewErrorFrom (sdk .ErrNotFound , "Cannot find plugin for integration model id %d, %v" , artifactManagerInteg . ProjectIntegration . Model . ID , err )
611615 }
612616 platform := artifactManagerInteg .ProjectIntegration .Config [sdk .ArtifactManagerConfigPlatform ]
613617 for _ , plg := range plgs {
@@ -617,7 +621,7 @@ func getIntegrationPlugins(db gorp.SqlExecutor, wr *sdk.WorkflowRun, nr *sdk.Wor
617621 }
618622 }
619623
620- return plugins , nil
624+ return mapConfig , plugins , nil
621625}
622626
623627func getExecutablesGroups (wr * sdk.WorkflowRun , nr * sdk.WorkflowNodeRun ) ([]sdk.Group , error ) {
@@ -721,7 +725,7 @@ func syncStage(ctx context.Context, db gorp.SqlExecutor, store cache.Store, stag
721725
722726// NodeBuildParametersFromRun return build parameters from previous workflow run
723727func NodeBuildParametersFromRun (wr sdk.WorkflowRun , id int64 ) ([]sdk.Parameter , error ) {
724- params := []sdk.Parameter {}
728+ params := make ( []sdk.Parameter , 0 )
725729
726730 nodesRun , ok := wr .WorkflowNodeRuns [id ]
727731 if ! ok || len (nodesRun ) == 0 {
0 commit comments