setup-go: Action cannot be used with Self hosted runner
Intro
Type of issue: Bug report
Reproduce
- On a clean linux machine (I tested on Ubuntu20.04, Ubuntu18.04 and Debian10).
- Following the instruction in https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service, to create a self-hosted runner
- Registrate it to your GitHub Account’s runner
- Create a sample repo which has access to that self-hosted runner
- Create a GitHub config file
jobs:
gotest:
name: GoTest
runs-on: [self-hosted, linux]
steps:
- uses: AutoModality/action-clean@v1
- name: Checkout
- uses: actions/setup-go@v2
with:
go-version: '1.14.*'
- name: Go Env
run: |
go env
- Get this error in
actions/setup-go@v2
, but it won’t exit the pipeline.
(node:12435) UnhandledPromiseRejectionWarning: AssertionError [ERR_ASSERTION]: a path argument must be provided
at Object.<anonymous> (/github-action-runner/_work/_actions/actions/setup-go/v2/dist/index.js:4752:18)
at Generator.next (<anonymous>)
at /github-action-runner/_work/_actions/actions/setup-go/v2/dist/index.js:4692:71
at new Promise (<anonymous>)
at module.exports.672.__awaiter (/github-action-runner/_work/_actions/actions/setup-go/v2/dist/index.js:4688:12)
at Object.mkdirP (/github-action-runner/_work/_actions/actions/setup-go/v2/dist/index.js:4751:12)
at Object.<anonymous> (/github-action-runner/_work/_actions/actions/setup-go/v2/dist/index.js:204:22)
at Generator.next (<anonymous>)
at /github-action-runner/_work/_actions/actions/setup-go/v2/dist/index.js:57:71
at new Promise (<anonymous>)
- This is a non stopping error, so in
go env
line, another error will occur.
build cache is required, but could not be located: GOCACHE is not defined and neither $XDG_CACHE_HOME nor $HOME are defined
- Check the
go env
and you can find thatGOPATH
,GOENV
are missing.
Possible bugs
- As the
$HOME
is not correctly exported andGOCACHE
is"off"
,go
cannot run. - Besides, another possible problem may be in this part and thus get a
a path argument must be provided
error. https://github.com/actions/setup-go/blob/3b4dc6cbed1779f759b9c638cb83696acea809d1/src/main.ts#L67-L73
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 19 (2 by maintainers)
Understood and agreed - however I meant creating a folder elsewhere, even in tmp, and setting GOPATH and GOCACHE there? At a minimum, this limitation and the workaround with setting the GO values yourself should be documented in the README. What do you think?
I believe the reason of issue is missing $HOME variable on the self-hosted runners. Issue is closed because we cannot resolve it from
setup-go
action side. Please, contact us if you have any questions.Yes there is no $HOME directory, which is why I set values manually: https://github.com/cert-manager/aws-privateca-issuer/blob/master/.github/workflows/on-safe-to-test-label.yml#L72-L84