• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins ver. 1.625.3
      build-token-root v1.4

      I'm trying to trigger a job configured to accept a file parameter named dist.
      Triggering this job works fine from the Jenkins web UI and curl (if I provide user:token credentials).
      POSTing to /buildByToken/buildWithParameters?token=... with the same form data triggers a build, but no matter what I try the file isn't passed on to the job.

      Works:

      curl -X POST "https://.../job/.../build?token=..." \
      --user user:api-token \
      -F file0=@$(shell pwd)/dist.json \
      -F json='{"parameter": [{"name": "dist", "file": "file0"}]}'

      Doesn't work:

      curl -X POST "https://.../buildByToken/buildWithParameters?job=job&token=..." \
      -F file0=@$(shell pwd)/dist.json \
      -F json='{"parameter": [{"name": "dist", "file": "file0"}]}'

      The issue might be related to the fact that Jenkins seemed to ignore the file when I POSTed to /buildWithParameters, it only worked when posting to /build.

      Thanks in advance!

          [JENKINS-38658] File parameters are ignored

          Victor Hallberg added a comment - - edited

          It looks like /buildWithParameters doesn't support files:
          http://stackoverflow.com/a/18051907/1527562

          I haven't looked at the plugin source code, but this might be solved by simply allowing parameters to be passed to /buildByToken/build, enabling the following:

          curl -X POST "http://.../buildByToken/build?job=job&token=token" \
          -F file0=@/dist.json \
          -F json='{"parameter": [{"name": "dist", "file": "file0"}]}' \
          -F delay=0sec
          java.lang.Exception: Use /buildByToken/buildWithParameters for this job since it takes parameters

          Victor Hallberg added a comment - - edited It looks like /buildWithParameters doesn't support files: http://stackoverflow.com/a/18051907/1527562 I haven't looked at the plugin source code, but this might be solved by simply allowing parameters to be passed to /buildByToken/build, enabling the following: curl -X POST "http://.../buildByToken/build?job=job&token=token" \ -F file0=@/dist.json \ -F json='{"parameter": [{"name": "dist", "file": "file0"}]}' \ -F delay=0sec java.lang.Exception: Use /buildByToken/buildWithParameters for this job since it takes parameters

          The build root token plugin is great. But it's really unfortunate that is doesn't support file parameters.

          Pieter Vogelaar added a comment - The build root token plugin is great. But it's really unfortunate that is doesn't support file parameters.

          Any updates on the issue? Once you disabled jenkins-cli.jar and SSH remote invocation, the only way to start a job with parameters is curl. curl to /build doesn't work as doesn't return job id (JENKINS-30317) and /buildWithParameters doesn't accept file parameters. So currently I'm fully blocked.

          Alexander Rudnev added a comment - Any updates on the issue? Once you disabled jenkins-cli.jar and SSH remote invocation, the only way to start a job with parameters is curl. curl to /build doesn't work as doesn't return job id ( JENKINS-30317 ) and /buildWithParameters doesn't accept file parameters. So currently I'm fully blocked.

          Jesse Glick added a comment -

          Have you tried using the file-parameters plugin instead? https://github.com/jenkinsci/file-parameters-plugin/issues/18

          Jesse Glick added a comment - Have you tried using the file-parameters plugin instead? https://github.com/jenkinsci/file-parameters-plugin/issues/18

            Unassigned Unassigned
            victorha Victor Hallberg
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: