Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions pkg/module_manager/models/hooks/kind/batch_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,27 @@ type BatchHook struct {
// hook ID in batch
ID string
config *sdkhook.HookConfig

// TODO(ipaqsa): its temp solution, better to have separate Package/Application hook
applicationName string
applicationNamespace string
}

// NewApplicationBatchHook new hook for application, which runs via the OS interpreter like bash/python/etc
func NewApplicationBatchHook(name, path, appNamespace, appName, id string, keepTemporaryHookFiles bool, logProxyHookJSON bool, logger *log.Logger) *BatchHook {
return &BatchHook{
moduleName: fmt.Sprintf("%s.%s", appNamespace, appName),
applicationName: appName,
applicationNamespace: appNamespace,
Hook: sh_hook.Hook{
Name: name,
Path: path,
KeepTemporaryHookFiles: keepTemporaryHookFiles,
LogProxyHookJSON: logProxyHookJSON,
Logger: logger,
},
ID: id,
}
}

// NewBatchHook new hook, which runs via the OS interpreter like bash/python/etc
Expand Down Expand Up @@ -150,6 +171,8 @@ func (h *BatchHook) Execute(ctx context.Context, configVersion string, bContext

// transfer information about parent module to hook
envs = append(envs, "MODULE_NAME="+h.moduleName)
envs = append(envs, "APPLICATION_NAME="+h.applicationName)
envs = append(envs, "APPLICATION_NAMESPACE="+h.applicationNamespace)

cmd := executor.NewExecutor(
"",
Expand Down
Loading