-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: revisions info reporting with multi-sourced apps support #333
feat: revisions info reporting with multi-sourced apps support #333
Conversation
1113941
to
0b50690
Compare
…rt multisourced apps
0b50690
to
37f5a05
Compare
…"app.meta.revisions-metadata"
…R-23842-revisions-info-reporting
…tions - app.meta.revisions-metadata
…etadata, report only revision in case of helm chart
} | ||
} | ||
|
||
if a.Source != nil { // single source app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please just check if app has source and return this source, otherwise execute logic after.
It is impossible that app will not have source at all
event_reporter/utils/app_revision.go
Outdated
// for monorepo support: list with revisions where actual changes to source directory were committed | ||
func GetOperationChangeRevisions(a *appv1.Application) []string { | ||
var revisions []string | ||
if a != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please check if app is nil then return empty array, it will not have so much embedded conditions
event_reporter/utils/app_revision.go
Outdated
@@ -46,6 +63,64 @@ func GetOperationRevision(a *appv1.Application) string { | |||
return revision | |||
} | |||
|
|||
func GetOperationSyncRevisions(a *appv1.Application) []string { | |||
var revisions []string | |||
if a != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
event_reporter/utils/app_revision.go
Outdated
Revisions: a.Status.OperationState.Operation.Sync.ChangeRevisions, | ||
}) | ||
} | ||
} else if a.Operation != nil && a.Operation.Sync != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will rid of idea to put it on operation level, we will just persist it on status
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's just as a fallback so can leave ATM
17a0ef3
to
893fbcd
Compare
893fbcd
to
9bc3265
Compare
…R-23842-revisions-info-reporting
…esh-io/argo-cd into CR-23842-revisions-info-reporting
|
||
for idx, revision := range revisions { | ||
// report just revision for helm sources | ||
if (a.Spec.HasMultipleSources() && a.Spec.Sources[idx].IsHelm()) || (a.Spec.Source != nil && a.Spec.Source.IsHelm()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this condition into dedicated types . Make it a.Spec.IsHelm(idx)
if err == nil && operationSyncRevisionsMetadata != nil { | ||
result.SyncRevisions = operationSyncRevisionsMetadata | ||
} | ||
// latest revision of repository where changes to app resource were actually made; empty if no changeRevisionі present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
u = utils.AddCommitDetailsToLabels(u, originalAppRevisionMetadata) | ||
if originalAppRevisionsMetadata != nil { | ||
u = utils.AddCommitsDetailsToAnnotations(u, originalAppRevisionsMetadata) | ||
if originalApplication != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imho it is redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
event_reporter/utils/app_revision.go
Outdated
@@ -46,6 +63,70 @@ func GetOperationRevision(a *appv1.Application) string { | |||
return revision | |||
} | |||
|
|||
func GetOperationSyncRevisions(a *appv1.Application) []string { | |||
var revisions []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is redundant variable, you can remove it
… func a.Spec.IsHelmSource(idx), removed legacy code
…esh-io/argo-cd into CR-23842-revisions-info-reporting
…DetailsToAnnotations, AddCommitsDetailsToAppAnnotations, getRevisions, getOperationSyncRevisions
…ionServiceClient.RevisionMetadata in order to properly support multisourced apps
c3aa11f
to
09fddac
Compare
…R-23842-revisions-info-reporting # Conflicts: # changelog/CHANGELOG.md
…s to labels as new runtimes should work on old on-prem versions
Checklist: