Skip to content

Commit d950ee2

Browse files
committed
fix: use current revision as change revision when no previous change revision is known and there is no change in the app.
Signed-off-by: Eugene Doudine <[email protected]>
1 parent a6854b7 commit d950ee2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

mrp_controller/service/mrp_service.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ func (c *mrpService) makeChangeRevisionPatch(ctx context.Context, logCtx *log.En
150150
"previousRevision": r.previousRevision,
151151
}).Debugf("processing source")
152152
patchGitRevisions[idx] = r.currentRevision
153+
154+
// new change revision to be set in the annotation
153155
// keep current change revision if there is no new value calculated
154156
patchChangeRevisions[idx] = r.changeRevision
155157

@@ -172,9 +174,14 @@ func (c *mrpService) makeChangeRevisionPatch(ctx context.Context, logCtx *log.En
172174
sourceLogCtx.Errorf("Failed to calculate revision: %v", err)
173175
continue
174176
}
175-
sourceLogCtx.Infof("New change revision for source is '%s'", *newChangeRevision)
177+
sourceLogCtx.Infof("calculated change revision is '%s'", *newChangeRevision)
176178
if newChangeRevision == nil || *newChangeRevision == "" {
177-
sourceLogCtx.Infof("no new changes found, keeping existing change revision")
179+
if r.changeRevision == "" {
180+
sourceLogCtx.Infof("no change revision found, defaulting to current revision")
181+
patchChangeRevisions[idx] = r.currentRevision
182+
} else {
183+
sourceLogCtx.Infof("no new change revision found, keeping existing change revision")
184+
}
178185
} else if patchChangeRevisions[idx] == *newChangeRevision {
179186
sourceLogCtx.Infof("ChangeRevision has not changed")
180187
} else {

0 commit comments

Comments
 (0)