@@ -40,9 +40,6 @@ import (
40
40
type AppArtifactManager interface {
41
41
RetrieveArtifactsByCDPipelineV2 (pipeline * pipelineConfig.Pipeline , stage bean.WorkflowType , artifactListingFilterOpts * bean.ArtifactsListFilterOptions ) (* bean2.CiArtifactResponse , error )
42
42
43
- //FetchArtifactForRollback :
44
- FetchArtifactForRollback (cdPipelineId , appId , offset , limit int , searchString string ) (bean2.CiArtifactResponse , error )
45
-
46
43
FetchArtifactForRollbackV2 (cdPipelineId , appId , offset , limit int , searchString string , app * bean2.CreateAppDTO , deploymentPipeline * pipelineConfig.Pipeline ) (bean2.CiArtifactResponse , error )
47
44
48
45
BuildArtifactsForCdStage (pipelineId int , stageType bean.WorkflowType , ciArtifacts []bean2.CiArtifactBean , artifactMap map [int ]int , parent bool , limit int , parentCdId int ) ([]bean2.CiArtifactBean , map [int ]int , int , string , error )
@@ -212,83 +209,6 @@ func (impl *AppArtifactManagerImpl) BuildArtifactsForCIParent(cdPipelineId int,
212
209
return ciArtifacts , nil
213
210
}
214
211
215
- func (impl * AppArtifactManagerImpl ) FetchArtifactForRollback (cdPipelineId , appId , offset , limit int , searchString string ) (bean2.CiArtifactResponse , error ) {
216
- var deployedCiArtifacts []bean2.CiArtifactBean
217
- var deployedCiArtifactsResponse bean2.CiArtifactResponse
218
-
219
- cdWfrs , err := impl .cdWorkflowRepository .FetchArtifactsByCdPipelineId (cdPipelineId , bean .CD_WORKFLOW_TYPE_DEPLOY , offset , limit , searchString )
220
- if err != nil {
221
- impl .logger .Errorw ("error in getting artifacts for rollback by cdPipelineId" , "err" , err , "cdPipelineId" , cdPipelineId )
222
- return deployedCiArtifactsResponse , err
223
- }
224
- var ids []int32
225
- for _ , item := range cdWfrs {
226
- ids = append (ids , item .TriggeredBy )
227
- }
228
- userEmails := make (map [int32 ]string )
229
- users , err := impl .userService .GetByIds (ids )
230
- if err != nil {
231
- impl .logger .Errorw ("unable to fetch users by ids" , "err" , err , "ids" , ids )
232
- }
233
- for _ , item := range users {
234
- userEmails [item .Id ] = item .EmailId
235
- }
236
-
237
- imageTagsDataMap , err := impl .imageTaggingService .GetTagsDataMapByAppId (appId )
238
- if err != nil {
239
- impl .logger .Errorw ("error in getting image tagging data with appId" , "err" , err , "appId" , appId )
240
- return deployedCiArtifactsResponse , err
241
- }
242
- artifactIds := make ([]int , 0 )
243
-
244
- for _ , cdWfr := range cdWfrs {
245
- ciArtifact := & repository.CiArtifact {}
246
- if cdWfr .CdWorkflow != nil && cdWfr .CdWorkflow .CiArtifact != nil {
247
- ciArtifact = cdWfr .CdWorkflow .CiArtifact
248
- }
249
- if ciArtifact == nil {
250
- continue
251
- }
252
- mInfo , err := parseMaterialInfo ([]byte (ciArtifact .MaterialInfo ), ciArtifact .DataSource )
253
- if err != nil {
254
- mInfo = []byte ("[]" )
255
- impl .logger .Errorw ("error in parsing ciArtifact material info" , "err" , err , "ciArtifact" , ciArtifact )
256
- }
257
- userEmail := userEmails [cdWfr .TriggeredBy ]
258
- deployedCiArtifacts = append (deployedCiArtifacts , bean2.CiArtifactBean {
259
- Id : ciArtifact .Id ,
260
- Image : ciArtifact .Image ,
261
- MaterialInfo : mInfo ,
262
- DeployedTime : formatDate (cdWfr .StartedOn , bean2 .LayoutRFC3339 ),
263
- WfrId : cdWfr .Id ,
264
- DeployedBy : userEmail ,
265
- })
266
- artifactIds = append (artifactIds , ciArtifact .Id )
267
- }
268
- imageCommentsDataMap , err := impl .imageTaggingService .GetImageCommentsDataMapByArtifactIds (artifactIds )
269
- if err != nil {
270
- impl .logger .Errorw ("error in getting GetImageCommentsDataMapByArtifactIds" , "err" , err , "appId" , appId , "artifactIds" , artifactIds )
271
- return deployedCiArtifactsResponse , err
272
- }
273
-
274
- for i , _ := range deployedCiArtifacts {
275
- if imageTaggingResp := imageTagsDataMap [deployedCiArtifacts [i ].Id ]; imageTaggingResp != nil {
276
- deployedCiArtifacts [i ].ImageReleaseTags = imageTaggingResp
277
- }
278
- if imageCommentResp := imageCommentsDataMap [deployedCiArtifacts [i ].Id ]; imageCommentResp != nil {
279
- deployedCiArtifacts [i ].ImageComment = imageCommentResp
280
- }
281
- }
282
-
283
- deployedCiArtifactsResponse .CdPipelineId = cdPipelineId
284
- if deployedCiArtifacts == nil {
285
- deployedCiArtifacts = []bean2.CiArtifactBean {}
286
- }
287
- deployedCiArtifactsResponse .CiArtifacts = deployedCiArtifacts
288
-
289
- return deployedCiArtifactsResponse , nil
290
- }
291
-
292
212
func (impl * AppArtifactManagerImpl ) FetchArtifactForRollbackV2 (cdPipelineId , appId , offset , limit int , searchString string , app * bean2.CreateAppDTO , deploymentPipeline * pipelineConfig.Pipeline ) (bean2.CiArtifactResponse , error ) {
293
213
var deployedCiArtifactsResponse bean2.CiArtifactResponse
294
214
imageTagsDataMap , err := impl .imageTaggingService .GetTagsDataMapByAppId (appId )
0 commit comments