tilt-dev / tilt-extensions

Extensions for Tilt
https://tilt.dev/
Apache License 2.0
200 stars 156 forks source link

fix(restart_process): work around sticky /tmp #548

Closed thejan2009 closed 7 months ago

thejan2009 commented 7 months ago

Another attempt to fix this. Changes from previous iteration:

Disclaimer, I've not been able to test this on Windows.

If mkdir should not be used, this is a WORKDIR solution:

     FROM tiltdev/restart-helper:2021-11-03 as restart-helper

-    FROM {ref}
+    FROM {ref} as workdir
+    WORKDIR "{folder}"
     RUN ["touch", "{file}"]
     RUN ["chmod", "666", "{file}"]
+
+    FROM {ref}
+    COPY --from=workdir "{file}" "{file}"
     COPY --from=restart-helper /tilt-restart-wrapper /
     COPY --from=restart-helper /entr /

Sometimes the container root filesystem has sticky bit enabled and restart commands are ran with a different user. We can work around that by creating an intermediate folder that has "0777" permissions.

The folder name is parsed with string.rfind because os.path.dirname won't work on Windows.

Refs #540

nicks commented 7 months ago

unfortunately, we got a report that this broke things again, due to lack of sh in the base container. reverting...

nicks commented 7 months ago

https://kubernetes.slack.com/archives/CESBL84MV/p1704483542084299