[JIRA] (JENKINS-40241) Detemine parameters before running job

1 view
Skip to first unread message

mneale@cloudbees.com (JIRA)

unread,
Dec 5, 2016, 11:25:02 PM12/5/16
to jenkinsc...@googlegroups.com
Michael Neale created an issue
 
Jenkins / New Feature JENKINS-40241
Detemine parameters before running job
Issue Type: New Feature New Feature
Assignee: Andrew Bayer
Components: blueocean-pipeline-editor-plugin, pipeline-model-definition-plugin
Created: 2016/Dec/06 4:24 AM
Priority: Major Major
Reporter: Michael Neale

When job parameters are defined in the Jenkinsfile/script, Jenkins doesn't know what parameters are required until the job is run. You see the problem? to run the job you need the parameters. To know what parameters are required to run the job.

In scope:

  • Investigate if it is possible to know without executing what parameters will be required
  • If possible, an api to return such parameters

This could span general pipeline script, or pipeline model.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

andrew.bayer@gmail.com (JIRA)

unread,
Dec 19, 2016, 10:51:01 AM12/19/16
to jenkinsc...@googlegroups.com
Andrew Bayer commented on New Feature JENKINS-40241
 
Re: Detemine parameters before running job

So I'm only thinking in terms of Declarative for the moment, because, well, viability.

The first thing coming to mind is to have the logic that takes the {{parameters

{ ... }

}} section check if each parameter is already defined on the job at that point (with the same type too), and if not, add an environment variable for the parameter name using the default value for the parameter. i.e., the first run still would not prompt for parameters, but it would act as if the default parameters had been specified.

andrew.bayer@gmail.com (JIRA)

unread,
Dec 19, 2016, 12:34:01 PM12/19/16
to jenkinsc...@googlegroups.com
Andrew Bayer edited a comment on New Feature JENKINS-40241
So I'm only thinking in terms of Declarative for the moment, because, well, viability.

The first thing coming to mind is to have the logic that takes the {{parameters { ... } } } section check if each parameter is already defined on the job at that point (with the same type too), and if not, add an environment variable for the parameter name using the default value for the parameter. i.e., the first run still would not prompt for parameters, but it *would* act as if the default parameters had been specified.

andrew.bayer@gmail.com (JIRA)

unread,
Dec 19, 2016, 12:36:01 PM12/19/16
to jenkinsc...@googlegroups.com

Also - the editor knows the parameters defined in the Jenkinsfile (even if the job isn't run) since it's parsing the Jenkinsfile. Not sure how we could get this to Blue Ocean for kicking off builds without also doing a Jenkinsfile parse there too...

andrew.bayer@gmail.com (JIRA)

unread,
Dec 19, 2016, 7:29:02 PM12/19/16
to jenkinsc...@googlegroups.com

So since https://github.com/jenkinsci/workflow-cps-plugin/pull/60 landed, there's a new global variable, params. If you do a properties call adding parameters (let's say we add one named foo) and then do params.foo afterwards in the same run, you'll get the default value for foo, assuming one was defined. It's still not possible to prompt the user for parameters before having the build run with properties, but at least you can prevent the build from breaking due to undefined parameters this way. Thoughts as to whether that's sufficient? Should we also add it to the env global variable?

mneale@cloudbees.com (JIRA)

unread,
Dec 19, 2016, 8:38:03 PM12/19/16
to jenkinsc...@googlegroups.com
Michael Neale updated an issue
 
Change By: Michael Neale
When job parameters are defined in the Jenkinsfile/script, Jenkins doesn't know what parameters are required until the job is run. You see the problem? to run the job you need the parameters. To know what parameters are required to run the job.

This is most visible with a new branch in multibranch jobs (there have been complaints).

In scope:
* Investigate if it is possible to know without executing what parameters will be required
* If possible, an api to return such parameters


This could span general pipeline script, or pipeline model.

mneale@cloudbees.com (JIRA)

unread,
Dec 19, 2016, 9:50:03 PM12/19/16
to jenkinsc...@googlegroups.com
Michael Neale commented on New Feature JENKINS-40241
 
Re: Detemine parameters before running job

hrm ok.. this may have to sit in the backlog for a while.

So whilst PR#60 helps with error message, it is still a broken UX that pops up for the wrong things... so we may need to park this for some future work to make it work out ahead of time what the params are via some kind of evaluation... I don't think this is a problem specific to declarative, and perhaps declarative shouldn't solve it?

mneale@cloudbees.com (JIRA)

unread,
Dec 20, 2016, 2:11:01 AM12/20/16
to jenkinsc...@googlegroups.com
Michael Neale edited a comment on New Feature JENKINS-40241
hrm ok.. this may have to sit in the backlog for a while.

So whilst PR#60 helps with error message, it is still a broken UX that pops up for the wrong things... so we may need to park this for some future work to make it work out ahead of time what the params are via some kind of evaluation... I don't think this is a problem specific to declarative, and perhaps declarative shouldn't solve it?


EDIT: I am prepared to park this and then let things come in as bug reports... more thought is needed ...

domi@fortysix.ch (JIRA)

unread,
Dec 22, 2016, 8:34:01 AM12/22/16
to jenkinsc...@googlegroups.com

Andrew Bayer although the params really works well, I would still add them to env too - thats just what people are used to.

jdumay@cloudbees.com (JIRA)

unread,
Jan 3, 2017, 6:53:01 PM1/3/17
to jenkinsc...@googlegroups.com
James Dumay updated an issue
 
Change By: James Dumay
Priority: Major Minor

jdumay@cloudbees.com (JIRA)

unread,
Jan 3, 2017, 7:01:04 PM1/3/17
to jenkinsc...@googlegroups.com

vivek.pandey@gmail.com (JIRA)

unread,
Jan 4, 2017, 10:15:05 AM1/4/17
to jenkinsc...@googlegroups.com

Andrew Bayer params.foo will give it's default value, how about type? Can we get type value without executing a run of the script?

jdumay@cloudbees.com (JIRA)

unread,
Feb 14, 2017, 9:36:03 PM2/14/17
to jenkinsc...@googlegroups.com
James Dumay updated an issue
Change By: James Dumay
Sprint: post-release

jdumay@cloudbees.com (JIRA)

unread,
Feb 14, 2017, 9:36:03 PM2/14/17
to jenkinsc...@googlegroups.com
James Dumay updated an issue
Change By: James Dumay
Priority: Minor Major

jdumay@cloudbees.com (JIRA)

unread,
Feb 19, 2017, 3:52:02 PM2/19/17
to jenkinsc...@googlegroups.com
James Dumay updated an issue
Change By: James Dumay
Sprint: post-release 1.1

jdumay@cloudbees.com (JIRA)

unread,
Feb 19, 2017, 4:23:01 PM2/19/17
to jenkinsc...@googlegroups.com
James Dumay commented on New Feature JENKINS-40241
 
Re: Detemine parameters before running job

This came up in discussion with a CB customer (for Script, but I was discussing that this was more viable to do in Declarative). Apart from schedule, what seems to be the blocker here?

jdumay@cloudbees.com (JIRA)

unread,
Feb 19, 2017, 9:58:01 PM2/19/17
to jenkinsc...@googlegroups.com
James Dumay updated an issue
Change By: James Dumay
Priority: Major Critical

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:25:12 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Duplicate
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages