actions icon indicating copy to clipboard operation
actions copied to clipboard

Pulumi github actions default push template with dotnet fails in nuget restore with Permission denied

Open srivathsah opened this issue 4 years ago • 1 comments

Hello!

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

Issue details

I have a simple pulumi project in one of my private repos. I am trying to setup github actions for that. It is a dotnet workload. I have followed the pulumi github actions tutorial and copied the template. The workflow fails at Pulumi step with pulumi up command. The caveat here is I have a Directory.Build.props file at the root of the repo. The error message is "Permission denied" to the obj path of that pulumi project

Steps to reproduce

  1. Have a simple dotnet console app and haver default pulumi app that does anything (eg: docker build of the console app)
  2. Have Directory.Build.props at the root of the repo so that project properties are shared by the 2 projects. The bin and obj folders are placed in a folder called dist which is at the root of the repo
  3. try pulumi up locally, it works
  4. try pulumi up using github actions (setup using default pulumi push template and .Net 6)

Expected: pulumi should have worked Actual: pulumi up fails with error "Permission denied"

Directory.Build.props

    `
      <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup Condition="!$(MSBuildProjectName.StartsWith('WebApplication'))">
          <BaseIntermediateOutputPath>$(SolutionDir)\dist\objs\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
        <OutputPath>$(SolutionDir)\dist\bins\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
        <IntermediateOutputPath>$(BaseIntermediateOutputPath)\</IntermediateOutputPath>
          <LangVersion>10</LangVersion>
        <WarningsAsErrors>CS8600;CS8602;CS8603</WarningsAsErrors>
        <Nullable>enable</Nullable>
        <ImplicitUsings>enable</ImplicitUsings>
      </PropertyGroup>

    </Project>

`

push.yml

    `name: Pulumi
    on:
      push:
        branches:
          - master
    jobs:
      preview:
        name: Update
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - uses: actions/setup-dotnet@v1
            with:
              dotnet-version: '6.0'
          - uses: pulumi/actions@v3
            with:
              command: up
              stack-name: dev
              work-dir: ./Infrastructure
            env:
              PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}

error message pulumi:pulumi:Stack <pulumiProject-stack> /home/runner/.dotnet/sdk/6.0.101/NuGet.targets(130,5): error : Access to the path '/dist/objs/' is denied.`

Is there a way to run the pulumi step as sudo ? or what am I doing wrong

srivathsah avatar Dec 16 '21 00:12 srivathsah

In your action, I don't see any step to actually perform the docker build of the console app, which I assume is what actually generates anything on the /dist/objs path?

leezen avatar Dec 18 '21 03:12 leezen