https://pulumi.com logo
#general
Title
# general
p

purple-lawyer-35555

06/01/2021, 9:45 AM
hi all! any idea on how to run in a clean way a build script just in the middle of pulumi deployment flow? i'm using webpack. e.g.:
Copy code
// pulumi deploys server resources --> Pulumit.output gives me the 'endpoint'
execSync(
  pulumi.interpolate`yarn build --env endpoint_url=${endpoint}`
)
// pulumi deploys the frontend resources
b

brave-planet-10645

06/01/2021, 10:28 AM
You're probably going to want to use the automation api for this.
p

purple-lawyer-35555

06/01/2021, 10:31 AM
cool! thanks!
i'll give it a try and comeback 👍
c

curved-pharmacist-41509

06/01/2021, 12:23 PM
Copy code
endpoint.apply(e => new Promise(resolve => exec('yarn', ['build', '--env', `--endpoint_url=${e}`))
Something along the lines of that
https://github.com/pulumi/pulumi/issues/99 - this is the issue tracking actual support
p

purple-lawyer-35555

06/01/2021, 12:36 PM
this sounds more reasonable to me, that it can be integreated seamlessly within the pulumi up flow
thanks!
p

prehistoric-nail-50687

06/01/2021, 1:45 PM
you might also want to combine it with
isDryRun()
to not execute it while doing a preview https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/runtime/#isDryRun
p

purple-lawyer-35555

06/01/2021, 1:56 PM
now working! thank you guys