Closed cosmoshepcat closed 10 months ago
Please check out the new 1.7.0
release which should be available shortly.
Now you can set TART_EXECUTOR_INSTALL_GITLAB_RUNNER: "brew"
to force the GitLab Runner installation via the Homebrew.
We've also added additional script debugging capabilities, so you should be able to see what's up in the job log.
so i started testing this and running into the same behavior where tart cannot find any of these executables inside the vm but i cannot replicate the issue locally. we install brew/gitlab-runner in /usr/local/bin. it is in the vms path for the admin user and any pipeline or even local tart run using that user can easily find those commands.
BUT the gitlab pipelines during the prepare stage cannot find them and error out. CURL always works but that is likely due to it being in the actual base os system path. What I do not fully comprehend is how the tart executor invokes ssh in the prepare stage--> it seems to be operating without executing any bashrc/profile etc and running in a super limited PATH
It is definately a PATH issue when the initial gitlab-tart-executor does the ssh to the vm during prepare stage. it is not looking by default in any non-stock paths. I slightly modified the brew bash script to test this so it echos the path and in the second test it used path_helper to update the path env.
at first i only added a simple echo of PATH and echo of 'type gitlab-runner' and reran the job: Using Custom executor... 2024/01/17 13:21:48 Cloning and configuring a new VM... 2024/01/17 13:21:48 Waiting for the VM to boot and be SSH-able... 2024/01/17 13:21:57 Was able to SSH! 2024/01/17 13:21:57 Installing GitLab Runner... /usr/bin:/bin:/usr/sbin:/sbin -bash: line 14: type: gitlab-runner: not found 2024/01/17 13:21:57 Process exited with status 1
I modified the code to use the same path_helper as referenced in /etc/profile:
if [ -x /usr/libexec/path_helper ]; then
eval /usr/libexec/path_helper -s
fi
echo $PATH type gitlab-runner
# Is GitLab Runner already installed?
if type gitlab-runner &> /dev/null
then
echo "GitLab Runner is already installed, skipping installation"
exit 0
fi
2024/01/17 13:28:39 Cloning and configuring a new VM... 2024/01/17 13:28:39 Waiting for the VM to boot and be SSH-able... 2024/01/17 13:28:47 Was able to SSH! 2024/01/17 13:28:47 Installing GitLab Runner... /usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin gitlab-runner is /usr/local/bin/gitlab-runner GitLab Runner is already installed, skipping installation 2024/01/17 13:28:47 VM is ready.
Closing because this is not an issue with GitLab Tart Executor.
For images published by Cirrus Labs everything should work just fine.
If you're building your own images, please check the $SHELL
that you're using and configure your shell environment correspondingly.
If you're using a custom TART_EXECUTOR_SHELL
, add the -l
argument, so that the shell will read .profile
/.zprofile
/etc.
TL;DR == even with brew installed in the vm and/or gitlab-runner installed in the vm the script always downloads from curl.
So I am not sure why this is happening but it always has been doing this we just had an issue today where the curl download was intermittently having issues and corrupting the builds since it could not upload artifacts or run.
In the job log we saw:
What is interesting though is our tart vm images have brew installed and we even rebuilt the vm image to also have brew install the gitlab-runner already on it.
Reading the source code for the embedded shell script it should have first found gitlab-runner and just exited--even if that is not installed it should then run the type check for brew and find that and install via brew. However no matter what is on the vm the only thing it finds is curl and then downloads from the CDN.
If i launch the vm and literally take that script from this repo and run it manually it works fine. It will find gitlab-runner and exit; or if i remove gitlab-runner it will find brew and install it. Only when running via the tart custom executor does it not find these and always use curl.
We really want to keep using this functionality but it should use our installed brew. I am not a go programmer but the only thing i can think of is somehow the ssh it is doing is coming up with a very limited or no PATH being set and only the apple /usr/bin/curl is being found.