wide-jackal-86020
11/10/2021, 3:22 AMnpm build
inside pulumi? Here's the use case:
We need to build and deploy a frontend REACT application to S3. And we need to know which stack to deploy while building the application, so we can set up the environment variables properly. For example, if we are deploying to dev
, we should run ENV=dev npm build
. Since we can easily get the stack name in pulumi, it would be convenient if I can run npm build
inside pulumi.little-cartoon-10569
11/10/2021, 3:58 AMsparse-spring-91820
11/10/2021, 9:29 AM- run:
name: Deploy to S3
command: |
aws s3 sync dist/client s3://${S3_SITE_BUCKET_NAME} --no-progress --delete
miniature-king-36473
11/10/2021, 10:10 AMlimited-rainbow-51650
11/10/2021, 12:50 PMnode
to create the needed resources. If you want to drive Pulumi from within your NodeJS code, have a look a the Automation API. In that setup, the Pulumi engine will be started by your NodeJS code and you can programmatically set the environment, stack config, etc.
https://www.pulumi.com/docs/guides/automation-api/wide-jackal-86020
11/10/2021, 1:53 PMwrapping the build and pulumi app in a sinlgle script,This is what we are doing now. The problem is that the API endpoints are generated in other pulumi projects, they are not accessible when building the REACT application. @little-cartoon-10569 @miniature-king-36473
use circleci for building the client and pushing it to the s3 bucketCI/CD works, But we don't have CI/CD setup for every stack. @sparse-spring-91820
Pulumi invokesThis is what I am thinking to give it a try. Thank you for sharing the other way of driving Pulumi from within NodeJS code using the Automation API. 👍 @limited-rainbow-51650to create the needed resources.node