openshift-labs / starter-guides

Getting Started with OpenShift for Developers workshop
https://openshift-labs.github.io/starter-guides-html/
Apache License 2.0
136 stars 147 forks source link

EventListener cant be created #179

Closed DarrickLeong closed 3 years ago

DarrickLeong commented 3 years ago

This error is at the "Automation for Your Application on Code Changes" workshop module.

To replicate the error: Running the creation of the command: oc create -f http://gogs-labs.apps.cluster-sin-1111.sin-1111.example.opentlc.com/user1/nationalparks/raw/master/pipeline/nationalparks-triggers-all.yaml -n user1

output error: triggertemplate.triggers.tekton.dev/nationalparks created triggerbinding.triggers.tekton.dev/nationalparks created route.route.openshift.io/el-nationalparks created Error from server (BadRequest): error when creating "http://gogs-labs.apps.cluster-sin-7791.sin-7791.example.opentlc.com/user1/nationalparks/raw/master/pipeline/nationalparks-triggers-all.yaml": admission webhook "webhook.triggers.tekton.dev" denied the request: mutation failed: cannot decode incoming new object: json: unknown field "ref"

Fix: Changed the code from

apiVersion: triggers.tekton.dev/v1alpha1 kind: EventListener metadata: name: nationalparks spec: serviceAccountName: pipeline triggers:

to:

apiVersion: triggers.tekton.dev/v1alpha1 kind: EventListener metadata: name: nationalparks spec: serviceAccountName: pipeline triggers:

Conclusion I am unsure if this fix is the right way as according to the tekton eventlistener guide/examples it is different: https://github.com/tektoncd/triggers/blob/master/docs/eventlisteners.md Hope there is a fix for it for future use.

blues-man commented 3 years ago

Thanks @DarrickLeong! I was just opening #178 to update Pipeline Operator to the new spec.

In the while I will push a retrocompatible version poining here: https://github.com/openshift-roadshow/nationalparks/blob/master/pipeline/nationalparks-triggers-all-rhpds.yaml#L59

DarrickLeong commented 3 years ago

Thanks @blues-man, glad to hear on the fix!