Skip to content

Commit 4620576

Browse files
revisions
1 parent 139c1e1 commit 4620576

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

event_reporter/reporter/application_event_reporter.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ func (s *applicationEventReporter) resolveApplicationVersions(ctx context.Contex
274274

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

294294
var applicationVersions *apiclient.ApplicationVersions
295295
if s.useSourcesServer {
296-
appVers := s.sourcesServerClient.GetAppVersion(a)
296+
syncResultRevisions := &([]string{*syncResultRevision})
297+
appVers := s.sourcesServerClient.GetAppVersion(a, syncResultRevisions)
297298
applicationVersions = utils.SourcesAppVersionsToRepo(appVers, logCtx)
298299
} else {
299300
applicationVersions = syncManifests.GetApplicationVersions()

pkg/sources_server_client/client.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import (
1212
"github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
1313
)
1414

15+
type VersionPayload struct {
16+
app *v1alpha1.Application
17+
revisions *[]string
18+
}
19+
1520
type DependenciesMap struct {
1621
Lock string `json:"helm/Chart.lock"`
1722
Deps string `json:"helm/dependencies"`
@@ -32,7 +37,7 @@ type sourceServerClient struct {
3237
}
3338

3439
type SourceServerClientInteface interface {
35-
GetAppVersion(app *v1alpha1.Application) *AppVersionResult
40+
GetAppVersion(app *v1alpha1.Application, revisions *[]string) *AppVersionResult
3641
}
3742

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

75-
func (c *sourceServerClient) GetAppVersion(app *v1alpha1.Application) *AppVersionResult {
76-
appVersionResult, err := c.sendRequest("POST", "/getAppVersion", app)
80+
func (c *sourceServerClient) GetAppVersion(app *v1alpha1.Application, revisions *[]string) *AppVersionResult {
81+
appVersionResult, err := c.sendRequest("POST", "/getAppVersion", VersionPayload{app: app, revisions: revisions})
7782
if err != nil {
7883
log.Errorf("error getting app version: %v", err)
7984
return nil

0 commit comments

Comments
 (0)