Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle localbuild creation error and look for cluster scoped object #96

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pkg/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,12 @@ func (b *Build) Run(ctx context.Context, recreateCluster bool) error {
// Create localbuild resource
localBuild := v1alpha1.Localbuild{
ObjectMeta: metav1.ObjectMeta{
Name: b.name,
Namespace: "default",
Name: b.name,
},
}

setupLog.Info("Creating localbuild resource")
controllerutil.CreateOrUpdate(ctx, kubeClient, &localBuild, func() error {
_, err = controllerutil.CreateOrUpdate(ctx, kubeClient, &localBuild, func() error {
localBuild.Spec = v1alpha1.LocalbuildSpec{
PackageConfigs: v1alpha1.PackageConfigsSpec{
Argo: v1alpha1.ArgoPackageConfigSpec{
Expand All @@ -164,6 +163,11 @@ func (b *Build) Run(ctx context.Context, recreateCluster bool) error {
return nil
})

if err != nil {
setupLog.Error(err, "Error creating localbuild resource")
return err
}

err = <-managerExit
close(managerExit)
return err
Expand Down