Skip to content

Commit 87fc9bb

Browse files
committed
remove unwanted code
1 parent df365d2 commit 87fc9bb

File tree

2 files changed

+1
-105
lines changed

2 files changed

+1
-105
lines changed

pkg/executor/WorkflowService.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ func (impl *WorkflowServiceImpl) populateReTriggerWorkflowTemplateWithInfraConfi
537537
historicalInfraConfig, err := impl.infraConfigAuditService.GetInfraConfigByWorkflowId(workflowRequest.ReferenceCiWorkflowId, bean.CI_WORKFLOW_TYPE.String())
538538
if err != nil {
539539
impl.Logger.Errorw("could not retrieve infra config from history, using current config", "referenceWorkflowId", workflowRequest.ReferenceCiWorkflowId, "err", err)
540-
return nil // Don't fail the workflow, just use current config
540+
return err
541541
}
542542

543543
if historicalInfraConfig == nil {

pkg/workflow/trigger/audit/repository/WorkflowConfigSnapshotRepository.go

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,7 @@ type WorkflowConfigSnapshot struct {
3636

3737
type WorkflowConfigSnapshotRepository interface {
3838
SaveWithTx(tx *pg.Tx, snapshot *WorkflowConfigSnapshot) (*WorkflowConfigSnapshot, error)
39-
UpdateWithTx(tx *pg.Tx, snapshot *WorkflowConfigSnapshot) error
40-
FindById(id int) (*WorkflowConfigSnapshot, error)
41-
FindByWorkflowIdAndType(workflowId int, workflowType types.WorkflowType) (*WorkflowConfigSnapshot, error)
42-
FindByPipelineId(pipelineId int, limit int, offset int) ([]*WorkflowConfigSnapshot, error)
43-
FindByAppId(appId int, limit int, offset int) ([]*WorkflowConfigSnapshot, error)
44-
FindLatestByPipelineIdAndType(pipelineId int, workflowType types.WorkflowType) (*WorkflowConfigSnapshot, error)
4539
// New methods for retrigger functionality
46-
FindLatestByWorkflowIdAndType(workflowId int, workflowType types.WorkflowType) (*WorkflowConfigSnapshot, error)
4740
FindLatestFailedWorkflowSnapshot(workflowId int, workflowType types.WorkflowType) (*WorkflowConfigSnapshot, error)
4841
sql.TransactionWrapper
4942
}
@@ -71,110 +64,13 @@ func (impl *WorkflowConfigSnapshotRepositoryImpl) SaveWithTx(tx *pg.Tx, snapshot
7164
return snapshot, nil
7265
}
7366

74-
func (impl *WorkflowConfigSnapshotRepositoryImpl) UpdateWithTx(tx *pg.Tx, snapshot *WorkflowConfigSnapshot) error {
75-
err := tx.Update(snapshot)
76-
if err != nil {
77-
impl.logger.Errorw("error in updating workflow config snapshot with tx", "err", err, "snapshot", snapshot)
78-
return err
79-
}
80-
return nil
81-
}
82-
83-
func (impl *WorkflowConfigSnapshotRepositoryImpl) FindById(id int) (*WorkflowConfigSnapshot, error) {
84-
snapshot := &WorkflowConfigSnapshot{}
85-
err := impl.dbConnection.Model(snapshot).
86-
Where("id = ?", id).
87-
Select()
88-
if err != nil {
89-
impl.logger.Errorw("error in finding workflow config snapshot by id", "err", err, "id", id)
90-
return snapshot, err
91-
}
92-
return snapshot, nil
93-
}
94-
95-
func (impl *WorkflowConfigSnapshotRepositoryImpl) FindByWorkflowIdAndType(workflowId int, workflowType types.WorkflowType) (*WorkflowConfigSnapshot, error) {
96-
snapshot := &WorkflowConfigSnapshot{}
97-
err := impl.dbConnection.Model(snapshot).
98-
Where("workflow_id = ?", workflowId).
99-
Where("workflow_type = ?", workflowType).
100-
Select()
101-
if err != nil {
102-
impl.logger.Errorw("error in finding workflow config snapshot by workflow id and type", "err", err, "workflowId", workflowId, "workflowType", workflowType)
103-
return snapshot, err
104-
}
105-
return snapshot, nil
106-
}
107-
108-
func (impl *WorkflowConfigSnapshotRepositoryImpl) FindByPipelineId(pipelineId int, limit int, offset int) ([]*WorkflowConfigSnapshot, error) {
109-
var snapshots []*WorkflowConfigSnapshot
110-
err := impl.dbConnection.Model(&snapshots).
111-
Where("pipeline_id = ?", pipelineId).
112-
Order("created_on DESC").
113-
Limit(limit).
114-
Offset(offset).
115-
Select()
116-
if err != nil {
117-
impl.logger.Errorw("error in finding workflow config snapshots by pipeline id", "err", err, "pipelineId", pipelineId)
118-
return snapshots, err
119-
}
120-
return snapshots, nil
121-
}
122-
123-
func (impl *WorkflowConfigSnapshotRepositoryImpl) FindByAppId(appId int, limit int, offset int) ([]*WorkflowConfigSnapshot, error) {
124-
var snapshots []*WorkflowConfigSnapshot
125-
err := impl.dbConnection.Model(&snapshots).
126-
Where("app_id = ?", appId).
127-
Order("created_on DESC").
128-
Limit(limit).
129-
Offset(offset).
130-
Select()
131-
if err != nil {
132-
impl.logger.Errorw("error in finding workflow config snapshots by app id", "err", err, "appId", appId)
133-
return snapshots, err
134-
}
135-
return snapshots, nil
136-
}
137-
138-
func (impl *WorkflowConfigSnapshotRepositoryImpl) FindLatestByPipelineIdAndType(pipelineId int, workflowType types.WorkflowType) (*WorkflowConfigSnapshot, error) {
139-
snapshot := &WorkflowConfigSnapshot{}
140-
err := impl.dbConnection.Model(snapshot).
141-
Where("pipeline_id = ?", pipelineId).
142-
Where("workflow_type = ?", workflowType).
143-
Order("created_on DESC").
144-
Limit(1).
145-
Select()
146-
if err != nil {
147-
impl.logger.Errorw("error in finding latest workflow config snapshot by pipeline id and type", "err", err, "pipelineId", pipelineId, "workflowType", workflowType)
148-
return snapshot, err
149-
}
150-
return snapshot, nil
151-
}
152-
153-
// FindLatestByWorkflowIdAndType finds the latest workflow config snapshot by workflow ID and type
154-
func (impl *WorkflowConfigSnapshotRepositoryImpl) FindLatestByWorkflowIdAndType(workflowId int, workflowType types.WorkflowType) (*WorkflowConfigSnapshot, error) {
155-
snapshot := &WorkflowConfigSnapshot{}
156-
err := impl.dbConnection.Model(snapshot).
157-
Where("workflow_id = ?", workflowId).
158-
Where("workflow_type = ?", workflowType).
159-
Order("created_on DESC").
160-
Limit(1).
161-
Select()
162-
if err != nil {
163-
impl.logger.Errorw("error in finding latest workflow config snapshot by workflow id and type", "err", err, "workflowId", workflowId, "workflowType", workflowType)
164-
return snapshot, err
165-
}
166-
return snapshot, nil
167-
}
168-
16967
// FindLatestFailedWorkflowSnapshot finds the latest failed workflow snapshot for retrigger
17068
// This method looks for the original workflow that failed, not the retrigger attempts
17169
func (impl *WorkflowConfigSnapshotRepositoryImpl) FindLatestFailedWorkflowSnapshot(workflowId int, workflowType types.WorkflowType) (*WorkflowConfigSnapshot, error) {
17270
snapshot := &WorkflowConfigSnapshot{}
17371
err := impl.dbConnection.Model(snapshot).
17472
Where("workflow_id = ?", workflowId).
17573
Where("workflow_type = ?", workflowType).
176-
//Order("created_on DESC").
177-
//Limit(1).
17874
Select()
17975
if err != nil {
18076
impl.logger.Errorw("error in finding latest failed workflow config snapshot", "err", err, "workflowId", workflowId, "workflowType", workflowType)

0 commit comments

Comments
 (0)