Using Pipeline expression in Check Precondition


#1

Hi All,
I am using Spinnaker for deployment into Kubernetes Cluster. I have pipelines for deployment into different environments(DEV,UAT). Now I have to do daily deployment to UAT from the lastest image from DEV. I dont want to deploy an image if the image is already deployed. I figured out that we have a stage for Check precondition where I can have a check. For using that I am trying to get the version which is already deployed. I tried {deployedServerGroups.ami} and {deployedServerGroups[0].ami} but none of the same is working i.e. I am not able to get values.I test the above from notification and I am just getting the expression in the notification and not the value where as if use ${execution.application} works fine. Is there a way to achieve the same for deployedServerGroup.
Thanks,
Amol


#2

Have you tried looking at the “source” of an executed pipeline to build a sense of what expression to write?

LTtffr8i0SG

It’s possible that you’re referencing fields that don’t exist in your context.


#3

@amol are you using a Find Image from Cluster stage before your precondition? deployedServerGroups isn’t a context field that I am aware of. If you put a Find Image from Cluster stage before you check your precondition, you can reference any images found in that stage.


#4

Thanks it worked if I dont use ${} and evalute expression without that.