OSnap
OSnap copied to clipboard
Container image fails when home dir changed, e.g. github actions
Running osnap in github actions fails, it gets stuck attempting to download chrome.
The reason it can't find it is because chrome is in /root/..., but is then accessed via ~/... or $HOME/.... GitHub Actions overrides the home dir to /github/home, and so it fail to find the already installed chrome.
Adding the following step to the job makes everything work perfectly:
- name: Copy osnap chromium into home
run: mv /root/osnap* ~/
A couple potential ideas to mitigate this:
- Use a full absolute path to the chrome install, i.e.
/root/... - Perhaps having an actual run in the project actions - currently it just does
osnap --help=plainwhich checks it's installed, but doesn't trigger a dependency check, e.g. chrome
Hi 🙂
I am not quite sure I understand.
You are not running OSnap inside a docker container in Github Actions, right? Or is GitHub somehow changing the home path inside of the docker image?
Running real tests in the build pipeline is something on my todo list. Would be happy to accept contributions here 🙂
So this is an example workflow:
name: osnap
jobs:
osnap:
runs-on: ubuntu-latest
name: Run OSnap tests
container: osnap/debian:latest
steps:
# Various steps to get the app running locally...
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# Necessary step to get working in GitHub actions which modified the home directory.
- name: Copy osnap chromium into home
run: mv /root/osnap* ~/
- name: Run the tests
run: osnap
When you use a container for the test run itself, GitHub does a bunch of other things as well, such as mounting code etc. That includes modifying the home directory for root.
I'm sure it'd be possible to not use a container, and instead run docker run ... on the host itself, I expect that would not exhibit the same behaviour.