diff --git a/pkg/registry/apis/provisioning/history.go b/pkg/registry/apis/provisioning/history.go index e177295ca23..dfca0caae78 100644 --- a/pkg/registry/apis/provisioning/history.go +++ b/pkg/registry/apis/provisioning/history.go @@ -87,7 +87,7 @@ func (h *historySubresource) Connect(ctx context.Context, name string, opts runt // TODO: Add history pagination commits, err := versioned.History(ctx, filePath, ref) if err != nil { - logger.Debug("failed to get history", "error", err) + logger.Error("failed to get history", "error", err) responder.Error(err) return } diff --git a/pkg/registry/apis/provisioning/repository/github/repository.go b/pkg/registry/apis/provisioning/repository/github/repository.go index e7aed375242..ccd0b347e3b 100644 --- a/pkg/registry/apis/provisioning/repository/github/repository.go +++ b/pkg/registry/apis/provisioning/repository/github/repository.go @@ -60,6 +60,8 @@ func NewGitHub( if err != nil { return nil, fmt.Errorf("parse owner and repo: %w", err) } + logger := logging.FromContext(ctx) + logger.Debug("initializing GitHub repository", "owner", owner, "repo", repo, "url", config.Spec.GitHub.URL, "branch", config.Spec.GitHub.Branch, "token", token) return &githubRepository{ config: config, @@ -168,11 +170,26 @@ func (r *githubRepository) History(ctx context.Context, path, ref string) ([]pro if ref == "" { ref = r.config.Spec.GitHub.Branch } + logger := logging.FromContext(ctx) finalPath := safepath.Join(r.config.Spec.GitHub.Path, path) commits, err := r.gh.Commits(ctx, r.owner, r.repo, finalPath, ref) if err != nil { if errors.Is(err, ErrResourceNotFound) { + logger.Debug( + "file not found in GitHub repository", + "path", + finalPath, + "ref", + ref, + "owner", + r.owner, + "repo", + r.repo, + "config", + r.config.Spec.GitHub, + ) + return nil, repository.ErrFileNotFound }