Skip to content

Commit

Permalink
Further check host values after parsing
Browse files Browse the repository at this point in the history
If any of the hosts is empty at this point, something has gone wrong.
  • Loading branch information
ePirat committed Apr 10, 2022
1 parent ecf7db3 commit 77b55c8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/credhelper/credhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func matchRegistryURL(serverURLString string) error {
if err != nil {
return fmt.Errorf("failed to parse registry URL: %w", err)
}
if serverURL.Hostname() == "" || envURL.Hostname() == "" {
return errors.New("failed getting hosts for matching")
}
if serverURL.Hostname() != envURL.Hostname() {
return fmt.Errorf("host '%s' does not match CI_REGISTRY host '%s'",
serverURL.Hostname(),
Expand Down

0 comments on commit 77b55c8

Please sign in to comment.