actions / setup-go

Set up your GitHub Actions workflow with a specific version of Go
MIT License
1.41k stars 531 forks source link

Error: EACCES: permission denied, mkdir '/root/gocode' #425

Closed schniggie closed 1 year ago

schniggie commented 1 year ago

Description: setup-go stopped working on the same self-hosted runner it worked for months. Runner started as non root user with passwordless sudo allowed, which worked without any issues till some days ago:

Action version: v3 and v4

Platform:

Runner type:

See log:

0s
Run actions/setup-go@v4
  with:
    go-version: [1](https://github.com/schniggie/zecurity-vulnmgmt/actions/runs/6212870763/job/16863427537#step:3:1).[2](https://github.com/schniggie/zecurity-vulnmgmt/actions/runs/6212870763/job/16863427537#step:3:2)0.x
    check-latest: false
    token: ***
    cache: true
Setup go version spec 1.20.x
Found in cache @ /home/cd/actions-runner/_work/_tool/go/1.20.7/x6[4](https://github.com/schniggie/zecurity-vulnmgmt/actions/runs/6212870763/job/16863427537#step:3:4)
Added go to the path
Successfully set up Go version 1.20.x
Error: EACCES: permission denied, mkdir '/root/gocode'

Any idea?

dsame commented 1 year ago

Hello @schniggie, we are starting to investigate the issue

dsame commented 1 year ago

Hello @schniggie , can you please run the build with debug turned on and attach the logs of setup-go action?

schniggie commented 1 year ago

@dsame here we go.

##[debug]Evaluating condition for step: 'Run actions/setup-go@v4'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run actions/setup-go@v4
##[debug]Register post job cleanup for action: actions/setup-go@v4
##[debug]Loading inputs
##[debug]Evaluating: (((github.server_url == 'https://github.com') && github.token) || '')
##[debug]Evaluating Or:
##[debug]..Evaluating And:
##[debug]....Evaluating Equal:
##[debug]......Evaluating Index:
##[debug]........Evaluating github:
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'server_url'
##[debug]......=> 'https://github.com'
##[debug]......Evaluating String:
##[debug]......=> 'https://github.com'
##[debug]....=> true
##[debug]....Evaluating Index:
##[debug]......Evaluating github:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'token'
##[debug]....=> '***'
##[debug]..=> '***'
##[debug]=> '***'
##[debug]Expanded: ((('https://github.com' == 'https://github.com') && '***') || '')
##[debug]Result: '***'
##[debug]Loading env
Run actions/setup-go@v4
Setup go version spec 1.[2](https://github.com/schniggie/zecurity-vulnmgmt/actions/runs/6236024427/job/16926419095#step:3:2)0.x
##[debug]isExplicit: 
##[debug]explicit? false
##[debug]isExplicit: 1.17.1[3](https://github.com/schniggie/zecurity-vulnmgmt/actions/runs/6236024427/job/16926419095#step:3:3)
##[debug]explicit? true
##[debug]isExplicit: 1.19.12
##[debug]explicit? true
##[debug]isExplicit: 1.2.2
##[debug]explicit? true
##[debug]isExplicit: 1.20.7
##[debug]explicit? true
##[debug]evaluating [4](https://github.com/schniggie/zecurity-vulnmgmt/actions/runs/6236024427/job/16926419095#step:3:4) versions
##[debug]matched: 1.20.7
##[debug]checking cache: /home/cd/actions-runner/_work/_tool/go/1.20.7/x[6](https://github.com/schniggie/zecurity-vulnmgmt/actions/runs/6236024427/job/16926419095#step:3:6)4
##[debug]Found tool in cache go 1.20.[7](https://github.com/schniggie/zecurity-vulnmgmt/actions/runs/6236024427/job/16926419095#step:3:7) x64
Found in cache @ /home/cd/actions-runner/_work/_tool/go/1.[20](https://github.com/schniggie/zecurity-vulnmgmt/actions/runs/6236024427/job/16926419095#step:3:20).7/x64
Added go to the path
Successfully set up Go version 1.20.x
##[debug]which go :/home/cd/actions-runner/_work/_tool/go/1.20.7/x64/bin/go:
##[debug]go env GOPATH :/root/gocode:
##[debug]creating /root/gocode
Error: EACCES: permission denied, mkdir '/root/gocode'
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Run actions/setup-go@v4

I assume the GOPATH was not /root/gocode when it worked for me. Has this recently changed? Just tried to set the GOPATH by a repository variable to /home/cd/go as for activating the debugging. However, it is ignored and still tried to use /root/gocode

dsame commented 1 year ago

Hello @schniggie , can you please double check the environment variable GOPATH was not set or changed on the runner host recently?

dsame commented 1 year ago

The problem is not reproducible, and works as expected with the current action:

https://github.com/akv-demo/test-setup-go/actions/runs/6653482897/job/18079543231

dsame commented 1 year ago

Hello @schniggie , i am closing the issue due to inactivity, but please feel free to reopen it or create the new one in case if the problem still exists