@@ -85,7 +91,7 @@
title: 'SYNC STATUS',
helpContent: 'Whether or not the version of your app is up to date with your repo. You may wish to sync your app if it is out-of-sync.'
},
- () => showMetadataInfo((revision += getAppDefaultSyncRevisionExtra(application)))
+ () => showMetadataInfo(application.status.sync ? 'SYNC_STATUS_REVISION' : null)
)}
@@ -102,17 +108,21 @@
{application.spec.syncPolicy?.automated ? 'Auto sync is enabled.' : 'Auto sync is not enabled.'}
- {application.status && application.status.sync && application.status.sync.revision && revision && !application.spec.source.chart && (
-
-
-
- )}
+ {application.status &&
+ application.status.sync &&
+ (hasMultipleSources
+ ? application.status.sync.revisions && application.status.sync.revisions[0] && application.spec.sources && !application.spec.sources[0].chart
+ : application.status.sync.revision && !application.spec.source.chart) && (
+
+
+
+ )}
{appOperationState && (
@@ -126,27 +136,27 @@
daysSinceLastSynchronized +
' days since last sync. Click for the status of that sync.'
},
- () => showMetadataInfo((revision += getAppDefaultSyncRevisionExtra(application)))
+ () => showMetadataInfo(appOperationState.syncResult && (appOperationState.syncResult.revisions || appOperationState.syncResult.revision)? 'OPERATION_STATE_REVISION' : null)
)}
showOperation && showOperation()}>
{' '}
- {appOperationState.syncResult && revision && (
+ {appOperationState.syncResult && (appOperationState.syncResult.revision || appOperationState.syncResult.revisions) && (
- to
+ to {getAppDefaultSyncRevisionExtra(application)}
)}
{appOperationState.phase}
- {(appOperationState.syncResult && revision && (
+ {(appOperationState.syncResult && operationStateRevision && (
)) ||
{appOperationState.message}
}
diff --git a/ui/src/app/applications/components/test.yaml b/ui/src/app/applications/components/test.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ui/src/app/applications/components/test.yaml
diff --git a/ui/src/app/applications/components/utils.tsx b/ui/src/app/applications/components/utils.tsx
index 46aeb3a..78513e7 100644
--- a/ui/src/app/applications/components/utils.tsx
+++ b/ui/src/app/applications/components/utils.tsx
@@ -676,8 +676,6 @@
}
}
- message += getAppDefaultSyncRevisionExtra(app);
-
switch (app.status.sync.status) {
case appModels.SyncStatuses.Synced:
return (
@@ -685,7 +683,7 @@
to{' '}
{message}
- {' '}
+ {getAppDefaultSyncRevisionExtra(app)}{' '}
);
case appModels.SyncStatuses.OutOfSync:
@@ -694,7 +692,7 @@
from{' '}
{message}
- {' '}
+ {getAppDefaultSyncRevisionExtra(app)}{' '}
);
default:
@@ -1077,6 +1075,15 @@
return app.status.sync.revisions && app.status.sync.revisions.length > 0 ? app.status.sync.revisions[0] : app.status.sync.revision;
}
+// getAppDefaultOperationSyncRevision gets the first app revisions from `status.operationState.syncResult.revisions` or, if that list is missing or empty, the `revision`
+// field.
+export function getAppDefaultOperationSyncRevision(app?: appModels.Application) {
+ if (!app || !app.status || !app.status.operationState || !app.status.operationState.syncResult) {
+ return '';
+ }
+ return app.status.operationState.syncResult.revisions && app.status.operationState.syncResult.revisions.length > 0 ? app.status.operationState.syncResult.revisions[0] : app.status.operationState.syncResult.revision;
+}
+
// getAppCurrentVersion gets the first app revisions from `status.sync.revisions` or, if that list is missing or empty, the `revision`
// field.
export function getAppCurrentVersion(app?: appModels.Application) {
@@ -1099,6 +1106,19 @@
return '';
}
+// getAppDefaultOperationSyncRevisionExtra gets the first app revisions from `status.operationState.syncResult.revisions` or, if that list is missing or empty, the `revision`
+// field.
+export function getAppDefaultOperationSyncRevisionExtra(app?: appModels.Application) {
+ if (!app || !app.status || !app.status.operationState || !app.status.operationState.syncResult || !app.status.operationState.syncResult.revisions) {
+ return 'Unknown';
+ }
+
+ if (app.status.operationState.syncResult.revisions.length > 0) {
+ return ` and (${app.status.operationState.syncResult.revisions.length - 1}) more`;
+ }
+ return '';
+}
+
export function getAppSpecDefaultSource(spec: appModels.ApplicationSpec) {
return spec.sources && spec.sources.length > 0 ? spec.sources[0] : spec.source;
}
diff --git a/ui/src/app/shared/models.ts b/ui/src/app/shared/models.ts
index bb88dcf..b8bd07b 100644
--- a/ui/src/app/shared/models.ts
+++ b/ui/src/app/shared/models.ts
@@ -103,6 +103,7 @@
export interface SyncOperationResult {
resources: ResourceResult[];
revision: string;
+ revisions: string[];
}
export type ResultCode = 'Synced' | 'SyncFailed' | 'Pruned' | 'PruneSkipped';
diff --git a/util/notification/expression/repo/repo.go b/util/notification/expression/repo/repo.go
index ada7a35..177762b 100644
--- a/util/notification/expression/repo/repo.go
+++ b/util/notification/expression/repo/repo.go
@@ -4,7 +4,9 @@
"context"
"encoding/json"
"errors"
+ "fmt"
"net/url"
+ "os"
"regexp"
"strings"
@@ -49,17 +51,27 @@
}
func getCommitMetadata(commitSHA string, app *unstructured.Unstructured, argocdService service.Service) (*shared.CommitMetadata, error) {
+ fmt.Fprintln(os.Stdout, "!!!!!!! ! About to call NestedString")
repoURL, ok, err := unstructured.NestedString(app.Object, "spec", "source", "repoURL")
if err != nil {
+ fmt.Fprintln(os.Stdout, "!!!!!!! NestedString err is ", err)
return nil, err
}
if !ok {
panic(errors.New("failed to get application source repo URL"))
}
+ fmt.Fprintln(os.Stdout, "Context is ")
+ fmt.Fprintln(os.Stdout, "!!!!! ", context.Background())
+ fmt.Fprintln(os.Stdout, "!!!!!!! ****** repoURL = ", repoURL)
+ fmt.Fprintln(os.Stdout, "!!!!!!! ****** commitSHA = ", commitSHA)
+ fmt.Fprintln(os.Stdout, "!!!!!!! ****** About to call repo GetCommitMetadata")
meta, err := argocdService.GetCommitMetadata(context.Background(), repoURL, commitSHA)
+ fmt.Fprintln(os.Stdout, "!!!!!!! ****** Called repo GetCommitMetadata")
if err != nil {
+ fmt.Fprintln(os.Stdout, "!!!!!!! getCommitMetadata err is ", err)
return nil, err
}
+ fmt.Fprintln(os.Stdout, "!!!!!!! returning metadata")
return meta, nil
}