Pulumi GitHub Action pulumi/actions@v2: error: It looks like the Pulumi SDK has not been installed.

Posted by Abbie Anker on Monday, May 20, 2024

I'm working on a project that uses Pulumi to provision some infrastructure pieces on Azure. I switched to the new pulumi/actions@v2 Action which was released recently.

My GitHub Actions workflow looks like this:

name: pulumi-preview-up on: [push] env: ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} jobs: preview-up-destroy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install Pulumi CLI uses: pulumi/[email protected] - uses: pulumi/actions@v2 with: command: preview stack-name: dev 

Now I bumped into the following error (see the full GHA logs here):

 Error: code: 255 stdout: Previewing update (github-638882160) View Live: https://app.pulumi.com/jonashackt/scmbreakoutpulumi/github-638882160/previews/450a1f61-549d-4669-a7de-d8da8fc622f7 pulumi:pulumi:Stack scmbreakoutpulumi-github-638882160 error: It looks like the Pulumi SDK has not been installed. Have you run npm install or yarn install? pulumi:pulumi:Stack scmbreakoutpulumi-github-638882160 1 message Diagnostics: pulumi:pulumi:Stack (scmbreakoutpulumi-github-638882160): error: It looks like the Pulumi SDK has not been installed. Have you run npm install or yarn install? stderr: error: failed to load language plugin nodejs: could not read plugin [/home/runner/.pulumi/bin/pulumi-language-nodejs] stdout: EOF err?: 

1 Answer

The new Pulumi v2 GitHub Action uses the new Pulumi Automation API. As the docs state:

This means that there is no supporting functionality for npm or pip installs. This functionality should be deferred to the correct GitHub Marketplace actions that support it.

This means it's not sufficient anymore (as we were used to with Pulumi v1 Action) to configure the pulumi/actions and pulumi/action-install-pulumi-cli Actions. We additionally need to set up the language specific GitHub Action environments ourselves - AND need to install the respective dependencies also ourselves - BEFORE using the pulumi/actions!

Assuming to use Pulumi with JavaScript/Typscript style, we need to add the actions/setup-node Action and also run a npm install afterwards. In our workflow.yml it looks like this:

name: pulumi-preview-up on: [push] env: ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }} ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} jobs: preview-up-destroy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: In order to use the Pulumi v2 action, we need to setup the Pulumi project specific language environment uses: actions/setup-node@v2 with: node-version: '14' - name: After setting up the Pulumi project specific language environment, we need to install the dependencies also run: npm install - name: Install Pulumi CLI uses: pulumi/[email protected] - uses: pulumi/actions@v2 with: command: preview stack-name: dev 

If you choose another language then JavaScript/TypeScript, you need to also setup the matching environment. The docs show examples for Python, Go and .Net also.

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobW9tZmeFeIKOqaylrZ2eeqi106Gsm2WRmMGqu81mp66kpaK2bq3CraCopqOrf26x0aumq2WZqXqtu86kqmakmaCybsDHnmSprZyquqp50p2iZqCRqA%3D%3D