Jenkins pipeline: I have a pipeline p1 that triggers a job j1 and then job j2. I want some parameters that are set by j1
It can be done using "env". If you manage to make j1 add its information into the build's env.
If j1 was a pipeline you could to env.MYKEY=MYVALUE.
For a freestyle-job it should work using the EnvInject plugin (didn't try).
In p1 then you will get a map with that information if you out of the build result.
So, if you do in p1 something line this:
// somewhere in your pipeline, i.e. p1:
def j1BuildResult = build job: 'J1'
def j1EnvVariables = j1BuildResult.getBuildVariables();
then j1EnvVariables will be a map containing the variables you set in j1.
PS: how to pass that info to as parameters p2 is e.g. covered here.