Avoid to index a document if FetchDcoument or SetCreated fails

This commit is contained in:
Haiyan Meng
2019-12-16 11:39:54 -08:00
parent 12fc8f41c7
commit 8c89f0946c
3 changed files with 25 additions and 16 deletions

View File

@@ -93,6 +93,9 @@ func (gc githubCrawler) Crawl(
return nil
}
// FetchDocument first tries to fetch the document with d.FilePath. If it fails,
// it will try to add each string in konfig.RecognizedKustomizationFileNames() to
// d.FilePath, and try to fetch the document again.
func (gc githubCrawler) FetchDocument(_ context.Context, d *doc.Document) error {
repoURL := d.RepositoryURL + "/" + d.FilePath + "?ref=" + d.DefaultBranch
repoSpec, err := git.NewRepoSpecFromUrl(repoURL)