controllers: check GitRepository reference != nil
To prevent the reconciler from panicing when no reference is configured for the GitRepository.
This commit is contained in:
parent
af77de193b
commit
2c0b175807
|
@ -321,7 +321,7 @@ func (r *GitRepositoryReconciler) sync(ctx context.Context, repository sourcev1.
|
||||||
|
|
||||||
if revision == "" {
|
if revision == "" {
|
||||||
revision = fmt.Sprintf("%s/%s", branch, ref.Hash().String())
|
revision = fmt.Sprintf("%s/%s", branch, ref.Hash().String())
|
||||||
if repository.Spec.Reference.Tag != "" {
|
if repository.Spec.Reference != nil && repository.Spec.Reference.Tag != "" {
|
||||||
revision = fmt.Sprintf("%s/%s", repository.Spec.Reference.Tag, ref.Hash().String())
|
revision = fmt.Sprintf("%s/%s", repository.Spec.Reference.Tag, ref.Hash().String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue