Hi, I'm attempting to run Pulumi CLI from a node p...
# getting-started
m
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
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
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
What is the error that you are getting?
m
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
Did you run an
npm ci
or
yarn install
(depending on your choice of package manager) before running Pulumi? EDIT: ...in CI
m
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
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
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
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
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
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
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
Wonderful! Glad you got it working.