Passing the output of a job in Jenkins to another job

I made quite the research on this but couldn't find a satisfying answer. The following process will be automatic, repeating every night so no parameters could be passed in manually by the user at runtime. Parent job calls all the following subprocesses in a blocking chain My job hierarchy is set up like this with following main jobs and subprocesses:

Run-Tests-EveryNight (Parent Job)--> Create-A-Virtual-Machiene --> Run-Tests-On-VM

Moving on, when you create a VM it gets assigned a generated IP address, I need to pass in that IP address to Run-Tests-On-VM as a parameter but I can not seem to find any way to do it.

Clarification: Some people found the question unclear so: I am asking how to pass in the dynamically created IP address of a Virtual Machine as a PARAMETER to a different job (a subprocess)

NOTE: I have read about copying artifacts but I feel like it doesnt work in this case (plus writing and then reading from a file is way too much work for a simple parameter passing.)

I feel like there should be a really easy way to do this...

UPDATE: The use of Parameterized Trigger Plugin was suggested. I am already using and have the following bash script to copy the properties

# Create override properties file for functional tests
FILENAME="user.properties"
cd "path of the file goes here"
rm -f $FILENAME
echo "FQDN=$VM_FQDN" >> $FILENAME

However I do not know how to write into this file (or create a new properties file, to save the IP address as a post-build action

Answer: Following the answer below, use either of these threads to modify the properties file or use inject option in Jenkins Archive the artifacts in hudson/jenkins

How can I change a .properties file in maven depending on my profile?

Thanks


Use Parametrized Trigger Plugin as mentioned Christopher, but with the option called Parameters from properties file.

The file has a simple key=value structure, you can create it during the job execution, save there the IP adress and use it later to pass it to the next job. I generally store the file somewhere in the build workspace, so parallel builds are handled seamlessly.


您可以使用参数化触发器插件来触发“运行测试”作业,并将IP地址值作为参数。

链接地址: http://www.djcxy.com/p/28864.html

上一篇: 正则表达式本身可以用正则表达式解析吗?

下一篇: 将詹金斯的工作输出传递给另一份工作