Skip to content

Commit d72c637

Browse files
Merge pull request #6527 from devtron-labs/main-sync-develop-21apr
sync: Main sync develop
2 parents 8e3952a + e8b7116 commit d72c637

File tree

3 files changed

+67
-27
lines changed

3 files changed

+67
-27
lines changed

pkg/pipeline/CiCdPipelineOrchestrator.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,14 +1442,16 @@ func (impl CiCdPipelineOrchestratorImpl) CreateMaterials(createMaterialRequest *
14421442
}
14431443
materials = append(materials, inputMaterial)
14441444
}
1445-
err = impl.addRepositoryToGitSensor(materials, "")
1445+
// moving transaction before addRepositoryToGitSensor as commiting transaction after addRepositoryToGitSensor was causing problems
1446+
// in case request was cancelled data was getting saved in git sensor but not getting saved in orchestrator db. Same is done in update flow.
1447+
err = impl.transactionManager.CommitTx(tx)
14461448
if err != nil {
1447-
impl.logger.Errorw("error in updating to sensor", "err", err)
1449+
impl.logger.Errorw("error in committing tx Create material", "err", err, "materials", materials)
14481450
return nil, err
14491451
}
1450-
err = impl.transactionManager.CommitTx(tx)
1452+
err = impl.addRepositoryToGitSensor(materials, "")
14511453
if err != nil {
1452-
impl.logger.Errorw("error in committing tx Create material", "err", err, "materials", materials)
1454+
impl.logger.Errorw("error in updating to sensor", "err", err)
14531455
return nil, err
14541456
}
14551457
impl.logger.Debugw("all materials are ", "materials", materials)
@@ -1467,18 +1469,18 @@ func (impl CiCdPipelineOrchestratorImpl) UpdateMaterial(updateMaterialDTO *bean.
14671469
impl.logger.Errorw("err", "err", err)
14681470
return nil, err
14691471
}
1472+
err = impl.transactionManager.CommitTx(tx)
1473+
if err != nil {
1474+
impl.logger.Errorw("error in committing tx Create material", "err", err)
1475+
return nil, err
1476+
}
14701477

14711478
err = impl.updateRepositoryToGitSensor(updatedMaterial, "",
14721479
updateMaterialDTO.Material.CreateBackup)
14731480
if err != nil {
14741481
impl.logger.Errorw("error in updating to git-sensor", "err", err)
14751482
return nil, err
14761483
}
1477-
err = impl.transactionManager.CommitTx(tx)
1478-
if err != nil {
1479-
impl.logger.Errorw("error in committing tx Update material", "err", err)
1480-
return nil, err
1481-
}
14821484
return updateMaterialDTO, nil
14831485
}
14841486

vendor/github.com/devtron-labs/common-lib/blob-storage/AwsS3Blob.go

Lines changed: 41 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/devtron-labs/common-lib/blob-storage/BlobUtils.go

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)