https://pulumi.com logo
#automation-api
Title
# automation-api
c

curved-pharmacist-41509

08/27/2021, 7:30 AM
Is there a way to find out if the
--skip-preview
flag was passed in your pulumi application?
b

bored-oyster-3147

09/02/2021, 2:11 AM
Idk if you’ve figured this out already - but no there is not. There is however a way to check if the current run is a preview within your Pulumi program using the IsDryRun boolean
c

curved-pharmacist-41509

09/02/2021, 2:17 AM
I did not, the problem is the automation API skips preview and my resource uses isDryRun I basically want to use dryRun if preview ran, but if preview was skipped I need it to run in the main process
b

bored-oyster-3147

09/02/2021, 4:05 AM
I’m confused. You’re saying your Pulumi program relies on a preview being executed first? That sounds like a larger problem
c

curved-pharmacist-41509

09/02/2021, 4:07 AM
I have a
BuildStep
resource, similar to the build docker image helpers, I was hoping that if say a project fails to build that would happen in preview
But not have to rebuild during up
b

bored-oyster-3147

09/02/2021, 4:08 AM
There’s nothing preventing you from running a preview first using Automation API. It just doesn’t do it as part of an Up
c

curved-pharmacist-41509

09/02/2021, 4:08 AM
Totally, that is our work around, but in general was thinking it could be good to skip that as it saves time
b

bored-oyster-3147

09/02/2021, 4:09 AM
So you would like to fail prematurely during preview, but you would also like to skip preview to save time?
c

curved-pharmacist-41509

09/02/2021, 4:09 AM
If you preview, then yes, would like it to fail early there
But if you have chosen to skip, then do it part of the up
Will likely just move it so it only builds during
up
, rather than preview.
b

bored-oyster-3147

09/02/2021, 4:11 AM
Oh I see. You were using IsDryRun to take action that was only occurring during a preview. Yes I would call that a problem. You should use IsDryRun == true only to decide to not take action, not to decide that you should take action
Since previews and ups are independent actions, up can have no knowledge of whether or not a preview was executed first, they are 2 separate invocations. You could do something really weird with automation api like pass in your stack history when using an inline program.. but like I said, that would be really weird
c

curved-pharmacist-41509

09/02/2021, 4:18 AM
Yeah fair enough, that was the direction I was going to take. Just build during up, not preview
Safer all around