gogs-webhook-plugin icon indicating copy to clipboard operation
gogs-webhook-plugin copied to clipboard

Job not found

Open fgm opened this issue 4 years ago • 1 comments

  • Gogs version (or commit ref): 0.12.0+dev
  • Jenkins version: 2.222.3
  • gogs-webhook-plugin version: 1.10.15
  • Jenkins modules used in combination with gogs-webhook-plugin: none
  • JSON Output of webhook:
    • Request:
      Request URL: https://(server)/gogs-webhook/?job=thejob
      Request method: POST
      Content-Type: application/json
      X-Github-Delivery: 2650ce88-b70f-4425-8e8c-ec79bcbfe6af
      X-Github-Event: push
      X-Gogs-Delivery: 2650ce88-b70f-4425-8e8c-ec79bcbfe6af
      X-Gogs-Event: push
      X-Gogs-Signature: 
      
    • Response
      Content-Length: 69
      Content-Type: application/json
      Date: Wed, 20 May 2020 13:46:54 GMT
      Server: Jetty(9.4.27.v20200227)
      X-Content-Type-Options: nosniff
      
      {"result":"ERROR","message":"Job 'thejob' is not defined in Jenkins"}
      

Description

This seems similar to my original issue in #8, but more recently #36 as I first had the issue with the job in a folder (thefolder/thejob), so I recreated it at root, without a folder, and it is listed with the standard Jenkins API. It may be related to #22 as this is a multibranch pipeline.

(server)/api/json?tree=jobs[name,builds[number,actions[parameters[name,value]]]]&pretty=true

  "_class": "hudson.model.Hudson",
  "jobs": [
    {
      "_class": "com.cloudbees.hudson.plugins.folder.Folder",
      "name": "thefolder"
    },
    {
      "_class": "org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject",
      "name": "thejob"
    }
    {
      "_class": "hudson.model.FreeStyleProject",
      "name": "test",
      "builds": [
        
      ]
    }
   ]
}

Branch discovery works normally in the Jenkins UI. When I use the same format to test a non-multibranch job (the test job), it works normally, hence the link to #22. Such normal jobs also work in folders (calling ?job=thefolder/test)

Same error when trying the hook on ?job=thejob/master, although it works with other branches beyond master, as described near the end of #8.

fgm avatar May 20 '20 13:05 fgm

I /think/ I found what's happening: apparently, if a branch does not contain a Jenkinsfile it is marked as not found, which may or may not be desired, but should probably be documented.

fgm avatar May 20 '20 14:05 fgm