'Parameters from properties file' not working in 2.7.3

422 views
Skip to first unread message

Steve K

unread,
Oct 3, 2016, 10:44:37 AM10/3/16
to Jenkins Users
Hello,

Several of my jobs use 'Parameters from properties file' to pass settings to downstream jobs.
The configuration I used in Jenkins 1.625.3 does not appear to work with 2.7.3

I wrote two very simple jobs; one to create a parameter file that was used with 'Trigger parameterized build on other projects' and one downstream job to just dump environment variable settings.
The parameter file was created with no problem.
I had selected 'Don't trigger if any files are missing', so I know the parameter file was in the expected location.
None of the variables set in the parameter file were set in the downstream job.

Is there some nuance of Jenkins 2.x that I am unaware of that is preventing my 'Parameters from properties file' from being passed to my downstream job?

In case it's relevant, the Jenkins server is CentOS and the build machine is Windows 8.1

Thanks in advance for any help you are able to provide.

Steve K.


Eric Pyle

unread,
Oct 3, 2016, 10:57:33 AM10/3/16
to jenkins...@googlegroups.com

Most likely this is because of changes made to address Jenkins issue SECURITY-170 (see Security Advisory). A job is no longer allowed to accept parameters not explicitly defined in the downstream job.

Eric

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b12eeaba-5b5f-4531-984e-1350bfe28524%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve K

unread,
Oct 3, 2016, 1:15:24 PM10/3/16
to Jenkins Users

Eric, I think you're right. My problem is caused by the new security policies.
I have not found the right combination of settings to make things work as before.
I tried starting Jenkins with -Dhudson.model.ParametersActon.keepUndefinedParameters=true, but that did not solve the problem.
Have you needed to make similar adjustments?

Thanks.







Eric Pyle

unread,
Oct 3, 2016, 1:35:39 PM10/3/16
to jenkins...@googlegroups.com

We just upgraded our Jenkins from 1.642.3 to 2.7.4 and with that issue in mind, we did add the keepUndefinedParameters=true. We haven't seen any problems. We do have some jobs that trigger a downstream job with parameters from a properties file. Is that what you're doing? Or are you using "Inject environment variables to the build process", using a properties file, in the downstream job? Or something else?

Eric

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Steve K

unread,
Oct 3, 2016, 2:09:57 PM10/3/16
to Jenkins Users
Yes. we're using parameters from a properties file.







Eric Pyle

unread,
Oct 3, 2016, 4:28:27 PM10/3/16
to jenkins...@googlegroups.com

Just noticed, there is a typo in the property name below (Acton vs. Action). Could that be the problem?


On 10/3/2016 1:15 PM, Steve K wrote:
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Steve K

unread,
Oct 3, 2016, 4:58:45 PM10/3/16
to Jenkins Users

Thanks for noticing the typo Eric. 
I think I had it correct when I added it to the Jenkins startup script.  I can't verify, because I have since removed it.
There was another thread on this topic (see: https://groups.google.com/d/msg/jenkinsci-users/sUs7NOiLKQ0/lrP-leh3OgAJ) where, basically, Mark Wait said all he had to do was change the downstream job to a parameterized job.  In the downstream job he also declared the parameters he wanted from the upstream job.
That appears to be working.  I haven't run through all of my parameterized jobs yet, but so far so good.

I appreciate your help.

Best Regards.

Steve K.








Steve K

unread,
Oct 6, 2016, 2:12:07 PM10/6/16
to Jenkins Users

Well, HECK! The parameters from parameter file are NOT getting passed.
The parameters were getting passed from 'Current build parameters'.
It did not pick up the values from 'Use properties from file'.
That is NOT good.

So, I'm back to the original question.  How do I successfully "Use properties from file"?

Thanks in advance.








Daniel Beck

unread,
Oct 7, 2016, 5:28:54 AM10/7/16
to Jenkins Users
To clarify, all the parameters you intend to pass are defined on the downstream job's configuration but it still doesn't work?
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bd6ade04-2da9-46dd-9edf-902095f1e869%40googlegroups.com.

Steve K

unread,
Oct 7, 2016, 9:34:43 AM10/7/16
to Jenkins Users, m...@beckweb.net

Correct Daniel.

I just boiled an example down to one parameter of interest.
In job 1, I defined a variable named VALUE_FROM_JOB_1
In the job, via Powershell, I created a parameters file, with the following content:
VALUE_FROM_JOB_1="I-was-defined-in-job-1"

In Job 2, I defined the parameter VALUE_FROM_JOB_1 and set its value to "unknown".
When I run Job 1--which triggers Job 2--, Here's what I get from Job 2:
 $ cmd /c call C:\Users\ROCBUI~1\AppData\Local\Temp\hudson4898377112420378449.bat
ERROR: Build step failed with exception
java.lang.IllegalArgumentException: Invalid environment variable name: "??VALUE_FROM_JOB_1"
	at java.lang.ProcessEnvironment.validateName(Unknown Source)
	at java.lang.ProcessEnvironment.put(Unknown Source)

In some of the test jobs I've set up, the variable(s) being passed simple retain the default value I gave them in job 2
(i.e., there are no complaints from Java, but the value passed from Job#1 was not taken on in job 2).

I hope you have some ideas.

Thanks for your help.

Steve K.

Daniel Beck

unread,
Oct 7, 2016, 9:58:08 AM10/7/16
to jenkins...@googlegroups.com
I wonder what the '??' before the variable name are. Copy + paste accident?

Please post the full stack trace, and the script you're launching.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/52f360e2-ea87-4954-88fd-57ad9d75ba7d%40googlegroups.com.

Steve K

unread,
Oct 7, 2016, 10:19:39 AM10/7/16
to Jenkins Users, m...@beckweb.net
Well Daniel, you definitely asked the right question.
When I boiled the test case down, I had omitted the '-Encoding ASCII' when I created the parameter file.
Now that it is an ASCII file (vs. the default Unicode) it appears to be working (in my test case at least).

Thanks a ton!

Steve K.
Reply all
Reply to author
Forward
0 new messages