You say that you need to transfer the file with the IP address to the "Basic" task. If all you need is an IP, there are simpler ways to do this (without files), I will describe both.
To transfer an artifact from one job to another
In the Assistant task, you need to archive this file from the workspace.
- In post-assembly actions, select Archive Artifacts
- Position the path relative to the work area. You can use wildcards or a hardcode file name if it is always the same.
- Configure this task to automatically launch your main task using the Trigger / Calls command on other projects . If you do not have this plugin, you can get it here
- For build projects, enter the name of your main job
Now, in the "Basic" task, you need to copy this artifact from the previous task ("Helper").
- For the first build step, select Copy artifacts from another project . If you do not have this plugin, you can get it here
- For Project Name, enter the name of your Assistant job.
- For Which build, select Last Successful Build
- For Artifacts to copy, use
**/yourartifactname*.* . The name of your artifact will be what you configured in the Assistant task. Using **/ in front ensures that it will ignore any directory structure before moving on to the artifact - For the Target directory, specify the location in the workspace "Primary" workspace where this file will also be copied.
- Checkmark Flatten directories , so the file goes directly to the location specified in step 5, otherwise it will save the directory structure to which it was archived (in the Assistant task)
Now your โmainโ task has a file from the โHelperโ task in the workspace. Use it just like any other file in your workspace.
To transfer a variable from one job to another
As I already mentioned, if you need only one IP address that you have as a variable at one time in the Assistant task, you simply send it to the Main task using Trigger / Call builds on other projects that You set the Assistant tasks in steps 3 and 4. In this case, you do not need any special configuration in the "Home" task.
- Set up the Assistant task to automatically launch your โmainโ task using the Trigger / Call assembly step on other projects . If you do not have this plugin, you can get it here
- For build projects, enter the name of your main job
- Click the Add Options button.
- Select Predefined Options
- Enter
VarForMain=$VarFromHelper , where VarFromHelper is your VarFromHelper environment variable that contains your IP address, and VarForMain is the environment variable that will be set in your Basic job for this value. There is no reason why they cannot have the same name.
Now in your "main" task you can refer to $VarForMain , like any other environment variable
source share