Closed xdivby0 closed 3 years ago
Hi @xdivby0
Thanks for reporting the problem in great detail. 👍
There are 2 parts to it:
For now, I'd recommend that you tweak your gitlab script to not run dojo as root. I've used the following snippet in the past to run dojo on gitlab:
image: docker:latest
services:
- docker:dind
before_script:
- apk add make shadow bash sudo
- export DOJO_VERSION=0.10.0
- wget -O dojo https://github.com/kudulab/dojo/releases/download/${DOJO_VERSION}/dojo_linux_amd64
- chmod +x dojo
- mv dojo /usr/bin
- useradd --home-dir /home/ci --shell /bin/bash ci
- usermod -a -G ci ci
- mkdir -p /home/ci
- chown ci:ci /home/ci
- chown ci:ci -R .
stages:
- build
build:
stage: build
script:
- sudo -EH -u ci bash -c 'dojo "<command to run in dojo>"'
Let me know if this helps.
@tomzo I can confirm that using your gitlab yml works. Thank you very much! I am not sure wether I should click close with comment or only comment, since the actual bug is not resolved but my problem is solved. Feel free to close.
For anyone stumbling over this: For <command to run in dojo>
I had to put in dojo "npm i"
, not npm i
.
Thanks for confirmation.
We'll keep the issue open as the crash still needs to be fixed.
Hi @xdivby0. Your reproduction helped a lot! The problem was actually that Dojo requires Bash. This info was written in the readme, but this readme is quite long, so this info is easily overlooked.
@tomzo, great that you had a working gitlab yaml. I would only suggest to not use the latest
tag of docker images. But, I'm happy that the yaml helped.
Definitely, there should be no crash, like the one presented in the first message of this issue. There should be a pretty error printed, informing that Bash should be installed. This will be fixed in Dojo 0.10.1 by this PR. Thanks @xdivby0 for finding that problem. Now it will be easier to successfully run Dojo :)
Summary:
Proof: let's try running Dojo in alpine:3.9
, which does not have Bash (or even Docker) installed.
$ docker run -ti --rm -v ${PWD}/bin/dojo:/usr/bin/dojo alpine:3.9
/ # whoami
root
/ # /usr/bin/dojo
2020/10/25 14:09:58 [ 1] INFO: (main.main) Dojo version 0.10.1
2020/10/25 14:09:58 [ 1] ERROR: (main.verifyBashInstalled) Error while verifying if Bash is installed. Please make sure Bash is installed. Error: exec: "bash": executable file not found in $PATH
/ # echo $?
1
/ # exit
What I tried to do
I was trying to use dojo to build a custom environment which worked. Dojofile:
DOJO_DOCKER_IMAGE="xdivby0/mynode:0.1.0"
Dockerfile that build the specified image:Then I wrote a
.gitlab-ci.yml
to automate the dev-environment on the gitlab runner:This results in a SIGSEGV (stacktrace at the bottom of this issue).
Minimal Setup for Reproducing
You can reproduce this by running an alpine docker image with
docker run -it --rm alpine /bin/ash
and then inside the alpine run following commands that reflect what the .gitlab-ci.yml does:The resulting segmentation violation: