k1LoW / tbls

tbls is a CI-Friendly tool for document a database, written in Go.
MIT License
3.32k stars 163 forks source link

Github action could not find a writable bin path: /usr/local/bin:/usr/bin:/bin:/snap/bin #562

Closed lionslair closed 4 months ago

lionslair commented 4 months ago

What happened

I am trying to run this on self hosted github actions

What you expected to happened

The task to run

What stack trace or error message from tbls did you see?

Error: could not find a writable bin path: /usr/local/bin:/usr/bin:/bin:/snap/bin

image

Anything else we need to know?

Environment

I have ensured at minimum /home/ubuntu/bin is in the PATH variable but this does not seem to use the path no matter what

k1LoW commented 4 months ago

I have ensured at minimum /home/ubuntu/bin is in the PATH variable but this does not seem to use the path no matter what

Is /home/ubuntu/bin in the PATH of the user running setup-tbls?

For example, could you show me the result of the following run?

steps:
- run: |
      id
      echo $HOME
      echo $PATH
lionslair commented 4 months ago

Thanks for the fast reply


Run id
  id
  echo $HOME
  echo $PATH
  shell: /usr/bin/bash -e {0}
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),119(netdev),120(lxd),998(docker)
/home/ubuntu
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

Looks like it is still missing the path

image

ubuntu@ip-10-0-1-21:~$ id
uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),119(netdev),120(lxd),998(docker)
ubuntu@ip-10-0-1-21:~$ echo $HOME
/home/ubuntu
ubuntu@ip-10-0-1-21:~$ echo $PATH
/home/ubuntu/bin:/home/ubuntu/bin:/home/ubuntu/.config/composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/lib/npm/bin
ubuntu@ip-10-0-1-21:~$ 
lionslair commented 4 months ago

It is in the .bashrc

export PATH="$HOME/.config/composer/vendor/bin:$PATH"
export BAT_PAGER="never"
PATH="$HOME/bin:$PATH"
k1LoW commented 4 months ago

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

It is difficult to install using setup-tbls unless the PATH of the user running the job is changed.

And that seems to be the problem with self hosted runner.

lionslair commented 4 months ago

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

It is difficult to install using setup-tbls unless the PATH of the user running the job is changed.

And that seems to be the problem with self hosted runner.

If I preinstall golang into the image and also run

go install github.com/k1LoW/tbls@latest

should I need to run the setup?

k1LoW commented 4 months ago

If the environment and PATH are sufficient for go install, it is possible.

lionslair commented 4 months ago

Ok I have solved it by adding the .deb to the base image then I do not need to run setup in the action.

Thanks.