Skip to content

Commit

Permalink
Pass cwd for hooks exec run function
Browse files Browse the repository at this point in the history
Signed-off-by: Fang-Pen Lin <[email protected]>
  • Loading branch information
fangpenlin committed Jun 16, 2023
1 parent bc5ac09 commit 3289545
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions run_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ rootless=%d
}

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

func (b *Builder) setupOCIHooks(config *spec.Spec, hasVolumes bool) (map[string][]spec.Hook, error) {
func (b *Builder) setupOCIHooks(config *spec.Spec, bundlePath string, hasVolumes bool) (map[string][]spec.Hook, error) {
allHooks := make(map[string][]spec.Hook)
if len(b.CommonBuildOpts.OCIHooksDir) == 0 {
if unshare.IsRootless() {
Expand Down Expand Up @@ -420,7 +420,7 @@ func (b *Builder) setupOCIHooks(config *spec.Spec, hasVolumes bool) (map[string]
}
}

hookErr, err := hooksExec.RuntimeConfigFilter(context.Background(), allHooks["precreate"], config, hooksExec.DefaultPostKillTimeout)
hookErr, err := hooksExec.RuntimeConfigFilter(context.Background(), allHooks["precreate"], bundlePath, config, hooksExec.DefaultPostKillTimeout)
if err != nil {
logrus.Warnf("Container: precreate hook: %v", err)
if hookErr != nil && hookErr != err {
Expand Down

0 comments on commit 3289545

Please sign in to comment.