@@ -125,7 +125,10 @@ func (h *Hydrator) ProcessHydrationQueueItem(hydrationKey HydrationQueueKey) (pr
125
125
app .Status .SourceHydrator .CurrentOperation .Phase = appv1 .HydrateOperationPhaseFailed
126
126
failedAt := metav1 .Now ()
127
127
app .Status .SourceHydrator .CurrentOperation .FinishedAt = & failedAt
128
- app .Status .SourceHydrator .CurrentOperation .Message = fmt .Sprintf ("Failed to hydrated revision %s: %v" , drySHA , err .Error ())
128
+ app .Status .SourceHydrator .CurrentOperation .Message = fmt .Sprintf ("Failed to hydrate revision %q: %v" , drySHA , err .Error ())
129
+ // We may or may not have gotten far enough in the hydration process to get a non-empty SHA, but set it just
130
+ // in case we did.
131
+ app .Status .SourceHydrator .CurrentOperation .DrySHA = drySHA
129
132
h .dependencies .PersistAppHydratorStatus (origApp , & app .Status .SourceHydrator )
130
133
logCtx = logCtx .WithField ("app" , app .QualifiedName ())
131
134
logCtx .Errorf ("Failed to hydrate app: %v" , err )
@@ -164,7 +167,7 @@ func (h *Hydrator) hydrateAppsLatestCommit(logCtx *log.Entry, hydrationKey Hydra
164
167
return nil , "" , "" , fmt .Errorf ("failed to get relevant apps for hydration: %w" , err )
165
168
}
166
169
167
- hydratedRevision , dryRevision , err := h .hydrate (logCtx , relevantApps )
170
+ dryRevision , hydratedRevision , err := h .hydrate (logCtx , relevantApps )
168
171
if err != nil {
169
172
return relevantApps , dryRevision , "" , fmt .Errorf ("failed to hydrate apps: %w" , err )
170
173
}
@@ -259,6 +262,8 @@ func (h *Hydrator) hydrate(logCtx *log.Entry, apps []*appv1.Application) (string
259
262
return "" , "" , fmt .Errorf ("failed to get repo objects: %w" , err )
260
263
}
261
264
265
+ // This should be the DRY SHA. We set it here so that after processing the first app, all apps are hydrated
266
+ // using the same SHA.
262
267
targetRevision = resp .Revision
263
268
264
269
// Set up a ManifestsRequest
@@ -310,12 +315,12 @@ func (h *Hydrator) hydrate(logCtx *log.Entry, apps []*appv1.Application) (string
310
315
311
316
closer , commitService , err := h .commitClientset .NewCommitServerClient ()
312
317
if err != nil {
313
- return "" , "" , fmt .Errorf ("failed to create commit service: %w" , err )
318
+ return targetRevision , "" , fmt .Errorf ("failed to create commit service: %w" , err )
314
319
}
315
320
defer argoio .Close (closer )
316
321
resp , err := commitService .CommitHydratedManifests (context .Background (), & manifestsRequest )
317
322
if err != nil {
318
- return "" , "" , fmt .Errorf ("failed to commit hydrated manifests: %w" , err )
323
+ return targetRevision , "" , fmt .Errorf ("failed to commit hydrated manifests: %w" , err )
319
324
}
320
325
return targetRevision , resp .HydratedSha , nil
321
326
}
0 commit comments