internal/pkg: fail on empty output directory
All checks were successful
Test / Create distribution (push) Successful in 54s
Test / Sandbox (push) Successful in 2m59s
Test / ShareFS (push) Successful in 4m49s
Test / Sandbox (race detector) (push) Successful in 5m17s
Test / Hpkg (push) Successful in 5m24s
Test / Hakurei (push) Successful in 5m43s
Test / Hakurei (race detector) (push) Successful in 7m32s
Test / Flake checks (push) Successful in 1m49s
All checks were successful
Test / Create distribution (push) Successful in 54s
Test / Sandbox (push) Successful in 2m59s
Test / ShareFS (push) Successful in 4m49s
Test / Sandbox (race detector) (push) Successful in 5m17s
Test / Hpkg (push) Successful in 5m24s
Test / Hakurei (push) Successful in 5m43s
Test / Hakurei (race detector) (push) Successful in 7m32s
Test / Flake checks (push) Successful in 1m49s
This works around the fact that execArtifact always creates the work directory when setting up the bind mount. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"slices"
|
"slices"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"hakurei.app/container"
|
"hakurei.app/container"
|
||||||
"hakurei.app/container/check"
|
"hakurei.app/container/check"
|
||||||
@@ -286,8 +287,9 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) {
|
|||||||
}
|
}
|
||||||
z.Bind(b[0], b[1], 0)
|
z.Bind(b[0], b[1], 0)
|
||||||
}
|
}
|
||||||
|
work := c.GetWorkDir()
|
||||||
z.Bind(
|
z.Bind(
|
||||||
c.GetWorkDir(),
|
work,
|
||||||
fhs.AbsRoot.Append("work"),
|
fhs.AbsRoot.Append("work"),
|
||||||
std.BindWritable|std.BindEnsure,
|
std.BindWritable|std.BindEnsure,
|
||||||
)
|
)
|
||||||
@@ -322,5 +324,19 @@ func (a *execArtifact) cure(c *CureContext, hostNet bool) (err error) {
|
|||||||
if err = z.Serve(); err != nil {
|
if err = z.Serve(); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return z.Wait()
|
if err = z.Wait(); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not allow empty directories to succeed
|
||||||
|
for {
|
||||||
|
err = syscall.Rmdir(work.String())
|
||||||
|
if err != syscall.EINTR {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil && errors.Is(err, syscall.ENOTEMPTY) {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user