pulumi / pulumi-dotnet

.NET support for Pulumi
Apache License 2.0
28 stars 25 forks source link

An error occurred trying to start process 'pulumi' with working directory '/tmp/pulumi'. No such file or directory #145

Closed lahiruchamira closed 5 months ago

lahiruchamira commented 1 year ago

What happened?

We are using pulumi dotnet Automation API and we set up the working directory from the .Net Core 6 project and called to CreateOrSelectStackAsync. We hosted our application in K8 and we are keep getting error "errorMessage": "An error occurred trying to start process 'pulumi' with working directory '/tmp/pulumi'. No such file or directory", but we verify the folder path exists in the pod and tmp folder have the necessary permissions as well.

This how we set up the working directory:

var stackArgs = new InlineProgramArgs(PulumiConfigurationConstants.ProjectName, environment, program)
        {
            StackSettings = new Dictionary<string, StackSettings>
            {
                [environment] = new() {SecretsProvider = PulumiConfigurationConstants.SecretsProvider,}
            },
            SecretsProvider = PulumiConfigurationConstants.SecretsProvider,
            ProjectSettings = new ProjectSettings(PulumiConfigurationConstants.ProjectName, ProjectRuntimeName.Dotnet)
            {
                Backend = new ProjectBackend {Url = PulumiConfigurationConstants.PulumiProjectBackendUrl},
            },
            WorkDir = Path.Cobmine("..", "tmp", "pulumi")
        };
        var stack = await LocalWorkspace.CreateOrSelectStackAsync(stackArgs);
  I can see the file also generated in   /tmp/pulumi folders. 

Expected Behavior

Pulumi able to access the folder location and start the process

Steps to reproduce

Mention in the what happened section

Output of pulumi about

Mention in the what happened section

Additional context

Mention in the what happened section

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

RobbieMcKinstry commented 1 year ago

Hi @lahiruchamira . I wish I had a better answer for you, but I'm just as stumped as you are.

I searched the codebase for your error message in case Pulumi was doing something tricky when loading the stack, but the error doesn't appear in our codebase, which means its wrapped from another source. I'd be surprised if Pulumi was doing something odd with your tmp directory.

The only thing of notice is that the filepath provided in this snippet...

            WorkDir = Path.Cobmine("..", "tmp", "pulumi")

is not necessarily /tmp/pulumi, because .. is relative to the current working directory. Thus, the correctness of this line demands on the WORKDIR setting in your Dockerfile. It's also worth noting there's a typo in this line. Perhaps the path you provided is also typo'd?

whatsfordinner commented 9 months ago

Ran into this one today and it's because the pulumi CLI wasn't installed on the container. Makes total sense in retrospect but the error back from the Automation API lead me down the wrong path for a bit.

mikhailshilkov commented 5 months ago

The issue is fairly old and we haven't heard back on the latest question. I'll go ahead and close it as no-repro.