-
Notifications
You must be signed in to change notification settings - Fork 486
Open
Description
Describe the bug
It seems dgoss
doesn't work on MacOS because /tmp
is private (I guess). I.e. docker cannot see files created by user.
How To Reproduce
Install current dgoss & goss on MacOS as described in documentation and try dgoss edit alpine sleep 1000
e.g. You may see there is no goss
binary copied into container. See Actual Behavior for example.
Expected Behavior
It's expected to have /goss/goss
binary in docker container.
➜ dgoss edit alpine sleep 1000
INFO: Starting docker container
INFO: Container ID: f1911630
INFO: Run goss add/autoadd to add resources
/goss # ls -la /goss/
total 8332
drwxrwxrwx 4 root root 128 Sep 30 11:30 .
drwxr-xr-x 1 root root 4096 Sep 30 11:30 ..
-rw-r--r-- 1 root root 0 Sep 30 11:30 docker_output.log
-rwxr-xr-x 1 root root 8524064 Sep 30 11:30 goss
Actual Behavior
➜ dgoss edit alpine sleep 1000
INFO: Starting docker container
INFO: Container ID: 389e40a1
INFO: Run goss add/autoadd to add resources
/goss # ls -la /goss/
total 4
drwxr-xr-x 2 root root 40 Sep 30 11:27 .
drwxr-xr-x 1 root root 4096 Sep 30 11:27 ..
Environment:
- goss version v0.3.6
- MacOS Mojave 10.14.6 (18G6020)
How to fix
I fixed it for myself by applying the following change. Actually I'm just using ~/tmp
instead of /tmp
. I'm not sure it's good solution for everyone though.. I'd prefer to be able to override it via environment variable.
➜ diff -u dgoss.orig dgoss
--- dgoss.orig 2020-09-30 19:30:28.000000000 +0800
+++ dgoss 2020-09-30 19:30:37.000000000 +0800
@@ -66,7 +66,7 @@
}
# Main
-tmp_dir=$(mktemp -d /tmp/tmp.XXXXXXXXXX)
+tmp_dir=$(mktemp -d ~/tmp/tmp.XXXXXXXXXX)
chmod 777 "$tmp_dir"
trap 'ret=$?;cleanup;exit $ret' EXIT