-
Notifications
You must be signed in to change notification settings - Fork 130
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
Support: Figure out why script's "current directory" fails to be read #81
Comments
Not sure if this helps, Shell / Rust version:
|
I'll try to reproduce. Not sure if it will be that simple. |
can you explain more about the setup? |
yeap the problem occurred when the project is under the runner home directory — ... and of course when I tried to reproduce the issue today, the script task worked — using exactly the same directory and user as yesterday. I don't think it's worth trying to reproduce this since it doesn't even happen on the same machine (within 24 hours), restarting must have fixed it. I'll close this since it's transient and can't be reproduced. sad happy face 😶 Thank you for trying though, it's much appreciated 🙃
Pretty much install gitlab-runner on linux and then point it at a workspace project with a Just for the record, these snippets may be useful in the future if it ever comes up again Denied: #! /bin/bash
mkdir test_denied
cd test_denied
cargo init --lib member
cat > Cargo.toml <<EOF
[workspace]
members = ["member"]
EOF
cat > Makefile.toml <<EOF
[tasks.conformance]
script = ["echo hi"]
EOF
cargo make --no-workspace conformance Permissions: #! /bin/bash
parts=(${PWD//\// })
cd /
for part in ${parts[@]}; do
echo $(stat -c "%A %U" .) $(pwd)
cd $part
done
echo $(stat -c "%A %U" .) $(pwd)
|
Hey, this happened twice since I closed it, I'll reopen in case it's a cargo-make issue, but shall investigate it again now. I haven't got solid clues to what's causing it, but it may be to do with rust It's happened on both my regular |
Latest cargo and rust are both broken. |
cargo doesn't support sub commands critical issue: rust-lang/cargo#5212 So i suggest you use rustup and default it to nightly of 2018-02-01 which works good. |
Yeaps I've juust tried |
ok, please keep me updated. if you find an issue in cargo-make itself and would like to create a PR, I would much appreciate it. |
Traced it! Literally, There's a bug in
Since my laptop is used by me as well as Fix is to add random characters to the temporary directory itself. Perhaps we should make it a temporary directory, either using |
you mean if I do /tmp/run_script/123/somescript.sh where 123 is random number everytime, it should resolve it? |
nope, like
|
ok, i got it. maybe I could add username in there /tmp/user/run_script/123.sh |
Yeaps that should 👍 |
I'll handle it now |
I'm going to publish a new version that would ensure the minimal version of run_script has the fix. |
new version published. can you please verify? |
Yeaps it works! 🎉 Thank you! |
Thank you for finding the root cause 👍 |
Problem Description
Hiya, I need help with figuring out why a script task works as my local user, but does not work when I run it through a CI runner.
I have a
conformance
task in a workspace repository root'sMakefile.toml
, which contains ascript
.The actual script content doesn't matter — when I run this as myself, I get the
hi
. My CI runner is my laptop, installed as its owngitlab-runner
user.When I run
cargo make --no-workspace conformance
asgitlab-runner
, it fails with:Modifying
cargo-make
a little, I get this bit of information:So the runner apparently hits
"Permission denied"
before executing the script. I traced this to [email protected]: runner.rs#L92,current_dir()
is returningErr
(EACCES
).Based on the Rust docs, source code, googling, and checking file permissions (I checked every parent directory along the working dir to see that it's
ugo r+x
), the more likely reason for the error is the working directory "does not exist", or is incorrect.So, I tried figuring out what the working directory is.
Cargo make successfully changes it to
.
, and my mini experiment, compiled and run from the same repository successfully gets thecurrent_dir()
:Output:
This is where I ran out of ideas 😭
The text was updated successfully, but these errors were encountered: