Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions pkg/pipeline/CiCdPipelineOrchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1442,14 +1442,16 @@ func (impl CiCdPipelineOrchestratorImpl) CreateMaterials(createMaterialRequest *
}
materials = append(materials, inputMaterial)
}
err = impl.addRepositoryToGitSensor(materials, "")
// moving transaction before addRepositoryToGitSensor as commiting transaction after addRepositoryToGitSensor was causing problems
// 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.
err = impl.transactionManager.CommitTx(tx)
if err != nil {
impl.logger.Errorw("error in updating to sensor", "err", err)
impl.logger.Errorw("error in committing tx Create material", "err", err, "materials", materials)
return nil, err
}
err = impl.transactionManager.CommitTx(tx)
err = impl.addRepositoryToGitSensor(materials, "")
if err != nil {
impl.logger.Errorw("error in committing tx Create material", "err", err, "materials", materials)
impl.logger.Errorw("error in updating to sensor", "err", err)
return nil, err
}
impl.logger.Debugw("all materials are ", "materials", materials)
Expand All @@ -1467,18 +1469,18 @@ func (impl CiCdPipelineOrchestratorImpl) UpdateMaterial(updateMaterialDTO *bean.
impl.logger.Errorw("err", "err", err)
return nil, err
}
err = impl.transactionManager.CommitTx(tx)
if err != nil {
impl.logger.Errorw("error in committing tx Create material", "err", err)
return nil, err
}

err = impl.updateRepositoryToGitSensor(updatedMaterial, "",
updateMaterialDTO.Material.CreateBackup)
if err != nil {
impl.logger.Errorw("error in updating to git-sensor", "err", err)
return nil, err
}
err = impl.transactionManager.CommitTx(tx)
if err != nil {
impl.logger.Errorw("error in committing tx Update material", "err", err)
return nil, err
}
return updateMaterialDTO, nil
}

Expand Down
2 changes: 1 addition & 1 deletion wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading