New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaks on (at least some) self-hosted runners #98
Comments
How come it doesn't stop at https://github.com/cachix/install-nix-action/blob/master/lib/install-nix.sh#L4 |
We have two goals that kind of contradict each other: a) make sure we don't install Nix if it's already installed There's no definite way of detecting if Nix was installed successfully, the best shot is to source profile and check for a nix binary. |
I'll tackle this in a few days. |
I just wanted to add that we're no longer using this EC2 AWS GitHub runner project, so this is no longer a problem for us. It seems like it's worth keeping open as an issue, in any case, but I'll close it if you prefer. |
Is this possibly the same as what I'm seeing here with the |
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files). It is reported that version 14.1 does not have this issue.
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files). Ultimately however, this step is not needed for the current Galois internal runners that are already nix-based configurations.
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
There appears to be some unknowns regarding ensuring nix is installed, but not overwritten (see cachix/install-nix-action#98 and https://github.com/cachix/install-nix-actions/pull/100/files).
I'd appreciate if someone can tell if they can reproduce this with v18 |
@domenkozar I have the same issue with latest master. it looks like the check for nix already install is by-passed, It always try to reinstall nix (non-ephemeral runners). This could be because nix binary was not found in if type -p nix &>/dev/null ; then
echo "Aborting: Nix is already installed at $(type -p nix)"
exit
fi
|
What kind of OS are you running and how was Nix installed? Can I get the same image to test? |
We just use ubuntu image from AWS image builder @domenkozar |
I'll hopefully be able to look into this in a week or so. |
That's a good find! We'll need to look into how to load Nix environment without relying on rc. |
@sandangel I'm happy to accept a PR to fix this one :) |
As I've been setting up self-hosted runners I can say that I'd suggest not using install-nix-action at all and just make sure nix & cachix are installed before the runner goes into action. Sometimes that might not be possible so I'll leave this open, but for the majority of the cases that should be the right way to do it. |
There might be some clues to load the env in https://docs.github.com/en/actions/hosting-your-own-runners/running-scripts-before-or-after-a-job#triggering-the-scripts |
right now I stopped using install-nix-action and use |
Also running into this issue on my self-hosted runner.
|
If someone can give me a https://tmate.io session I can help debug this one. |
For some reason the github.action_path is not set correctly. Now using the environment variable. Relates to: cachix#98
I'm setting up a self-hosted runner and my current workaround is basically:
+ - run: sudo rm -f /etc/bash.bashrc.backup-before-nix /etc/zshrc.backup-before-nix || true
+
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-22.05
+
+ - run: sudo rm -f /etc/bash.bashrc.backup-before-nix /etc/zshrc.backup-before-nix || true
+ though I wonder if all this installing globally nix all the time is not going to have some race conditions. I need a workaround that works shared between hosted and non-hosted runners. I noticed some oddities, when I was looking at it (e.g. The Edit: Didn't took long to discover that indeed two jobs running at the same time can still choke on these backup files and one will fail. |
I don't get it. So nix installer on MacOS (only?) installs the initialization scripts in https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html There's nothing about that file being ever sourced. |
So github is hardcoding that command and gives no way to set the defaults:
One can go around and change the Whole life working around idiotic problems in terrible software. Damn it. |
So it's the installer not running successfully that breaks This is got to be some bad joke... |
OK, so here is how I make it work: Start the runner via script: #!/usr/bin/env bash
cd $HOME/actions-runner
env PATH="$HOME/actions-runner-hack/:$PATH" ./run.sh As you can see it adds an extra dir to the PATH. In this dir, we put a And that hacked #!/bin/bash
if [ -z "$SOURCED_NIX_ALREADY" ]; then
export SOURCED_NIX_ALREADY=yes
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
exec /bin/bash "$@" So basically - it can do any initialization that we need (in this case sourcing nix) and call the real Now everything just works 🤞, without any modifications to github actions scripts, with all hacking done on the runner machine. |
We recently started using https://github.com/philips-labs/terraform-aws-github-runner. It creates ephemeral self-hosted runners in EC2. Most of the time, the instances are freshly-created, but they will stick around for a bit after finishing a workflow in case another workflow quickly becomes available, in which case you might get the same instance again.
When this happens, and both the previous workflow and the next workflow use this action, we get the following failure:
I would have thought that this action checks for an existing
/nix/store
, and it appears that it used to, but that's been removed: 82ce26dThe text was updated successfully, but these errors were encountered: