gitlabfunctions

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package gitlabfunctions implements the gitlab-function AutoFlow module: the bridge that lets a Starlark workflow call this repo's built-in CD Functions with load("module:gitlab-function", "run") then run(function="builtin://gitlab_project.read_files", inputs={...}).

Module implements gitlab-agent's autoflow.Module interface directly, speaking AutoFlow proto Values on the boundary and step-runner/structpb types within, so the same module serves the integration test now and can merge into kas later unchanged.

run is synchronous. A function-level failure (bad reference, unknown function, execution error) is returned as a Result with an Error, which the engine turns into an uncatchable Starlark error that aborts the workflow, so any retry must live in the Go function. Only an unknown action is surfaced as a Go error.

Index

Constants

View Source
const ModuleName = "gitlab-function"

ModuleName is the name kas registers the module under.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module is the gitlab-function module. Construct it with NewModule.

func NewModule

func NewModule(newRoundTripper apifunc.K8sRoundTripperFactory) (*Module, error)

NewModule builds the module and its embedded step-runner. It errors only if the step-runner cannot be built, so wiring fails fast rather than on first call.

newRoundTripper is the cluster seam kas supplies: cluster-touching Functions (argo.sync today) obtain their Kubernetes client through it. The GitLab token resolver is owned by the module (envGitLabToken) and threaded into each Function the same way.

func (*Module) InvokeAction

func (m *Module) InvokeAction(ctx context.Context, actionName, _, _ string, args []*autoflow.Value, kwargs []*autoflow.Kwarg, _ []*autoflow.ChannelToken) (*autoflow.Result, error)

InvokeAction dispatches an action call. run takes keyword arguments (function=, inputs=, timeout=) and no positional arguments; workflowKey, identityKey, and channelTokens are unused. Only an unknown action returns a Go error; every function-level outcome is a Result.

func (*Module) LoadModuleDescriptor

func (m *Module) LoadModuleDescriptor(ctx context.Context) (*autoflow.ModuleDescriptor, error)

LoadModuleDescriptor lists the module's single action, run. It declares no vars and no custom proto types, so the descriptor set is empty.

func (*Module) Name

func (m *Module) Name() string

Name returns the module name kas registers it under.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL