(repo string, creds *auth.Credentials)
| 329 | } |
| 330 | |
| 331 | func resolveDefaultBranchRef(repo string, creds *auth.Credentials) (string, error) { |
| 332 | rem := git.NewRemote(memory.NewStorage(), &config.RemoteConfig{ |
| 333 | Name: "origin", |
| 334 | URLs: []string{repo}, |
| 335 | }) |
| 336 | |
| 337 | // We can then use every Remote functions to retrieve wanted information |
| 338 | refs, err := rem.List(&git.ListOptions{ |
| 339 | PeelingOption: git.AppendPeeled, |
| 340 | Auth: httpBasicAuthCredentials(creds), |
| 341 | }) |
| 342 | if err != nil { |
| 343 | return "", errors.Wrap(err, fmt.Sprintf("repo %s was not cloned successfully; authentication might be required; check if repository exists and you referenced it correctly", repo)) |
| 344 | } |
| 345 | |
| 346 | // Filters the references list and only keeps tags |
| 347 | for _, r := range refs { |
| 348 | if r.Name().Short() == plumbing.HEAD.Short() { |
| 349 | for _, rr := range refs { |
| 350 | if rr.Name().String() == r.Target().String() { |
| 351 | return rr.Hash().String(), nil |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | return "", errors.New("failed resolving HEAD ref") |
| 358 | } |
| 359 | |
| 360 | func readValuesFile(fs billy.Filesystem, path string) ([]byte, error) { |
| 361 | valuesFile, err := fs.Open(path2.Join(path, "values.yaml")) |
no test coverage detected
searching dependent graphs…