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

magnificent-pizza-54661

12/08/2022, 2:00 AM
Hi, I'm attempting to run Pulumi CLI from a node process using spawn. While I'm able to run the CLI from the new process, it fails because it's unable to find it's own dependencies, (in my CI, works fine locally) most likely due to a mis-match in the PATH. However, I'm not seeing any issue in the PATH that is being sent to the process. Has anyone encountered a similar issue?
c

clever-sunset-76585

12/08/2022, 2:07 AM
I have not tried to do that before. I am curious what your use case is for doing that? Also have you looked at the Pulumi Automation SDK? It's a programmatic way to run the CLI commands, if that's all that you are trying to do by spawning a Node process to run the CLI.
m

magnificent-pizza-54661

12/08/2022, 2:16 AM
Thanks! The reasoning is to create a single flow for both local environments and the CI. The Automation API seems like a good option, I'll have a close look. Thanks for the tip!
Oddly enough I encounter the same issue using the Automation API
c

clever-sunset-76585

12/08/2022, 2:43 AM
What is the error that you are getting?
m

magnificent-pizza-54661

12/08/2022, 2:50 AM
Copy code
error: no resource plugin 'pulumi-resource-aws' found in the workspace at version v5.23.0 or on your $PATH, install the plugin using `pulumi plugin install resource aws v5.23.0`
This is that pulumi is in the $PATH otherwise the cli wouldn't have worked at all. It does seem to me like it's more of a CI issue then a Pulumi issue though.
c

clever-sunset-76585

12/08/2022, 2:54 AM
Did you run an
npm ci
or
yarn install
(depending on your choice of package manager) before running Pulumi? EDIT: ...in CI
m

magnificent-pizza-54661

12/08/2022, 2:55 AM
Yes. I do the following -
Copy code
curl -fsSL <https://get.pulumi.com> | sh -s -- --version 3.37.1
yarn install --force --frozen-lockfile
export PATH=\$HOME/.pulumi/bin:\$PATH
yarn preview
Where the preview script is what calls the automation api
c

clever-sunset-76585

12/08/2022, 2:59 AM
Gotcha. Well, Pulumi auto-acquires plugins during execution if it can't be found in
~/.pulumi/plugins
. Also what is your CI build agent's architecture?
m

magnificent-pizza-54661

12/08/2022, 3:01 AM
This is ubuntu on Jenkins (hope that's what you were asking for). Odd thing is that it works perfectly fine with Python or if I trigger the CLI directly from the shell instead of through yarn.
c

clever-sunset-76585

12/08/2022, 3:07 AM
Ubuntu on Jenkins clarifies your CI setup, so that's good. Hmm yeah this is weird. Unfortunately, nothing jumps out at me. Just a thought but I wonder if running through
yarn
prevents the installation of the Pulumi plugin somehow? Or maybe the way
yarn
runs the command doesn't have the user
HOME
configured correctly in CI? Try printing the contents of
$HOME/.pulumi/plugins
before your
yarn preview
and check that plugins for the providers that your project depends on have been installed. You could also alternatively run
pulumi plugin ls
.
m

magnificent-pizza-54661

12/08/2022, 3:10 AM
PATH seems fine outside and within the node process. I'm thinking it might be the fact that node is managed through a version manager (Volta) , but I couldn't find any similar instances. Anyway, appreciate you trying to help. I think this might be too specific to my environment 🙂
c

clever-sunset-76585

12/08/2022, 3:12 AM
No problem. Hope it doesn't block you for too long. Also it would still be worth confirming that your
.pulumi/plugins
dir actually does have the provider plugins. At least then you can definitely narrow it down to some
yarn
or
Volta
weirdness.
...basically confirming that the plugins are actually there but something isn't able to find them rather than them really missing.
m

magnificent-pizza-54661

12/08/2022, 3:14 AM
I will check. thanks!
In case you're interested, I figured it out. I had to set the PATH before I run yarn install, otherwise they install incorrectly. A day well spent 🙂 Thank you for your help!
c

clever-sunset-76585

12/08/2022, 3:40 AM
Wonderful! Glad you got it working.
3 Views