Skip to content

Commit

Permalink
handle localbuild creation error and look for cluster scoped object (#96
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nabuskey authored Nov 28, 2023
1 parent ca8f132 commit ab6d14d
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit ab6d14d

Please sign in to comment.