Skip to content

Commit

Permalink
logs-4 (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-codefresh authored Oct 27, 2023
1 parent f776ca3 commit a384038
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.8.1-cap-CR-app-version3
2.8.1-cap-CR-app-version4
5 changes: 4 additions & 1 deletion reposerver/repository/app_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ func getVersionFromYaml(appPath, jsonPathExpression string) (*string, error) {
return nil, err
}

log.Infof("AppVersion source content: %s", string(content))

var obj interface{}
if err := yaml.Unmarshal(content, &obj); err != nil {
return nil, err
Expand All @@ -74,6 +76,7 @@ func getVersionFromYaml(appPath, jsonPathExpression string) (*string, error) {
}

appVersion := buf.String()
log.Infof("AppVersion source content appVersion: %s", appVersion)
return &appVersion, nil
}

Expand Down Expand Up @@ -103,7 +106,7 @@ func getAppVersions(appPath string, resourceName string, jsonPathExpression stri
if err != nil {
return nil, err
}
log.Printf("appVersion value: %v\n", *appVersion)
log.Printf("appVersion value: %v (appPath=%s)", *appVersion, appPath)

result := &Result{
AppVersion: *appVersion,
Expand Down
5 changes: 5 additions & 0 deletions reposerver/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,9 @@ func (s *Service) GenerateManifest(ctx context.Context, q *apiclient.ManifestReq
var err error
cacheFn := func(cacheKey string, refSourceCommitSHAs cache.ResolvedRevisions, firstInvocation bool) (bool, error) {
ok, resp, err := s.getManifestCacheEntry(cacheKey, q, refSourceCommitSHAs, firstInvocation)
if resp != nil {
log.Infof("appVersion from cache. App = %s, Version = %v", q.AppName, resp.ApplicationVersions)
}
res = resp
return ok, err
}
Expand Down Expand Up @@ -835,6 +838,7 @@ func (s *Service) runManifestGenAsync(ctx context.Context, repoRoot, commitSHA,
// Update the cache to include failure information
innerRes.NumberOfConsecutiveFailures++
innerRes.MostRecentError = err.Error()
log.Infof("Save App %s to cache 1. Versions: %v", q.AppName, innerRes.ManifestResponse.ApplicationVersions)
cacheErr = s.cache.SetManifests(cacheKey, appSourceCopy, q.RefSources, q, q.Namespace, q.TrackingMethod, q.AppLabelKey, q.AppName, innerRes, refSourceCommitSHAs)
if cacheErr != nil {
log.Warnf("manifest cache set error %s: %v", appSourceCopy.String(), cacheErr)
Expand All @@ -859,6 +863,7 @@ func (s *Service) runManifestGenAsync(ctx context.Context, repoRoot, commitSHA,
}
manifestGenResult.Revision = commitSHA
manifestGenResult.VerifyResult = opContext.verificationResult
log.Infof("Save App %s to cache 2. Versions: %v", q.AppName, manifestGenCacheEntry.ManifestResponse.ApplicationVersions)
err = s.cache.SetManifests(cacheKey, appSourceCopy, q.RefSources, q, q.Namespace, q.TrackingMethod, q.AppLabelKey, q.AppName, &manifestGenCacheEntry, refSourceCommitSHAs)
if err != nil {
log.Warnf("manifest cache set error %s/%s: %v", appSourceCopy.String(), cacheKey, err)
Expand Down

0 comments on commit a384038

Please sign in to comment.