Repository: jenkins-x/lighthouse (go)

Issue:
tekton controller fails on OpenShift 4.x
when trying to create a `PipelineRun` on OpenShift 4.x we get this error...

```
Failed to create pipeline run: pipelineruns.tekton.dev \"verify-vcszn\" is forbidden: cannot set blockOwnerDeletion if an ownerReference refers to a resource you can't set finalizers on
```

Pull request:
fix: fix for OpenShift 4.x
avoid setting `blockOwnerDeletion: true` on the `PipelineRun` to avoid failing on OpenShift 4.x

fixes #1143

Patch:
diff --git a/pkg/engines/tekton/controller.go b/pkg/engines/tekton/controller.go
index b814e3f9..feedef8c 100644
--- a/pkg/engines/tekton/controller.go
+++ b/pkg/engines/tekton/controller.go
@@ -115,6 +115,15 @@ func (r *LighthouseJobReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
 				r.logger.Errorf("Failed to set owner reference: %s", err)
 				return ctrl.Result{}, err
 			}
+
+			// lets disable the blockOwnerDeletion as it fails on OpenShift
+			for i := range pipelineRun.OwnerReferences {
+				ref := &pipelineRun.OwnerReferences[i]
+				if ref.Kind == "LighthouseJob" && ref.BlockOwnerDeletion != nil {
+					ref.BlockOwnerDeletion = nil
+				}
+			}
+
 			// TODO: changing the status should be a consequence of a pipeline run being created
 			// update status
 			job.Status = lighthousev1alpha1.LighthouseJobStatus{


Test patch:
diff --git a/pkg/engines/tekton/test_data/controller/start-batch-pullrequest/expected-pr.yml b/pkg/engines/tekton/test_data/controller/start-batch-pullrequest/expected-pr.yml
index 460c1b26..7390139d 100644
--- a/pkg/engines/tekton/test_data/controller/start-batch-pullrequest/expected-pr.yml
+++ b/pkg/engines/tekton/test_data/controller/start-batch-pullrequest/expected-pr.yml
@@ -23,7 +23,6 @@ metadata:
       kind: LighthouseJob
       name: f46327af-b47e-11ea-b797-9256b7b8d9b0
       Controller: true
-      BlockOwnerDeletion: true
 spec:
   params:
     - name: BUILD_ID
diff --git a/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-pr.yml b/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-pr.yml
index 24f69260..4841e1c1 100644
--- a/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-pr.yml
+++ b/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-pr.yml
@@ -23,7 +23,6 @@ metadata:
       kind: LighthouseJob
       name: f46327af-b47e-11ea-b797-9256b7b8d9b0
       Controller: true
-      BlockOwnerDeletion: true
 spec:
   params:
     - name: BUILD_ID
diff --git a/pkg/engines/tekton/test_data/controller/start-push/expected-pr.yml b/pkg/engines/tekton/test_data/controller/start-push/expected-pr.yml
index f26004f0..a87e51e0 100644
--- a/pkg/engines/tekton/test_data/controller/start-push/expected-pr.yml
+++ b/pkg/engines/tekton/test_data/controller/start-push/expected-pr.yml
@@ -22,7 +22,6 @@ metadata:
       kind: LighthouseJob
       name: f46327af-b47e-11ea-b797-9256b7b8d9b0
       Controller: true
-      BlockOwnerDeletion: true
 spec:
   params:
     - name: BUILD_ID