https://pulumi.com logo
#getting-started
Title
# getting-started
m

magnificent-soccer-44287

02/17/2024, 10:29 PM
hey again folks 🤩 possible bug? or maybe just me not understanding the behavior correctly. So I'm using a command.local for some S3 stuff in the pulumi build... with this code:
Copy code
command.local.runOutput({ 
    command: pulumi.interpolate`bash ./compileAndExtract.sh && aws s3 sync ./syncFolder s3://${assetsBucket.bucket} --delete --exact-timestamps && rm -rf syncFolder`,
});
That script basically creates a docker image and uploads some PWA assets to s3. It seems like this is actually fully executed during 'pulumi preview' (ie., the preview command triggers an S3 bucket overwrite) Was this intended by design? I can understand how it's difficult if not impossible to 'preview' an arbitrary command but I'm not sure many folks would expect it to outright just run during preview.
m

miniature-musician-31262

02/18/2024, 12:32 PM
This is indeed how local.run is meant to work:
This command will always be run on any preview or deployment. Use local.Command to avoid duplicating executions.
You’re probably looking for the behavior of local.Command.
m

magnificent-soccer-44287

02/18/2024, 5:37 PM
thanks @miniature-musician-31262!
m

miniature-musician-31262

02/18/2024, 6:25 PM
You bet! Thanks for sticking with us!