Get data from Nested pipeline


#1

I’m looking to start Pipeline B from Pipeline A and then get data from Pipeline B for a webhook in Pipeline A

Pipeline A
Configuration —> Pipeline B —> Webhook

This is what I tried putting in the payload of the webhook.
${ #jsonFromUrl( 'https://localhost:8084/pipelines/' + execution['stages'][0]['context']['executionId'] )['context']['MISC_DATA'] }

This returns the executionId correctly
$ { execution['stages'][0]['context']['executionId'] }

If I put the following in pipeline B, it obviously evaluates correctly. However, for the requirements of my project. I need to be able to get data from one pipeline to another.
${ execution['stages'][0]['context']['MISC_DATA'] }

But the #jsonFromUrl is not evaluated. (See https://www.spinnaker.io/guides/user/pipeline-expressions/#writing-expressions “In Spinnaker, if an expression cannot be evaluated, it will return the expression entered.”)

I am probably going about this the wrong way and there is some other expression that I am missing. Something like:
${ #pipelineExecution('executionId')['context']['MISC_DATA'] }

Please advise.


#2

Are you running Pipeline B as a child pipeline? You can get around this by having Pipeline B be triggered by Pipeline A, and lookup the trigger context using ${ trigger.parentExecution.MISC_DATA }.


#3

That is elegant. However, I need to get MISC_DATA from the child pipeline (B) to the parent (A).
Is there a way in Pipeline A (parent) to say something like execution[stage][0].childExecution.MISC_DATA?


#4

Have you had any luck implementing this? I have a similar need and it doesn’t seem like the child pipeline stage contains any context specific to the stages defined in the child pipeline.