diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..d5a6e5b7 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,24 @@ +name: Build Docker Image + +on: + pull_request: + types: [ opened, synchronize, reopened ] + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build docker image + working-directory: . + run: make docker-build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6224b754..6869fe2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,11 +1,8 @@ -name: Build Boundless Operator Docker Image +name: Build and Push Docker Image on: push: branches: [ "main" ] - pull_request: - types: [opened, reopened] - branches: [ "main" ] jobs: build-and-push: diff --git a/api/v1alpha1/blueprint_types.go b/api/v1alpha1/blueprint_types.go index 736cd4fc..a151f85d 100644 --- a/api/v1alpha1/blueprint_types.go +++ b/api/v1alpha1/blueprint_types.go @@ -18,12 +18,12 @@ type BlueprintSpec struct { // Component defines the core and addons components that should be installed type Component struct { - Core Core `json:"core,omitempty"` + Core *Core `json:"core,omitempty"` Addons []AddonSpec `json:"addons,omitempty"` } type Core struct { - Ingress IngressSpec `json:"ingress,omitempty"` + Ingress *IngressSpec `json:"ingress,omitempty"` } // BlueprintStatus defines the observed state of Blueprint diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index e5cf47bf..373a7f75 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -215,7 +215,11 @@ func (in *Chart) DeepCopy() *Chart { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Component) DeepCopyInto(out *Component) { *out = *in - out.Core = in.Core + if in.Core != nil { + in, out := &in.Core, &out.Core + *out = new(Core) + (*in).DeepCopyInto(*out) + } if in.Addons != nil { in, out := &in.Addons, &out.Addons *out = make([]AddonSpec, len(*in)) @@ -238,7 +242,11 @@ func (in *Component) DeepCopy() *Component { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Core) DeepCopyInto(out *Core) { *out = *in - out.Ingress = in.Ingress + if in.Ingress != nil { + in, out := &in.Ingress, &out.Ingress + *out = new(IngressSpec) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Core. diff --git a/controllers/blueprint_controller.go b/controllers/blueprint_controller.go index e17d2546..2b1cad22 100644 --- a/controllers/blueprint_controller.go +++ b/controllers/blueprint_controller.go @@ -59,11 +59,13 @@ func (r *BlueprintReconciler) Reconcile(ctx context.Context, req ctrl.Request) ( } } - logger.Info("Reconciling ingress") - err = r.createOrUpdateIngress(ctx, logger, ingressResource(&instance.Spec.Components.Core.Ingress)) - if err != nil { - logger.Error(err, "Failed to reconcile ingress", "Name", instance.Spec.Components.Core.Ingress) - return ctrl.Result{Requeue: true}, err + if instance.Spec.Components.Core != nil && instance.Spec.Components.Core.Ingress != nil { + logger.Info("Reconciling ingress") + err = r.createOrUpdateIngress(ctx, logger, ingressResource(instance.Spec.Components.Core.Ingress)) + if err != nil { + logger.Error(err, "Failed to reconcile ingress", "Name", instance.Spec.Components.Core.Ingress) + return ctrl.Result{Requeue: true}, err + } } for _, addon := range instance.Spec.Components.Addons { @@ -101,7 +103,7 @@ func (r *BlueprintReconciler) createOrUpdateAddon(ctx context.Context, logger lo return nil } - logger.Info("Creating add-on", "Name", existing.Name) + logger.Info("Creating add-on", "Name", obj.GetName()) err = r.Create(ctx, obj) if err != nil { return fmt.Errorf("failed to create add-on %s: %w", obj.GetName(), err) @@ -128,7 +130,7 @@ func (r *BlueprintReconciler) createOrUpdateIngress(ctx context.Context, logger return nil } - logger.Info("Creating ingress", "Name", existing.Name) + logger.Info("Creating ingress", "Name", obj.GetName()) err = r.Create(ctx, obj) if err != nil { return fmt.Errorf("failed to create ingress %s: %w", obj.GetName(), err)