Skip to content

Commit

Permalink
feat: update revision for path should not affect sync (#350)
Browse files Browse the repository at this point in the history
* feat: not throw error in case if update revision for path failed

* feat: not throw error in case if update revision for path failed

* feat: not throw error in case if update revision for path failed
  • Loading branch information
pasha-codefresh authored Oct 28, 2024
1 parent 84c0317 commit 6d5788d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions controller/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ func (m *appStateManager) GetRepoObjs(app *v1alpha1.Application, sources []v1alp

keyManifestGenerateAnnotationVal, keyManifestGenerateAnnotationExists := app.Annotations[v1alpha1.AnnotationKeyManifestGeneratePaths]

logCtx := log.WithField("application", app.QualifiedName())

for i, source := range sources {
if len(revisions) < len(sources) || revisions[i] == "" {
revisions[i] = source.TargetRevision
Expand Down Expand Up @@ -233,15 +235,18 @@ func (m *appStateManager) GetRepoObjs(app *v1alpha1.Application, sources []v1alp
HasMultipleSources: app.Spec.HasMultipleSources(),
})
if err != nil {
return nil, nil, false, fmt.Errorf("failed to compare revisions for source %d of %d: %w", i+1, len(sources), err)
}
if updateRevisionResult.Changes {
revisionUpdated = true
logCtx.Warnf("failed to generate manifest for source %d of %d: %v", i+1, len(sources), err)
}

// Generate manifests should use same revision as updateRevisionForPaths, because HEAD revision may be different between these two calls
if updateRevisionResult.Revision != "" {
revision = updateRevisionResult.Revision
if updateRevisionResult != nil {
if updateRevisionResult.Changes {
revisionUpdated = true
}

// Generate manifests should use same revision as updateRevisionForPaths, because HEAD revision may be different between these two calls
if updateRevisionResult.Revision != "" {
revision = updateRevisionResult.Revision
}
}
} else {
// revisionUpdated is set to true if at least one revision is not possible to be updated,
Expand Down Expand Up @@ -287,7 +292,7 @@ func (m *appStateManager) GetRepoObjs(app *v1alpha1.Application, sources []v1alp
}

ts.AddCheckpoint("unmarshal_ms")
logCtx := log.WithField("application", app.QualifiedName())

for k, v := range ts.Timings() {
logCtx = logCtx.WithField(k, v.Milliseconds())
}
Expand Down

0 comments on commit 6d5788d

Please sign in to comment.