-
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(event-reporter): multi-sourced apps - resource git details reporting #352
base: release-2.12
Are you sure you want to change the base?
feat(event-reporter): multi-sourced apps - resource git details reporting #352
Conversation
…kingMetadata to pass data between methods
…EntityParentApp to pass data between methods
…Resource to pass data between methods, created new methods to group logic inside getResourceEventPayload
…onSyncRevisions, destServer, destName, appMultiSourced
…s SourcePositions, Revisions for GetManifests request
…sion for multi-sourced applications based on sync result revisions
…R-23668-multisource-details-reporting # Conflicts: # event_reporter/reporter/application_event_reporter.go # event_reporter/reporter/event_payload.go # event_reporter/reporter/types.go
…ce index to which this resource belongs. Also updated logic of retrieving correct git commit info based on AppSourceIdx
event_reporter/application/client.go
Outdated
@@ -126,6 +126,16 @@ func (c *httpApplicationClient) GetManifests(ctx context.Context, in *appclient. | |||
if in.Revision != nil { | |||
params = fmt.Sprintf("%s&revision=%s", params, *in.Revision) | |||
} | |||
if in.SourcePositions != nil && len(in.SourcePositions) > 0 { | |||
for _, sourcePosition := range in.SourcePositions { | |||
params = fmt.Sprintf("%s&sourcePositions=%s", params, sourcePosition) |
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.
you have linter issues here
event_reporter/utils/app_revision.go
Outdated
|
||
// this value will be used in case if application hasn't resources , like gitsource | ||
revisions := a.Status.Sync.Revisions | ||
if a.Status.OperationState != nil && a.Status.OperationState.Operation.Sync != nil && a.Status.OperationState.Operation.Sync.Revisions != nil && len(a.Status.OperationState.Operation.Sync.Revisions) > 0 { |
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.
lets change to if -> return, and tbh i would move these if condition to some function, it is just very hard to read, i would move it to our custom types that we created before
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.
moved to separate func
@@ -65,14 +72,38 @@ func GetOperationRevision(a *appv1.Application) string { | |||
return revision | |||
} | |||
|
|||
func GetOperationStateRevision(a *appv1.Application) *string { | |||
func GetOperationRevisions(a *appv1.Application) []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.
also cover with basic test
if a == nil || a.Status.OperationState == nil || a.Status.OperationState.SyncResult == nil { | ||
return nil | ||
} | ||
|
||
return &a.Status.OperationState.SyncResult.Revision | ||
} | ||
|
||
func GetOperationSyncResultRevisions(a *appv1.Application) *[]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.
some basic unit test
reposerver/repository/repository.go
Outdated
@@ -1812,21 +1812,18 @@ var manifestFile = regexp.MustCompile(`^.*\.(yaml|yml|json|jsonnet)$`) | |||
|
|||
// findManifests looks at all yaml files in a directory and unmarshals them into a list of unstructured objects | |||
func findManifests(logCtx *log.Entry, appPath string, repoRoot string, env *v1alpha1.Env, directory v1alpha1.ApplicationSourceDirectory, enabledManifestGeneration map[string]bool, maxCombinedManifestQuantity resource.Quantity) ([]manifest, error) { | |||
absRepoRoot, err := filepath.Abs(repoRoot) |
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.
why you changed it?
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 just moved this line below, to have our changes in one place (will simplify new upstream version merging)
@@ -574,6 +574,7 @@ func (s *Server) GetManifests(ctx context.Context, q *application.ApplicationMan | |||
manifestInfo.Manifests[i].CompiledManifest = string(data) | |||
} | |||
} | |||
manifests.SourcesManifestsStartingIdx = append(manifests.SourcesManifestsStartingIdx, int32(len(manifests.Manifests))) |
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.
why you need this field? should we push it to OSS ?
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 need it to be able to report correct repo url, etc. for multi-sourced apps
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 this info is useful for OSS also
39ee73d
to
b348e9a
Compare
69451f9
to
d780165
Compare
…R-23668-multisource-details-reporting # Conflicts: # changelog/CHANGELOG.md
Checklist: