function

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package function holds the helpers shared across the builtin Function implementations.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is the sentinel for a resource that could not be resolved.

Functions

func ClusterConfig

func ClusterConfig(newRoundTripper apifunc.K8sRoundTripperFactory, agentID string) (*rest.Config, error)

ClusterConfig builds a rest.Config for the cluster behind agentID.

agent_id arrives as a string (Starlark has no int64) and is parsed only here.

func NewGitlabClient

func NewGitlabClient(host, token string) (*gitlab.Client, error)

NewGitlabClient builds a GitLab API client for the given host. An empty token selects the upstream Unauthenticated source — fine for public reads, and it will fail for any write.

func StructuredOutput added in v0.5.0

func StructuredOutput(v any) (any, error)

StructuredOutput JSON round-trips a value into the nested maps, slices and scalars step-runner accepts: it converts the result to structpb, which rejects a Go struct or struct slice outright and silently turns a json.RawMessage into a base64 string.

Types

type CommitAction added in v0.3.0

type CommitAction struct {
	Action       string `json:"action"`
	Path         string `json:"path"`
	Content      string `json:"content"`
	LastCommitID string `json:"last_commit_id"`
}

CommitAction is a single file change, shaped as gitlab_project.commit's actions input expects.

type VersionedFile added in v0.3.0

type VersionedFile struct {
	Path         string
	Content      string
	LastCommitID string
}

VersionedFile is one manifest file read from the repo, with the token that makes a later write to it optimistically concurrent.

func GetFiles

func GetFiles(builtinCtx runner.BuiltinContext, inputSpec map[string]*proto.Spec_Content_Input) ([]VersionedFile, error)

GetFiles reads the "files" array input off the BuiltinContext. Missing fields decode to the empty string (structpb getters are nil-safe), so the only structural error worth flagging here is an element that isn't an object.

Directories

Path Synopsis
Package argopromote implements the argo.promote builtin function: clear one canary pause gate on an Argo Rollout, idempotently.
Package argopromote implements the argo.promote builtin function: clear one canary pause gate on an Argo Rollout, idempotently.
Package argosync implements the argo.sync builtin function: set an Argo CD Application's spec.source.targetRevision and trigger a sync.
Package argosync implements the argo.sync builtin function: set an Argo CD Application's spec.source.targetRevision and trigger a sync.
Package commit implements the gitlab_project.commit builtin function: create a commit with one or more file changes on a branch in a GitLab project.
Package commit implements the gitlab_project.commit builtin function: create a commit with one or more file changes on a branch in a GitLab project.
Package functiontest holds an httptest-backed GitLab client for the builtin Function tests.
Package functiontest holds an httptest-backed GitLab client for the builtin Function tests.
Package manifest mutates Kubernetes GitOps manifests by editing a structured YAML document model, never by splicing strings into manifest text: only the matched document is re-encoded, so its siblings survive byte-for-byte.
Package manifest mutates Kubernetes GitOps manifests by editing a structured YAML document model, never by splicing strings into manifest text: only the matched document is re-encoded, so its siblings survive byte-for-byte.
Package pinimages implements manifest.pin_images: for each service, it finds the workload document matching the service name and sets each artifact's "source image:version" reference on the container already running that artifact's image repository.
Package pinimages implements manifest.pin_images: for each service, it finds the workload document matching the service name and sets each artifact's "source image:version" reference on the container already running that artifact's image repository.
Package readfile implements the gitlab_project.read_files builtin function: read one or more files from a GitLab project at a Git ref.
Package readfile implements the gitlab_project.read_files builtin function: read one or more files from a GitLab project at a Git ref.
Package setcanarystrategy implements manifest.set_canary_strategy: it finds the Rollout document matching the target service and sets its spec.strategy.canary.steps to the ladder the given weights describe, leaving every sibling key under canary as the customer wrote it.
Package setcanarystrategy implements manifest.set_canary_strategy: it finds the Rollout document matching the target service and sets its spec.strategy.canary.steps to the ladder the given weights describe, leaving every sibling key under canary as the customer wrote it.

Jump to

Keyboard shortcuts

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