Search code examples
jenkinsjenkins-pipelinecicd

Jenkins webhook and no such DSL method error


My environment

  • Ubuntu 22.04
  • Jenkins deploy within K3s, using bitnami/jenkins helm chart.
    • Jenkins version: 2.387.3
  • I use only one jenkins node.

Webhook

I created a pipeline job like this and the system log record webhook received already, but the job doesn't trigger. I don't know if I miss any step here ?

Job configuration

Webhook received

No such DSL method 'pipeline' found among steps

I have to manually trigger the job to test, cause the webhook doesn't trigger it. I know that's a high chance that

  • I missed install Pipeline plugin and all of its dependencies. But I installed it and checked with its dependencies list here.

  • There might be some typo in the Jenkinsfile. But since I got that error, I tried with barely just hello world template like this, but the error still occur. Simple jenkinsfile template Original jenkinsfile template error

  • There might be some weird character prior to pipeline definition, so for safety, I hand type the whole file, but nothing changed.

  • I tried if I don't use Pipeline script from SCM, but use the exact same template with native Pipeline script template, it success, regardless Pipeline plugin enable or not Assumption

I don't know if I miss anything here... if we need other information to troubleshoot this, I'll update them.


Solution

  • After a whole week struggling with documents, it turns out that we shouldn't create Jenkinsfile within windows environment as they automatically append some short of character at the beggining of the file no matter we hand type or copy paste the content.

    When I create it in wsl, everything works fine.