pulumi / actions

Deploy continuously to your cloud of choice, using your favorite language, Pulumi, and GitHub!
Apache License 2.0
253 stars 72 forks source link

default.run.working-directory property is not respected #1258

Closed runlevel5 closed 1 month ago

runlevel5 commented 1 month ago

What happened?

Please see example section

Example

I have a simple pipeline:

jobs:
  preview:
    name: preview
    runs-on: [self-hosted, small, arm64]
    defaults:
      run:
        working-directory: ./my-project # NOTE: my pulumi project resides in this folder
    steps:
      - uses: pulumi/actions@v5
        with:
          pulumi-version: ${{ steps.versions.outputs.pulumi }}
          command: preview
          stack-name: my-org/my-stack
        env:
          PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}

When running pipeline I got the error that could not find stack, simply because pulumi preview does NOT respect default.run.working-directory

In order to fix this issue I have to explicitly declare work-dir in pulumi/actions step:

      - uses: pulumi/actions@v5
        with:
          work-dir: ./my-project/

Output of pulumi about

It happens with all pulumi version from v4 to v5

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).

tgummerer commented 1 month ago

The default.run documentation states the following:

Use jobs.<job_id>.defaults.run to provide default shell and working-directory to all run steps in the job.

Note how it explicity states that this provides the default for run steps, not uses steps. So I don't think this setting is meant to work for uses steps unfortunately, and I don't think there's anything we can do in this action to fix that.