bugy / script-server

Web UI for your scripts with execution management
Other
1.52k stars 244 forks source link

Walk runners dir and kubernetes can cause multiple script entries in ui #696

Open underscoredje opened 9 months ago

underscoredje commented 9 months ago

Hi,

This bug is related to improvement/PR https://github.com/bugy/script-server/pull/416 and kubernetes, in a particular case.

When we use a single configMap to store all script definitions, and mount it in /app/conf/runners dir, kubernetes will use a ..data symlink and a ..${timestamp} subdir to mount files.

Here is a example:

root@script-server-test-644b95dbd6-24qw7:/app/conf/runners# ls -la
total 0
drwxrwxrwx. 3 root root 163 Sep 20 14:07 .
drwxrwxr-x. 1 root root  55 Sep 20 14:07 ..
drwxr-xr-x. 2 root root 110 Sep 20 14:07 ..2023_09_20_14_07_21.420611733
lrwxrwxrwx. 1 root root  31 Sep 20 14:07 ..data -> ..2023_09_20_14_07_21.420611733
lrwxrwxrwx. 1 root root  26 Sep 20 14:07 kubconfig_file.json -> ..data/kubconfig_file.json
lrwxrwxrwx. 1 root root  16 Sep 20 14:07 test.json -> ..data/test.json

It will cause multiple script entries in UI.

A workaround is to use separate configMaps: one for each script definition which makes deployment manifest syntax heavier.

Maybe we can make an exception when walking through runners dir a avoid folders begining with .. ?

bugy commented 9 months ago

Hi @underscoredje thanks for reporting. I think it should be a good idea to ignore folders starting with a single dot. I don't expect people using hidden folders frequently Do you want to work on a PR? :)

underscoredje commented 9 months ago

Hi @bugy,

My python skill is low (I'm not even a dev), but, yeah, I´ll try to work on it.