build: silently fail if git remote not found

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 4789d2219c43f28f98f2ead0d44bb3be40d87e32)
This commit is contained in:
CrazyMax 2023-01-30 14:33:16 +01:00 committed by Tonis Tiigi
parent 7776652a4d
commit f62342768b
No known key found for this signature in database
GPG Key ID: AFA9DE5F8AB7AF39

View File

@ -78,9 +78,7 @@ func getGitAttributes(ctx context.Context, contextPath string, dockerfilePath st
}
}
if rurl, err := gitc.RemoteURL(); err != nil {
return res, errors.Wrapf(err, "failed to get git remote url")
} else if rurl != "" {
if rurl, err := gitc.RemoteURL(); err == nil && rurl != "" {
if setGitLabels {
res["label:"+specs.AnnotationSource] = rurl
}