You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Up until now, `restyle` worked by mounting the code directory into the
restyler container and letting the fixes occur against those files
there.
This has always come with some issues:
1. The container may change file ownership to `root`
2. The process may create working or backup files
3. The process needs to know about the host file system in order to
mount correctly if `restyle` itself is dockerized
(1) was an open issue we've not solved. (2) we solved with a Big Hammer,
running `git clean` at the end. And (3) we had solved with a
`HOST_DIRECTORY` option, but thankfully no longer needed when we moved
to a native `restyle` binary.
Attempting to run on Forgejo actions reintroduces (3) because `restyle`
is again in a container there. Unfortunately we can't (easily) solve it
with `HOST_DIRECTORY` because that path is more volatile and harder to
discover than it was on GitHub Actions. Therefore a new solution was
implemented.
Now, what we do is:
1. Create a docker volume
2. Use a temporary container to fill the volume with the current
directory's contents
3. Run all restylers with that volume mounted
4. Use a temporary container to copy out the paths we were attempting to
restyle
This is a bit of complexity, but at least 1, 2, and 4 occur once and not
per restyler. It completely avoids having to have knowledge of the host
file system since the `docker cp` commands work with paths where they
are even if the process it itself containerized.
As a bonus, we avoid the other two other issues:
1. The files are copied out, and so retain correct ownership, instead of
being modified in a container as `root`
2. Since we aren't mounting the whole directory, but only copying back
out the files we intended to change, we have no issue with dirtying
things such that we need or want a `git clean` step
0 commit comments