@@ -77,11 +77,26 @@ func makeDataSourcePipelinePlanV200(
7777) (coreModels.PipelinePlan , errors.Error ) {
7878 plan := make (coreModels.PipelinePlan , len (scopeDetails ))
7979 for i , scopeDetail := range scopeDetails {
80- repo , scopeConfig := scopeDetail .Scope , scopeDetail .ScopeConfig
80+ bitbucketRepo , scopeConfig := scopeDetail .Scope , scopeDetail .ScopeConfig
8181 stage := plan [i ]
8282 if stage == nil {
8383 stage = coreModels.PipelineStage {}
8484 }
85+ task , err := helper .MakePipelinePlanTask (
86+ "bitbucket_server" ,
87+ subtaskMetas ,
88+ scopeConfig .Entities ,
89+ tasks.BitbucketServerOptions {
90+ ConnectionId : bitbucketRepo .ConnectionId ,
91+ FullName : bitbucketRepo .BitbucketId ,
92+ },
93+ )
94+ if err != nil {
95+ return nil , err
96+ }
97+
98+ stage = append (stage , task )
99+
85100 // refdiff
86101 if scopeConfig != nil && scopeConfig .Refdiff != nil {
87102 // add a new task to next stage
@@ -90,7 +105,7 @@ func makeDataSourcePipelinePlanV200(
90105 plan = append (plan , nil )
91106 }
92107 refdiffOp := scopeConfig .Refdiff
93- refdiffOp ["repoId" ] = didgen .NewDomainIdGenerator (& models.BitbucketServerRepo {}).Generate (connection .ID , repo .BitbucketId )
108+ refdiffOp ["repoId" ] = didgen .NewDomainIdGenerator (& models.BitbucketServerRepo {}).Generate (connection .ID , bitbucketRepo .BitbucketId )
94109 plan [j ] = coreModels.PipelineStage {
95110 {
96111 Plugin : "refdiff" ,
@@ -99,44 +114,21 @@ func makeDataSourcePipelinePlanV200(
99114 }
100115 scopeConfig .Refdiff = nil
101116 }
102-
103- // construct task options for bitbucket
104- op := & tasks.BitbucketServerOptions {
105- ConnectionId : repo .ConnectionId ,
106- FullName : repo .BitbucketId ,
107- }
108- options , err := tasks .EncodeTaskOptions (op )
109- if err != nil {
110- return nil , err
111- }
112-
113- subtasks , err := helper .MakePipelinePlanSubtasks (subtaskMetas , scopeConfig .Entities )
114- if err != nil {
115- return nil , err
116- }
117- stage = append (stage , & coreModels.PipelineTask {
118- Plugin : "bitbucket_server" ,
119- Subtasks : subtasks ,
120- Options : options ,
121- })
122- if err != nil {
123- return nil , err
124- }
125-
126117 // add gitex stage
127118 if utils .StringsContains (scopeConfig .Entities , plugin .DOMAIN_TYPE_CODE ) {
128- cloneUrl , err := errors .Convert01 (url .Parse (repo .CloneUrl ))
119+ cloneUrl , err := errors .Convert01 (url .Parse (bitbucketRepo .CloneUrl ))
129120 if err != nil {
130121 return nil , err
131122 }
132123 cloneUrl .User = url .UserPassword (connection .Username , connection .Password )
133124 stage = append (stage , & coreModels.PipelineTask {
134125 Plugin : "gitextractor" ,
135126 Options : map [string ]interface {}{
136- "url" : cloneUrl .String (),
137- "name" : repo .BitbucketId ,
138- "repoId" : didgen .NewDomainIdGenerator (& models.BitbucketServerRepo {}).Generate (connection .ID , repo .BitbucketId ),
139- "proxy" : connection .Proxy ,
127+ "url" : cloneUrl .String (),
128+ "name" : bitbucketRepo .BitbucketId ,
129+ "fullName" : bitbucketRepo .BitbucketId ,
130+ "repoId" : didgen .NewDomainIdGenerator (& models.BitbucketServerRepo {}).Generate (connection .ID , bitbucketRepo .BitbucketId ),
131+ "proxy" : connection .Proxy ,
140132 },
141133 })
142134
0 commit comments