(path string, fs billy.Filesystem)
| 493 | } |
| 494 | |
| 495 | func readFiles(path string, fs billy.Filesystem) ([]*chart.File, error) { |
| 496 | files, err := fs.ReadDir(path) |
| 497 | if err != nil { |
| 498 | return nil, err |
| 499 | } |
| 500 | |
| 501 | chartFiles := make([]*chart.File, 0) |
| 502 | |
| 503 | for _, fileInfo := range files { |
| 504 | if fileInfo.IsDir() { |
| 505 | dirChartFiles, err := readFiles(path2.Join(path, fileInfo.Name()), fs) |
| 506 | if err != nil { |
| 507 | return nil, err |
| 508 | } |
| 509 | |
| 510 | chartFiles = append(chartFiles, dirChartFiles...) |
| 511 | continue |
| 512 | } |
| 513 | |
| 514 | ext := filepath.Ext(fileInfo.Name()) |
| 515 | if ext == "yaml" { |
| 516 | continue |
| 517 | } |
| 518 | |
| 519 | file, err := fs.Open(path2.Join(path, fileInfo.Name())) |
| 520 | if err != nil { |
| 521 | return nil, err |
| 522 | } |
| 523 | |
| 524 | var b bytes.Buffer |
| 525 | _, err = io.Copy(bufio.NewWriter(&b), file) |
| 526 | if err != nil { |
| 527 | return nil, err |
| 528 | } |
| 529 | |
| 530 | chartFiles = append(chartFiles, &chart.File{ |
| 531 | Name: path2.Join(path, fileInfo.Name()), |
| 532 | Data: b.Bytes(), |
| 533 | }) |
| 534 | } |
| 535 | |
| 536 | return chartFiles, nil |
| 537 | } |
| 538 | |
| 539 | func (r Repo) mapGitHubRepoTemplate(repoURL, path, commitSHA string, creds *auth.Credentials) (*models.Template, error) { |
| 540 | tgzData, err := gitproviders2.GitHubClone(repoURL, commitSHA, creds) |
no test coverage detected
searching dependent graphs…