Skip to content

Commit

Permalink
revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-codefresh committed Dec 17, 2024
1 parent 139c1e1 commit 4620576
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions event_reporter/reporter/application_event_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (s *applicationEventReporter) resolveApplicationVersions(ctx context.Contex

var applicationVersions *apiclient.ApplicationVersions
if s.useSourcesServer {
appVers := s.sourcesServerClient.GetAppVersion(a)
appVers := s.sourcesServerClient.GetAppVersion(a, syncResultRevisions)
applicationVersions = utils.SourcesAppVersionsToRepo(appVers, logCtx)
} else {
applicationVersions = syncManifests.GetApplicationVersions()
Expand All @@ -293,7 +293,8 @@ func (s *applicationEventReporter) resolveApplicationVersions(ctx context.Contex

var applicationVersions *apiclient.ApplicationVersions
if s.useSourcesServer {
appVers := s.sourcesServerClient.GetAppVersion(a)
syncResultRevisions := &([]string{*syncResultRevision})
appVers := s.sourcesServerClient.GetAppVersion(a, syncResultRevisions)
applicationVersions = utils.SourcesAppVersionsToRepo(appVers, logCtx)
} else {
applicationVersions = syncManifests.GetApplicationVersions()
Expand Down
11 changes: 8 additions & 3 deletions pkg/sources_server_client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import (
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
)

type VersionPayload struct {
app *v1alpha1.Application
revisions *[]string
}

type DependenciesMap struct {
Lock string `json:"helm/Chart.lock"`
Deps string `json:"helm/dependencies"`
Expand All @@ -32,7 +37,7 @@ type sourceServerClient struct {
}

type SourceServerClientInteface interface {
GetAppVersion(app *v1alpha1.Application) *AppVersionResult
GetAppVersion(app *v1alpha1.Application, revisions *[]string) *AppVersionResult
}

func (c *sourceServerClient) sendRequest(method, url string, payload interface{}) ([]byte, error) {
Expand Down Expand Up @@ -72,8 +77,8 @@ func (c *sourceServerClient) sendRequest(method, url string, payload interface{}
return body, nil
}

func (c *sourceServerClient) GetAppVersion(app *v1alpha1.Application) *AppVersionResult {
appVersionResult, err := c.sendRequest("POST", "/getAppVersion", app)
func (c *sourceServerClient) GetAppVersion(app *v1alpha1.Application, revisions *[]string) *AppVersionResult {
appVersionResult, err := c.sendRequest("POST", "/getAppVersion", VersionPayload{app: app, revisions: revisions})
if err != nil {
log.Errorf("error getting app version: %v", err)
return nil
Expand Down

0 comments on commit 4620576

Please sign in to comment.