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

EventListener Unsupported Protocol Scheme Error #1772

Open
sidharthsudheer20 opened this issue Oct 9, 2024 · 9 comments
Open

EventListener Unsupported Protocol Scheme Error #1772

sidharthsudheer20 opened this issue Oct 9, 2024 · 9 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@sidharthsudheer20
Copy link

EventListener Unsupported Protocol Scheme Error

Expected Behavior

The Tekton EventListener should correctly process incoming GitHub webhook events without errors, properly identifying and handling the protocol.

Actual Behavior

The Tekton EventListener fails to process GitHub webhook events and logs the error:

{"level":"error","ts":"2024-10-09T09:27:42.006Z","logger":"eventlistener","caller":"sink/sink.go:414","msg":"Post \"\": unsupported protocol scheme \"\"","commit":"b133ef7-dirty","eventlistener":"default-listener","namespace":"default","/triggers-eventid":"709d9f0f-bb8f-4743-899d-250a81c75e6e","eventlistenerUID":"9d5e8cd6-9b3b-4445-b648-fe59ecf975f3","/triggers-eventid":"709d9f0f-bb8f-4743-899d-250a81c75e6e"

Steps to Reproduce the Issue

  1. Configure a Tekton EventListener with a GitHub interceptor.
  2. Set up a GitHub webhook to trigger the EventListener.
  3. Trigger a GitHub event (e.g., push or pull request) to invoke the EventListener.

Additional Information

  • Kubernetes Version:

    Client Version: v1.29.7
    Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
    Server Version: v1.29.7+6abe8a1
    
  • Tekton Pipeline Version:

    v0.62.0
    
  • EventListener Configuration:

     apiVersion: triggers.tekton.dev/v1alpha1
     kind: EventListener
     metadata:
       name: default-listener
       namespace: default
     spec:
       serviceAccountName: build-scc
       triggers:
         - name: zookeeper-build-trigger
           interceptors:
             - ref:
                 name: "github"
                 kind: ClusterInterceptor
                 apiVersion: triggers.tekton.dev
               params:
               - name: "secretRef"
                 value:
                   secretName: github-secret
                   secretKey: secretToken
               - name: "eventTypes"
                 value: ["pull_request", "push"]
               - name: "addChangedFiles"
                 value:
                   enabled: true
             - ref:
                 name: cel
               params:
               - name: filter
                 value: extensions.changed_files.matches('/operator/zookeeper/')
           bindings:
           - ref: default-pipelinebinding
           template:
             ref: default-triggertemplate
    
    
  • Logs:

     {"level":"debug","ts":"2024-10-09T09:41:13.819Z","logger":"eventlistener","caller":"sink/metrics.go:115","msg":"event listener request","commit":"b133ef7-dirty","status":"succeeded"}
     {"level":"debug","ts":"2024-10-09T09:41:13.819Z","logger":"eventlistener","caller":"sink/metrics.go:100","msg":"event listener request completed","commit":"b133ef7-dirty","status":202,"duration":0.001259106}
     {"level":"error","ts":"2024-10-09T09:41:13.837Z","logger":"eventlistener","caller":"sink/sink.go:414","msg":"Post \"\": unsupported protocol scheme \"\"","commit":"b133ef7-dirty","eventlistener":"default-listener","namespace":"default","/triggers-eventid":"7a9923a1-af8b-4baf-93c2-219e2a1cf66a","eventlistenerUID":"9d5e8cd6-9b3b-4445-b648-fe59ecf975f3","/triggers-eventid":"7a9923a1-af8b-4baf-93c2-219e2a1cf66a","/trigger":"zookeeper-build-trigger","stacktrace":"github.com/tektoncd/triggers/pkg/sink.Sink.processTrigger\n\tgithub.com/tektoncd/triggers/pkg/sink/sink.go:414\ngithub.com/tektoncd/triggers/pkg/sink.Sink.HandleEvent.func1\n\tgithub.com/tektoncd/triggers/pkg/sink/sink.go:202"}
    
@sidharthsudheer20 sidharthsudheer20 added the kind/bug Categorizes issue or PR as related to a bug. label Oct 9, 2024
@khrm
Copy link
Contributor

khrm commented Oct 9, 2024

Did you choose non Json Webhook?

@sidharthsudheer20
Copy link
Author

sidharthsudheer20 commented Oct 9, 2024

No..it's JSON
application/json
i'm getting this error only when i'm using the github interceptor..else its working fine.
This is the log from core-interceptor

{"level":"info","ts":1728465501.683699,"logger":"fallback","caller":"injection/injection.go:63","msg":"Starting informers..."}
{"level":"info","ts":1728465501.9975433,"caller":"interceptors/main.go:121","msg":"Listen and serve on port 8443"}
{"level":"info","ts":1728465520.2261076,"caller":"server/server.go:153","msg":"Interceptor response is: &{Extensions:map[changed_files: operator/zookeeper/test] Continue:true Status:{Code:OK Message:}}"}

@khrm
Copy link
Contributor

khrm commented Oct 23, 2024

I tried recreating this using the following example: https://github.com/tektoncd/triggers/tree/main/examples/v1beta1/github-add-changed-files-push-cel

Above error isn't happening. I configured the above example with a repo.

@khrm
Copy link
Contributor

khrm commented Oct 23, 2024

Can you please provide some more concrete example where we can recreate this?

@sidharthsudheer20
Copy link
Author

sidharthsudheer20 commented Oct 24, 2024

I’ve set it up on OpenShift, and here is the configuration I used for the triggers.

apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerTemplate
metadata:
  name: default-triggertemplate
  namespace: default
spec:
  params:
    - name: git-url
      description: The git repository url
    - name: git-commit-id
      description: The Git commit Id
    - name: git-commit-author
      description: Commit Author Name
    - name: git-commit-author-date
      description: Date Of Commit
    - name: git-branch
      description: Git Branch
    - name: git-commit-message
      description: Git Commit Message
    - name: git-commit-url
      description: Git Commit Url
  resourcetemplates:
    - apiVersion: tekton.dev/v1beta1
      kind: PipelineRun
      metadata:
        generateName: docker-build-pipeline-
        namespace: default
      spec:
        serviceAccountName: build-scc 
        pipelineRef:
          name: docker-build-pipeline
        workspaces:
          - name: shared-workspace
            volumeClaimTemplate:
              spec:
                accessModes: ["ReadWriteOnce"]
                resources:
                  requests:
                    storage: 1Gi
        params:
          - name: git-url
            value: $(tt.params.git-url)
          - name: git-branch
            value: $(tt.params.git-branch)
          - name: git-commit-id
            value: $(tt.params.git-commit-id)
          - name: git-commit-author
            value: $(tt.params.git-commit-author)
          - name: git-commit-author-date
            value: $(tt.params.git-commit-author-date)
          - name: git-commit-message
            value: $(tt.params.git-commit-message)
          - name: git-commit-url
            value: $(tt.params.git-commit-url)
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
  name: default-pipelinebinding
  namespace: default
spec:
  params:
    - name: git-url
      value: github.ibm.com/$(body.repository.full_name).git
    - name: git-commit-id
      value: $(body.head_commit.id)
    - name: git-commit-author
      value: $(body.head_commit.author.name)
    - name: git-commit-author-date
      value: $(body.head_commit.timestamp)
    - name: git-commit-message
      value: $(body.head_commit.message)
    - name: git-commit-url
      value: $(body.head_commit.url)
    - name: git-branch
      value: $(body.ref)
---
apiVersion: triggers.tekton.dev/v1alpha1
kind: EventListener
metadata:
  name: default-listener
  namespace: default
spec:
  serviceAccountName: build-scc
  triggers:
    - name: zookeeper-build-trigger
      interceptors:
        - ref:
            name: "github"
            kind: ClusterInterceptor
            apiVersion: triggers.tekton.dev
          params:
          - name: "secretRef"
            value:
              secretName: github-secret
              secretKey: secretToken
          - name: "eventTypes"
            value: ["pull_request", "push"]
          - name: "addChangedFiles"
            value:
              enabled: true
        - ref:
            name: cel
          params:
          - name: filter
            value: extensions.changed_files.matches('operator/zookeeper/')
      bindings:
      - ref: default-pipelinebinding
      template:
        ref: default-triggertemplate

when i'm removing the inteceptor, its working fine

{"severity":"info","timestamp":"2024-10-24T10:08:44.859Z","logger":"eventlistener","caller":"resources/create.go:98","message":"Generating resource: kind: &APIResource{Name:pipelineruns,Namespaced:true,Kind:PipelineRun,Verbs:[delete deletecollection get list patch create update watch],ShortNames:[pr prs],SingularName:pipelinerun,Categories:[tekton tekton-pipelines],Group:tekton.dev,Version:v1beta1,StorageVersionHash:lWZRMGzJrT4=,}, name: docker-build-pipeline-","commit":"b133ef7-dirty"}

@khrm
Copy link
Contributor

khrm commented Nov 4, 2024

@savitaashture Can you look into this?

@savitaashture
Copy link
Contributor

Hi @sidharthsudheer20 i tried your example and i don't see any such errors
I got success response in el pod as well as interceptor pod

Interceptor pod log:

{"level":"info","ts":1730807196.560467,"caller":"server/server.go:153","msg":"Interceptor response is: &{Extensions:map[changed_files:README.md] Continue:true Status:{Code:OK Message:}}"}
{"level":"info","ts":1730807196.5625138,"caller":"server/server.go:153","msg":"Interceptor response is: &{Extensions:map[] Continue:false Status:{Code:FailedPrecondition Message:expression extensions.changed_files.matches('operator/zookeeper/') did not return true}}"}

EL pod log

{"severity":"info","timestamp":"2024-11-05T11:46:36.534Z","logger":"eventlistener.event-broadcaster","caller":"record/event.go:364","message":"Event(v1.ObjectReference{Kind:\"EventListener\", Namespace:\"test-1\", Name:\"default-listener\", UID:\"\", APIVersion:\"v1beta1\", ResourceVersion:\"\", FieldPath:\"\"}): type: 'Normal' reason: 'dev.tekton.event.triggers.started.v1' ","commit":"616cae1"}
{"severity":"info","timestamp":"2024-11-05T11:46:36.534Z","logger":"eventlistener.event-broadcaster","caller":"record/event.go:364","message":"Event(v1.ObjectReference{Kind:\"EventListener\", Namespace:\"test-1\", Name:\"default-listener\", UID:\"07964c2a-f4d4-41a1-bb66-2494a11f06fa\", APIVersion:\"triggers.tekton.dev/v1beta1\", ResourceVersion:\"68393\", FieldPath:\"\"}): type: 'Normal' reason: 'dev.tekton.event.triggers.done.v1' ","commit":"616cae1"}

@sidharthsudheer20
Copy link
Author

sidharthsudheer20 commented Nov 6, 2024

@savitaashture Can you provide me the core interceptor configuration ?

@W1zzardTPU
Copy link

W1zzardTPU commented Nov 23, 2024

I just had the same error on a fresh cluster, with a "known good" configuration.

For debugging, I messed around in the Trigger yaml, added/removed sections, disabled "enabled: true" and enabled it again, and it magically worked after that.

  interceptors:
    - name: "Add list of changed files"
      ref:
        name: "github"
        kind: ClusterInterceptor
        apiVersion: triggers.tekton.dev
      params:
      - name: "eventTypes"
        value: ["push"]
      - name: "addChangedFiles"
        value:
          enabled: true <--- I set this to 'false', sent the webhook, got an error message, set it to true, sent it again and it worked

Tekton deployed using ArgoCD. Random guess: maybe there is some timing issue that causes addChangedFiles to break when not all of Tekton is running yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants