Skip to end of metadata
Go to start of metadata

Sometimes, it is useful/necessary to have your builds take several "parameters." Consider the following use case:

  • You set up a test job on Jenkins, and it accepts a distribution bundle as a parameter and perform tests against it. You want to have developers do local builds and let them submit builds for test execution on Jenkins. In such a case, your parameter is a zip file that contains a distribution.
  • Your test suite takes so much time to run that in normal execution you can't afford to run the entire test cycle. So you want to control the portion of the test to be executed. In such a case, your parameter is perhaps a string token that indicates that test suite to be run.

The parameters are available as environment variables. So e.g. a shell ($FOO, %FOO%) or Ant ( ${env.FOO} ) can access these values.

Defining Parameters

First, you need to define parameters for your job by selecting "This build is parameterized", then using the drop-down button to add as many parameters as you need.

There are different parameter types available, and it is extensible, too. The way parameters take effect is also different depending on the parameter type you choose.

String parameter

String parameters are exposed as environment variables of the same name. Therefore, a builder, like Ant and Shell, can use the parameters. Continuing the above example, the following is a simple example:

  1. Reference parameter by name in builder. I'm using the "env" command to show the variable, followed by an echo statement to demonstrate referencing the value:
  2. Run build and observe output toward the bottom of the log (some vars removed for security and brevity):

    started
    [workspace] $ /bin/sh -xe /opt/apache-tomcat-6.0.14/temp/jenkins20854.sh
    + env
    BAR=bat
    ...
    [workspace] $ /bin/sh -xe /opt/apache-tomcat-6.0.14/temp/jenkins20855.sh
    + echo the value of bar is bat
    the value of bar is bat
    finished: SUCCESS
    

Ant works equally well. In the Properties section of the Ant builder, define a build property like:

my.prop=${env.BAR}

Note that because of the case sensitivity difference of environment variables in Windows and Unix, all the environment variables added by parameters are in upper case.


Maven works fine too, e.g. in the Advanced→Properties section of "Invoke top-level Maven targets":

someProperty=$BAR


File parameter

File parameter allows a build to accept a file, to be submitted by the user when scheduling a new build. The file will be placed inside the workspace at the known location after the check-out/update is done, so that your build scripts can use this file.

Define Custom Parameter Types

A plugin can define custom parameter types. See ParameterDefinition for the starting point.

Launching a build with parameters

Parameters are Case Sensitive!

When passing parameters through the URL, casing is important! For example token=TOKEN&MESSAGE=yo will not work if the job defines the parameter as Message.

  • A build can be started just by POSTing to
http://server/job/myjob/buildWithParameters?PARAMETER=Value
  • All parameters need to be properly URL-escaped. To use with wget, quote the URL on the command line too.
  • The parameter delay=0sec can be added to start the build immediately.
  • To use a Run Parameter, the value should be in the format jobname#buildNumber (eg. "&MyRunParam=foo-job%2399" for foo-job #99)
  • If you are using an authorization token to trigger the builds (Job -> Configure -> 'Build Triggers' -> 'Trigger builds remotely (e.g., from scripts)'), you can access:

    http://server/job/myjob/buildWithParameters?token=TOKEN&PARAMETER=Value

    (Note that the & will need to be escaped, or the whole URL quoted, if using a Unix shell script.)

Limitations

Currently the following are the known problems:

  • When build triggers are used to start a build, there's no way to pass parameters. This includes SCM polling, downstream builds, and periodic builds. Instead, the specified default values will be used for string, boolean and choice parameters.

Open issues

How to select multiple parameters while doing "build with parameters".

  • No labels

96 Comments

  1. Unknown User (cbos.ec@gmail.com)

    How can I trigger a build based on a url?

    This is the url without a parameter: http://localhost/hudson/job/jobname/build?delay=0sec (http://localhost/hudson/job/jobname/build)

    Can I add parametername=value? I tried it, but it didn't work. In this example http://localhost/hudson/job/jobname/build?delay=0sec&BAR=FOO\\

    1. Unknown User (t.guieu)

      It works for me, if you "download" the URL with a WGET-like, don't forget to quote this URL.

  2. Unknown User (greg henry)

    Windows Users : use my.prop=%BAR%  in ant properties as value expansion seems to be made by the OS ......

    1. Unknown User (s_baramov@yahoo.com)

      Linux Users:

      my.prop=$BAR
      

      since the same applies for Linux users as well. Or at least in the 1.262 version.

  3. It seems that if a parameter is in a downstream job, the parameter is not set.
    It would be useful to pass parameters to downstream jobs, if they share the same named parameters.

    1. Unknown User (yoonforh)

      I also think so.

      I need to build each svn branches, and there's no easy way to build downstream the branched modules.

  4. A question related to the one by Cees Bos: is it possible to specify build parameters when using the "build periodically" feature?

    There is no other way to parametrize a build, right?

  5. I believe that it would be very useful if the Build Parameters would also work for multi-configuration projects.

  6. It would be great to be able to add not only parameter name and value but also specify some description as well, so when user click on ''Build Now" button the parameterized page would give more helpful info about required parameters. 
    Also in my company we are using mostly boolean based parameters, it would be very useful to add one more type of parameters - Boolean (as a checkbox).

  7. Unknown User (satheeshsat@yahoo.co.in)

    Is there a way where I can pass multiple default values to a single parameter and then select the value of the parameter from a dropdown (which has the default values), and then run the build?

    Seems to be a nice feature to have

  8. Unknown User (lsk@sonlinc.dk)

    Is there a way to access the parameters from the project configuration page?

    If I have a parameter called "Release" holding the release number, it might want to create a custom workspace called "C:\Hudson\Release-$Release" - but this doesn't work. It would be nice to have access to the parameters for use in the project configuration as well.

    BTW: Checking out "<long path>/release/$Release" from Subversion does work, though - very nice, indeed. (wink)

  9. Unknown User (jvizueta)

    How can these parameters be accessed from groovy? I'm trying to set parameters and use them from this plugin: http://techkriti.wordpress.com/2008/08/30/using-groovy-with-hudson-to-send-rich-text-email/

    But I don't get to find the java code in Hudson where it stores a project parameters:

    Here is the code where I'm looking: http://kickjava.com/src/hudson/model/AbstractProject.java.htm

  10. Unknown User (yun.zhi.lin@gmail.com)

    Is it possible to make these parameter values available in all fields outside of the build step? In a custom parametrized build I would like to specify a particular CVS/SVN TAG to build against or a particular Ant TASK to call, however I can't use Parameters for any of these fields.

    The only way would be to call both Ant, CVS/SVN via commandline using Window Batch Command or Execution Shell and passing in the Parameters there. If these Parameters could be recognized in all the standards fields it would be truly awesome. But I guess this is a problem that applies to all Environment Variables in general.

  11. Unknown User (srinivasa.x.muniyappa@sonyericsson.com)

    Is there a possibility to populate the choices dynamically in the dropdown menu of Choice parameter?this will be very helpful for users to select the value for parameter from available options.

  12. I was able to use the parametrized values in the build and SCM setup for a project using the ${PARAMETER NAME}

    syntax.  It's not entirely clear from what's stated above as to what/where/how the parameters are valid, only that they are exposed as environment variables but maybe I missed something.  I'm a bit new to Hudson...

    1. Unknown User (pgelinas)

      It would be great if we could use the parameters anywhere in the project configuration page. I've tried using them in some report plugins (JUnit, checkstyle and the like) with no luck... I've tried $parameterName, ${parameter name} and ${PARAMETER NAME} and none worked...

  13. There is a useful feature in "Trigger builds remotely" section: "Optionally append &cause=Cause+Text to provide text that will be included in the recorded build cause."

    Unfortunately it does not work with parametrized builds (no build cause is recorded). Could you please fix it? Or is there another way to make some comments [encoded into url] viewable on the page with build details?

    Thanks

  14. Unknown User (mmo)

    It doesn't seem to work with Nant
    The keywords ${PARAMETER NAME} or $ {env.PARAMETER NAME} are not recognized
    
    1. Unknown User (shalmali.mahajan@claricetechnologies.com)

      The case of the parameter name has to match with that of the declared name everywhere where it is accessed.

      In Ant, I could access the parameter only when it was not preceded by 'env'.

  15. Unknown User (maeldur)

    Is there a way to post fileparameters using the buildWithParameters remote trigger path?   Whenever I try encoding the parameters using multipart via python ( http://code.activestate.com/recipes/146306/ ), i get internal server errors.

  16. Unknown User (xuwei)

    I want to setup a staged build, e.g. project-unit, project-integration, project-deploy-QA, project-deploy-staging, project-deploy-production.
    I want to make sure the different stage are using the same revision, so can I add a parameter for the revision? the value is dynamicly came from the upstream project.

    or is there any other way to help to do that?

    thanks

    1. Unknown User (miles duke)

      Have you had any luck setting this up?

      We are trying something like this also. Suppose, project B depends upon project A. If a new SCM change affects project A, we want A to build at that version. Because other changes may happen while A is building, we want B to build at the same SCM version.

      We think a parameterized build might help.

      However, we also have the scenario where an SCM change only affects B. In this case, we would like the build on B to start (provided the upstream versions aren't in progress).

  17. Unknown User (boy.pockets.forward@gmail.com)

    I seem to be getting some inconsistent behaviour (or most likely, I don't understand what is happening).

    I have a string parameter:

    LocalOutputPath
    

    I set the value to:

    ${Workspace}\${JOB_NAME}\workspace\bin
    

    When I try and use this in a Windows Batch Command like so:

    cd %LocalOutputPath%
    

    I get this in the Output:

    C:\WINDOWS\system32\config\systemprofile\.hudson\jobs\HudsonUtils\workspace>cd ${Workspace}\HudsonUtils\workspace\bin 
    The system cannot find the path specified. 
    :(
    

    Note:

    ${JOB_NAME}
    

    is the project specific environment variable

    ${Workspace}
    

    is a Global Property (set in the hudson/configure page)

    I am able to access Workspace directly, by using %Workspace% in a Windows batch command.
    But I would have expected ${JOB_NAME} to fail too if ${Workspace} fails.
    It seems that Hudson is evaluating the value of ${JOB_NAME}, but not ${Workspace}.
    
    1. Unknown User (boy.pockets.forward@gmail.com)

      Just a quick note about WORKSPACE and Workspace. They are different variables - upper case is the project specific variable and Cammel case is the Hudson wide variable (something I added). I tried deleting the one i created, but I still had the same problem with WORKSPACE.

  18. Unknown User (erdal.karaca)

    It seems that parameters are not visible to parameters, i.e. I cannot embed declared parameters inside other parameters:

    my.param=value1

    my.other=${my.param}-${JOB_NAME}

    The JOB_NAME will be expanded, my.param not. Is this a 'missing feature' or do I miss something?

    1. P Y

      Hi,
      I second this question, for me this is working just partially (see example below)
      I am passing various parameters using a common one, and some are replaced, some others not:
      Is there any solution available? thanks in advance!
      Pablo
      ----

      (Note: removed "$" and so to avoid formatting issues)

      PRJ_BASE = AB

      DB = d:\casdev\sbxs\ffm-mks1\reg\ PRJ_BASE} \ PRJ_BASE.xy -> d:\casdev\sbxs\ffm-mks1\reg\AB\AB.xy
      XDOC_PATH = d:\casdev\sbxs\ffm-mks1\reg\PRJ_BASE -> d:\casdev\sbxs\ffm-mks1\reg\AB 

      OUTPUT_CONF= JENKINS_HOME\Tools.doc.conf\ PRJ_BASE.doxygen.conf.txt  -> d:\jenkins\Tools.doc.conf\ PRJ_BASE.doxygen.conf.txt

      OUTPUT_DIR= D:\public_html\doc\PRJ_BASE -> D:\public_html\doc\ PRJ_BASE

      WARN_FILE = D:\public_html\log\PRJ_BASE.doxygen.errorlog.txt  -> D:\public_html\log\AB.doxygen.errorlog.txt 

  19. If I want to send multiple parameters, I would say...? http://server/job/myjob/buildWithParameters?PARM1=Value1;PARM2=Value2

    I've gone through ;, & and a few others. I've looked at examples, URL/DNS standards docs, etc and still no luck. Any help here?

    Answer is http://server/job/myjob/buildWithParameters?PARM1=Value1;PARM2=Value2http://server/job/myjob/buildWithParameters?PARM1=Value1&PARM2=Value2

    1. The usual way

      http://server/job/myjob/buildWithParameters?PARM1=Value1&PARM2=Value2
      

      works fine.

    2. So you're saying it works with an ampersand or a semicolon? 

      UPDATE:

      For me, I had to encode the ampersand:

      curl -X POST 'JENKINS_SERVER/job/JOB_NAME/buildWithParameters?token=12345&PARAM=SOME_VALUE' --user my_name:my_pass

  20. How can you do the same for a Maven Release? When I try to perform a Maven Release on a Parameterized job it does not ask for any parameter...

  21. Unknown User (figgs)

    I'm trying to figure out how to do the Parameterized Build with a File Parameter. I understand everything except how to specify the file to be uploaded. Can someone please provide an example?

  22. Unknown User (kedar.java.net@gmail.com)

    1. Unknown User (figgs)

      Yes – it does! Thanks!

  23. Unknown User (jamiet)

    Hi folks,

    Day 1 with Hudson ... slowly but surely getting up to speed.

    My question is about run parameters. I've seen that I can use them to reference a particular run of a particular project - that's all fine.

    What I don't understand (and can't find any docs on) is how I refer to anything in the run defined by the run parameter. Essentially I want to reference the %BUILD_NUMBER% & %SVN_REVISION% of the run that is chosen. How can I do that?

    thanks in advance

    Jamie Thomson

  24. I set a job with parameter.
    It works well with Hudson used in standalone (ie: Tomcat + Hudson webapp).

    I notice a 405 HTTP (error) code is sent back to browser when clicking on a job with build parameters.
    But operations continue....

    Problem appears with a couple like Apache HTTPd and Tomcat 6, and with mod_jk configured to let Apache HTTPd handling errors like 404, 500...

        JkUnmount /errors_pages/* hudson;use_server_errors=400
        JkMount /* qahudson;use_server_errors=400
    

    I had to use the following settings (transforming 404 into 503, a weird hack) and jk won't consider error for HTTP code less than 500.

        JkUnmount /errors_pages/* hudson;use_server_errors=500;fail_on_status=-404,
        JkMount /* hudson;use_server_errors=500;fail_on_status=-404
    

    Could you fix the 405 sent back and use a 200 instead ?

  25. What would be the best process for setting up multiple schedules that each pass in different values for the parameters? Say I have a job that I want to run every 30 minute with a limited test sweet and then once a night I want to call it with the full suite.

  26. Inability to pass parameters to downstream build is a major flaw.  I want to have a separate generic parametrized build and nightly regression test jobs that can be invoked in an arbitrary sequence.

  27. It would be useful being able to trigger another job passing parameters:

    ie. job1 is run with build parameter param1, I would like that job to trigger a job2 with the same parameter. Trigger job2?param2=$param1

    1. Unknown User (muad.dune@gmail.com)

      This plugin support this: [Parameterized Trigger Plugin|]

  28. When triggering a build with parameters, I'm getting a HTTP 302 (redirect) status code:

    $ curl --verbose 'http://MYJENKINS1412/job/MYJOB/buildWithParameters?DRYRUN=true&VERSION=5.0.0'
    * About to connect() to  MYJENKINS1412 port 80 (#0)
    *   Trying 10.14.2.129... connected
    * Connected to MYJENKINS1412 (10.14.2.129) port 80 (#0)
    > GET /MYJOB/buildWithParameters?DRYRUN=true&VERSION=5.0.0 HTTP/1.1
    > User-Agent: curl/7.21.2 (x86_64-apple-darwin10.4.0) libcurl/7.21.2 OpenSSL/1.0.0c zlib/1.2.5 libidn/1.19
    > Host: MYJENKINS1412:80
    > Accept: */*
    >
    < HTTP/1.1 302 Found
    < Server: Winstone Servlet Engine v0.9.10
    < Location: http://MYJENKINS1412/job/MYJOB/

    [..]

    * Connection #0 to host prod.ci.internal.epo.org left intact
    * Closing connection #0

    Why not simply returning a status code of 200 if job was submitted successfully? If redirection is required, then either provide a 'redirect trigger URL' or let user add a 'redirect=true' parameter (where redirect is reserved and can't be used as regular parameter name).

  29. Triggering a build with parameters works as HTTP GET, as HTTP HEAD, as HTTP OPTIONS  .. and as HTTP POST request. So, regardless which HTTP vocabulary is used, a build is triggered. You may ask yourself whether this makes sense or not.

    While POST is the right way of doing, what's wrong with GET in the first place? Imagine a webpage listing a long list of triggerable jobs, all written down in terms of HTTP GET. Imagine further that one of this powerful web crawlers comes along the way to index this page. That crawler would trigger all jobs by following those (GET) URLs. Something you would like to avoid.

  30. This may have been addressed in previous postings -but- I had setup a job with parameters when using hudson, now when using Jenkins I cannot add new parameters to this job anymore. Has anyone run into this problem?

  31. Is there an opportunity to assign other parameters to one specified parameter, for example: I have a choice parameter with 3 values (v1, v2 and v3). If "v1" is selected on the page after the build button is clicked, two or more other text parameters are visible. If "v2" is selected, only the choice parameter dropdown list is shown?

    In the picture "v1" is "DEV" and "v2" is "LIVE".

  32. I love this plugin!   My only issue right now is that I want to build a Jenkins job whose CVS repository is dynamic.  I'm selecting a 'Choose' parameter, where the user picks his/her CVS repository from the dropdown, to set the 'CVS_PROJECT' parameter.  Unfortunately, I am getting the following error when I try to define the CVS module as 'CVS_PROJECT'.

    Started by user trandal
    [BUILD_RULE_TEST_YOUR_PROJECT] $ "C:\Program Files\CVSNT\cvs.exe" -Q -z3 -d :pserver:buildeng@aixdev1:/cvs/cgi co -P -d workspace -D "Monday, August 29, 2011 10:24:27 PM UTC" CVS_PROJECT
    cvs server: cannot find module `CVS_PROJECT' - ignored
    FATAL: CVS failed. exit code=1
    Finished: FAILURE
    

    Is there some way to define this so I can define the module using the parameter? Thank you!

    Note:  Looks like they're already managing multiple JIRA issues on this [JENKINS-3230] - in the meantime, I used the EXCELLENT instructions provided here.

  33. I'm using pipeline plugin in Jenkins. I have the following job setup:

    - Job A -> parametized build trigger Job B

    - Job B -> parametized build trigger Job C

    When I use the pipeline plugin starting with job A, I can see job B as a downstream job but not job C (or other jobs that C may kick off)

    I assume this may be part of this Jira issue https://issues.jenkins-ci.org/browse/JENKINS-5184

    Can I get an indication if this is a bug in the plugin or if it could be a bug in the Pipeline plugin.

  34. I have a question regarding Run Parameters. I have a Jenkins job (job A) that has a run parameter named 'build' referencing to the builds of another Jenkins job (job B). In the build script of job A, when executing '$ env' to display the environment variables, I see there are three variables generated by this Run Parameter. They are, 1- build  2-build.jobName 3-build.number. And as far as I know, a bash variable name is not allowed to contain the dot '.' character. So my question is how to read the two variables (build.jobName & build.number) generated by the plugin?

  35. How come the default value of a Text Parameter can't be a multi-line value? When I start a build I can then break it into multiple lines but can't have the default value already broken into several lines.

    I was expecting this to be the difference between the String value and the text value.

    1. I was expecting this as well.

      What is the diff b/n a sting and a test field?

      Is there any way of passing in a multi-line value, like for a build matrix target list?

  36. I am not able to print parameterized value while printing.

    I am following the described steps.
    --------------------------------------------------------------------------
    step 1:
    Build a free-style software project

    step 2:
    IN configuration page, I have selected the option 
    "This build is parametreized"

    Step 3:
    Provide String parameter
    Name  : VERSION
    default value  : RELEASE
    dESCRIPTION  : abcd

    Step 4:

    Under the build section
    SSH Site : My personal linux server
    Command: : echo JAVA_HOME  WORKS FINE echo $VERSION echo "$version" RETURNS Blank line.
    Step 5Save the oncfirations

    Step 6
    Go to home page of job now.

    Step 7
    For triggering build,
    Click on "Build Now"
    (Located on Top Left)

    Step 8.
    We gets a screen to provide the parametreized values
    I provide some default value.

    Step 9
    Click on "Build"
    This step helps me trigger Build.
    -------------------------------------------------------------------------

    Command: : echo JAVA_HOME  WORKS FINE echo $VERSION echo "$version" RETURNS Blank line.
    Am i doing something wrong?. Please Help ?

    1. Hi Jatin,

      I am facing exactly the same problem. Did you manage to find a solution?

      Thanks.

  37. I'm noticing a strange behavior with $WORKSPACE variable on Linux.  If the job runs on master, it's an absolute path.  But if the job runs on a slave, it shows a relative path.  Has anyone come across this issue?

    To reproduce the issue:

    1. Setup a job with build command "export" and tie it to master and run it.

    2. Examine the build console log and look for WORKSPACE=  You'll see that this is an absolute path.

    3. Modify the job to run on a slave node and run it.

    4. Examine the build console log and look for WORKSPACE=  You'll see that this is a relative path. 

  38. How can I read multiline'd value from Text Parameter

  39. I am sending parametrized links to a job to authorized people so they can start they job they wish.

    I have a problem when they are not logged in :

    - The person clicks the link

    - They get the log in page instead of the build page.

    - They log in.

    - The build starts without parameters.

    - The build fails.

    Any help would be appreciated

  40. Hello all,

    I can't pass parameters to build by URL. I try this one:

    JENKINS_URL/job/CCBL_Test/buildWithParameters?PROJECTS=Test

    PROJECTS is the name of Extended Choice Parameter plugin i added in the job configuration.

    If I use basic parameters like string, it works fine but with plugins extensions it doesn't.

    What I'm doing wrong? 

    Please advice, 
    Thanks

  41. Hi,

    I am trying to do a parameterized build and here's what I am doing:

    1. Build a free-style software project

    2. This build is parameterized

    3.Provide String parameter
    Name  : ORACLE_SID
    default value  : HOST1DB01
    dESCRIPTION  : HOST1DB01

    4. Build

    Execute shell script on remote host using ssh
    SSH Site : HOST1
    Command: : echo Oracle SID is $ORACLE_SID

    5. Save

    When I run the build, it doesn't print the value of ORACLE_SID. Instead it prints blank.

    Can someone help please?

    Thanks.

    1. Hi Kumar,

      is it possible that the parameter you want to use only exists on the machine where the build runs? I think the parameters where saved as environment variables and they couldn't be used as a parameter in a shell script on remote host using ssh.

      I hope that answers your question.

      1. Hi Martin,

        These parameters are to used on the remote machine. I can define them on the remote machine, but in that case I will have to create a job for each machine. If there was a way to pass the parameters via jenkins, 1 job would have done.

        Thanks.

  42. Is it possible to select the machine that a job runs on via parameters?

    We have a job that installs a new version of the product. I would like it to prompt the user for a directory, and the slave to install on.

    It's easier than having to reconfigure the job every time to run on a specific slave.

  43. Unknown User (joaquin.corchero@gmail.com)

    Hi,

    I'm quite new in Jenkins so I'm sorry if the question seems a bit stupid...

    I'm having a bit of an issue when trying to set a parameter value within a project that will later be used by other projects within the deployment pipeline...

    I installed the parameterized build plugin and created a string parameter which value I'm trying to set within a batch command in the bulid triggers section of the project, the issue is that that value doesn't seem to be working very well as once the job has run, if I go to the deployment pipeline, the parameter doesn't have any value...

    Thank you for your help

  44. Unknown User (kumarganesh20)

    Hi,

    I am triggering my build using jenkins as follows

    from jenkinsapi.jenkins import *
    from jenkinsapi.job import *

    jenkin = Jenkins('http://hudsonserver','username','password')
    myJob = Job("http://hudsonserver/job/sample_trigger_build/","sample_trigger_build", jenkin)
    parameter="sample_file.txt":"/home/user/sample_file.txt"
    myJob.invoke('build',False,False,3,15,parameter)

    I am getting urllib2.HTTPError: HTTP Error 500: Internal Server Error. Please help me in this. Thanks in advance.

    Note:parameter will come inside parenthesis, while posting, if i use parenthesis it is giving unknown macro error.

  45. Hi All

    Is there a way to change/set the value of a pre-defined string parameter in the build script ?

    Basically I want to change the recipient of the email plugin based on the output from the build. The easiest was I could find was to set a build parameter which can be used by the editable email plugin. 

    The Editable email plugin gets the build parameter. I am not able to change/set the value of the parameter to the value I want inside the build script. 

    Thanks in advance

    -mastkis

  46. Hi,

    When use file parameter to set,Contains Chinese parameters will become garbled.

    How can I configure?

  47. Where is this plugin now ? renamed or merged ? I can't find it plugin repo.

  48. It would be good if you give an example of curl command to trigger a remote build.

    Since it was changed to POST, you need to add to your command "-X POST"

  49. Hello,

    i try to upload a file trough the option "file-parameter" into the workspace. This failed!

    I get this result:
    The permission of the worspace folder of this job is set on "full control" for the user of the Jenkins service

    Did anyone faced this issue?

    Thanks in advance
    Andre

  50. Hi,

    is it possible to use parameters given in the build url which are not configured in the job? An example:

    Thanks in advance,
    Tobias

  51. When a default value for a string parameter is not given, it seems to just set the last word following a - in the name parameter value as it's value. We have a parameter that may at times be an empty string and we want that to just be the value. Is this possible? Is this just a bug?

  52. Hi,

    It's elegantly made with File parameter plugin!

  53. Hi,

    I was using this plugin for quite a long time to trigger my jobs remotely over POST request from my webpage. When I was triggering the job I used to have jenkins page opened in a separate tab with the job being launched and running. 

    But after recent updates I don't get the page loaded anymore, however new tab is opened but with no content and the job is actually being triggered and executed. 

    Unfortunately I didn't notice which exact version affected this. Currently I'm using latest version - 1.578 and the issue still persists.

    Please suggest how I can resolve this.

    Thanks,

    Oleg

    1. Hi Oleg,

      I too have this problem with Jenkins 1.584. I also see that some jobs run twice or thrice with a single trigger.

      1. Hi Jaise,

        I see the same issue that one trigger add two jobs to queue, one with entered parameters and another with default parameters. Did you figure out how to solve it?

        Thanks

        Shaolin

        1. I'm passing the branch name as a parameter, and there are multiple candidate revisions for my branch name, Jenkins then trying to build all these revisions. see the following logsusing GIT_SSH to set credentials
          > git.exe fetch --tags --progress repository.git +refs/heads/:refs/remotes/origin/
          > git.exe rev-parse "feature/Shaolin/branch-name^

          Unknown macro: {commit}

          " # timeout=10
          > git.exe rev-parse "refs/remotes/origin/feature/Shaolin/branch-name^

          " # timeout=10
          Multiple candidate revisions
          Scheduling another build to catch up with Manual_Build_With_Parameters

          1. I know this is 4 years old, but in case anyone is still having the same problem, I had this issue when using "origin" as the "Name" of my git repository in the job's settings, and then using e.g. "abc/def" as my branch specifier. Removing the Name and instead using "origin/abc/def" as my branch specifier fixed the issue.

    2. Hi.  I seem to see this same thing on Jenkins 1.592.  I only started using this method, POSTing a link from one Jenkins job results page to start another job, and was perplexed by the blank page, but the second job is getting started correctly as you say.   You  state that it used to actually show the job running, which is what i was expecting.  So, I'd like to see this former behaviour restored too,  so that the newly started job is displayed instead of a blank page.

  54. we are starting to use this plugin to launch jobs from our source repository hooks..

    the job is successfully queued, but we get a huge blast of javascript & html data back. Our jenkins server has a few hundred jobs on the main page. I saw one wget response of 32m!..

    is there a way to suppress this unneeded output?

    right now I am redirecting the output to /dev/null, but it still needs to be transmitted, and sometimes the sender is on the other side of a slower WAN link.

  55. Hi all,

    It seems, open issue (How can i pass the configured parameter to the maven execution of the build?) was resolved with JENKINS-20884. I updated Maven Project Plugin to the latest version (2.7) and luckily am able to use String Parameter in "Goals and options" field of Maven build. If someone else could confirm this, the wiki page can be updated.

    Regards,

    Ali Sadik Kumlali

    1. Verified & updated wiki page

  56. I would like to take a successful build job for a parameterized Jenkins project that succeeds and capture the parameters into a new non-parameterized project.  Doesn't seem really hard, but .... is there a magic button to do this?

    Thanks

    Andrew Wolfe

  57. Any way to kick of a build by hitting a url and then immediately show the console output to make sure it was successful? Such as a query string parameter that I could pass in.  My goal here is to allow users to click on a link from a email and then have jenkins run the job and show the user the log indicating it was successful.  Without this feature they just get a blank screen after the post happens.  for example something along the following lines would be nice.

    http://server/job/myjob/buildWithParameters?token=TOKEN&PARAMETER=Value&showconsoleoutput=true

  58. Hi,

    I try to make ant <post to=""><prop .../></post> action but I can not execute this type of action with a token

    My code 

     <post to="${cip.url}/createItem" failonerror="true">
       <prop name="token" value="${token}" />
       <prop name="name" value="${jobName}" />
       <prop name="mode" value="copy" />
       <prop name="from" value="${cip.@{next-env}.template.name}" />
     </post>
    

    I try to add directly the token after "/createItem" but nothing works :

    [post] X-You-Are-Authenticated-As=anonymous
         [post] Set-Cookie=JSESSIONID.24fab6d0=1moqgg0nokwf63hnoqkeij1j1;Path=/
         [post] null=HTTP/1.1 403 Forbidden
         [post] X-Required-Permission=hudson.model.Item.Create

    [post] X-You-Are-Authenticated-As=anonymous
    
    [post] null=HTTP/1.1 403 Forbidden
    
    [post] X-Required-Permission=hudson.model.Item.Create
    

    The token matches to my super admin user (with create right).

    anyone have any idea ?

    Thanks a lot

  59. Hi ;

    I just post a little step by step (using Build+Token+Root+Plugin ) here: http://goo.gl/aWPNNM

    hope this helps

  60. I have Phabricator and Jenkins integrated. It is a parameterized build. The build is manually triggered in Phabricator. Whenever I set the post build actions to archive the artifacts, the build fails saying that artifact does not exist. I am trying to kick off a build of some Java code; simple "Hello World" stuff. I'm just trying to get Jenkins and Phabricator configured correctly. I followed the directions from the Phabricator-differential plug-in Jenkins wikie page: github.com/uber/phabricator-jenkins-plugin.

    However, when I kick off a parameterized build in either Phabricator or Jenkins, there are no results. My goal is for Jenkins to generate .jar files as artifacts after I kick off a build of Java code. I did try to configure Jenkins with post-build actions to "archive the artifacts." That however causes the builds to fail because there are no artifacts. I am doing a parameterized build. The builds pass, but nothing is generated. The build executes successfully, but as I understand it there should be something generated as a result of that build (jars/wars). My issue is that is not happening at all. As I understand it, Jenkins should generate some artifact after a successful build. However, there are no artifacts showing up in Jenkins

    In Jenkins, the build output is:
    `Building in workspace /var/lib/jenkins/jobs/DansItem/workspace
    ignore-build No differential ID found.
    plugin-provider 'cobertura' plugin not installed.
    non-differential-harbormaster Sending diffusion result as: SUCCESS
    Finished: SUCCESS
    `

    There is nothing in the workspace for that build. Looking at Jenkins documentation, building Java code should result in some .jar .war files. My Jenkins build creates nothing. In Phabricator, there is an artifact tab, that is just a link back to Jenkins.

    I have tried setting the post build actions to archive the artifacts, but whenever I set a post build action, the build fails. I have tried just setting a single wildcard (star) character, and the job fails saying there are no artifacts found. The build fails regardless of what I set the files to archive in the post build actions.

  61. I have problem in retrieving list of build parameters from json api before confirming them and passing to trigger the build. My job contains parameter which is generated dynamically using groovy script can I get the choices from that field from JSON api.

  62.  In my Jenkins Version (2.19.1), I have the option called "This project is parameterized" instead of "This build is parameterized". What is the difference between them? And I need this plugin to download. I can't find the download option anywhere on this page. Could you please provide the download option for this build? Thanks...

  63. For me File Parameter is not copying files to workspace.  Jenkins Version 2.7.4. As mentioned by Srikanth Reddy Kota I too have the option called "This project is parameterized" instead of "This build is parameterized".

    1. If it helps someone. I wasn't specifying File Location hoping it would place in the workspace by default.

      1. Hi Yadav,

        Were you able to get around this problem..? I just bumped on your comment & thought to help.

         

        Cheers

        MJ

  64.  

    I am trying to update configuration of Jenkins jobs created using job template through rest API.

    Below is the syntax i used for POST through Post man & below is the error message i am getting.

     

     

    https://jenkins01.ABC.com/job/ABC_Express/job/Test_Pipeline/buildWithParameters?artifactVersion=1234&build?delay=0sec

     

    ERROR:

     

    Request processing failed. URI=/job/ABC_Express/job/Test_Pipeline/buildWithParameters ErrorID=356eb652-29a3-4aac-9721-d4fbc57c4697

    java.lang.IllegalStateException: This build is not parameterized!  

     

    Please let me know if anyone have workaround for updating the job configuration through API

    1. I have the same error. I've tried everything. Please share your solution if you found one.

      I've documented my issue here https://stackoverflow.com/questions/49892250/jenkins-buildwithparameters-post-request-fails-because-this-build-is-not-param.

  65. I am trying to post a file parameter to a  buildWithParameters remote trigger path which has to trigger jenkins build. But still with no success.

    Can anybody help me on this?

  66. We just discoverd that parameters of one Pipeline job affect the parameters of other jobs if they have the same name. Is this normal? San I configure that parameters are only valid for one specific Job.

    Example: Two jobs have the Parameter "BranchSpecifier". I set the Parameter in Job A to "develop" and in Job B to "master". What is happening is that both Jobs are using the same value (in this case "master")

    Note: the mentioned parameter in the example is used in the Job config as specifier for the branch the job will use to check out the Pipeline scripts from our Pipeline repo. This way we can trigger the job using pipeline scripts  from another branch (for tests).

  67. I am trying to pass a parameter TAG number using  buildWithParameters remote . But still with no success.

    curl -X POST http://jenkins:tokenid@hostnamejenkins:8080/job/api-hml/job/loteapi-hml/buildWithParameters?token=tokenid&PARAMETER=0.1.1

    console output:

    Started by user JENKINS
    Building in workspace /apps/.jenkins/workspace/api-hml/loteapi-hml
     > git rev-parse --is-inside-work-tree # timeout=10
    Fetching changes from the remote Git repository

    ...

    +refs/heads/*:refs/remotes/origin/*
     > git rev-parse refs/tags/^{commit} # timeout=10
     > git rev-parse refs/remotes/origin/refs/tags/^{commit} # timeout=10
     > git rev-parse refs/tags/^{commit} # timeout=10
    ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
    Finished: FAILURE


     

  68. Hi Team,

       The file parameter only works with free style job not with pipeline  JOB , Any idea or intention why it is not working on both. Appreciate if you can lead up to some answer

         java.lang.NullPointerException at hudson.model.FileParameterValue.doDynamic(FileParameterValue.java:205) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117) at org.kohsuke.stapler.MetaClass$11.dispatch(MetaClass.java:397) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)

  69. Hi Team,

    Can we define a vaiable in a parameterized build? My scenario is, I have parameterized build and inside the build section I have execute shell where I define a variable and then echo to print it. But it doesn't print anything in the console output.

    I hope I have made myself clear. Could anyone please answer my question?

  70. Can the build with parameters be used for the multilevel projects?