actions icon indicating copy to clipboard operation
actions copied to clipboard

work-dir does not work as a replacement for --cwd

Open malnor opened this issue 1 year ago • 0 comments

What happened?

Running a pipeline trying to use work-dir isn't working as expected. The work-dir directory becomes

##[debug]Working directory resolved at /home/runner/work/aaa.infra/aaa.infra/xxx

Which then fails with

Error: code: -2
 stdout: 
 stderr: Command failed with exit code 255: pulumi stack select --stack xxx.labs --non-interactive

This should happen because it cannot find the stack because it is the wrong folder.

If we set workdir to .../xxx we get

##[debug]Working directory resolved at /home/runner/work/aaa.infra/xxx

And the error is

Error: code: -2
 stdout: 
 stderr: Command failed with ENOENT: pulumi version --non-interactive
spawn pulumi ENOENT

Looks like it cannot find pulumi at all?

pulumi --cwd xxx --stack xxx.test works just find locally

Expected Behavior

work-dir should (from our understanding) work the same way as --cwd in the pulumi-cli

Steps to reproduce

Monorepo with folders for each project

Should work?

 - uses: pulumi/actions@v3
        name: Pulumi preview
        with:
          command: preview
          work-dir: xxx
          stack-name: xxx.test
          comment-on-pr: true
          pulumi-version: 3.70.0

Shouldn't work but gives a different error?

 - uses: pulumi/actions@v3
        name: Pulumi preview
        with:
          command: preview
          work-dir: ../xxx
          stack-name: xxx.test
          comment-on-pr: true
          pulumi-version: 3.70.0

Output of pulumi about

We cannot run it in the action (it is not an allowed command) - so we assume that you mean locally

Running locally from the root (which is not what we really want), we always use --cwd

❯ pulumi about
CLI          
Version      3.71.0
Go Version   go1.20.5
Go Compiler  gc

Host     
OS       darwin
Version  13.4
Arch     x86_64

Backend        
Name           localhost.local
URL            azblob://shared
User           malin
Organizations  

Pulumi locates its logs in /var/folders/rh/f4qnwl1n55sb9wb0dlb92f_80000gn/T/ by default
warning: Failed to read project: no Pulumi.yaml project file found (searching upwards from /Users/malin/repo/kubility.pulumi.infra). If you have not created a project yet, use `pulumi new` to do so: no project file found
warning: Failed to get information about the current stack: no Pulumi.yaml project file found (searching upwards from /Users/malin/repo/kubility.pulumi.infra). If you have not created a project yet, use `pulumi new` to do so: no project file found

   $ brew update && brew upgrade pulumi
or visit https://pulumi.com/docs/install/ for manual instructions and release notes.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

malnor avatar Jun 19 '23 09:06 malnor