Skip to content

Commit 3289545

Browse files
committed
Pass cwd for hooks exec run function
Signed-off-by: Fang-Pen Lin <[email protected]>
1 parent bc5ac09 commit 3289545

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

run_linux.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ rootless=%d
322322
}
323323

324324
// Setup OCI hooks
325-
_, err = b.setupOCIHooks(spec, (len(options.Mounts) > 0 || len(volumes) > 0))
325+
_, err = b.setupOCIHooks(spec, path, (len(options.Mounts) > 0 || len(volumes) > 0))
326326
if err != nil {
327327
return fmt.Errorf("unable to setup OCI hooks: %w", err)
328328
}
@@ -383,7 +383,7 @@ rootless=%d
383383
return err
384384
}
385385

386-
func (b *Builder) setupOCIHooks(config *spec.Spec, hasVolumes bool) (map[string][]spec.Hook, error) {
386+
func (b *Builder) setupOCIHooks(config *spec.Spec, bundlePath string, hasVolumes bool) (map[string][]spec.Hook, error) {
387387
allHooks := make(map[string][]spec.Hook)
388388
if len(b.CommonBuildOpts.OCIHooksDir) == 0 {
389389
if unshare.IsRootless() {
@@ -420,7 +420,7 @@ func (b *Builder) setupOCIHooks(config *spec.Spec, hasVolumes bool) (map[string]
420420
}
421421
}
422422

423-
hookErr, err := hooksExec.RuntimeConfigFilter(context.Background(), allHooks["precreate"], config, hooksExec.DefaultPostKillTimeout)
423+
hookErr, err := hooksExec.RuntimeConfigFilter(context.Background(), allHooks["precreate"], bundlePath, config, hooksExec.DefaultPostKillTimeout)
424424
if err != nil {
425425
logrus.Warnf("Container: precreate hook: %v", err)
426426
if hookErr != nil && hookErr != err {

0 commit comments

Comments
 (0)