jobcontext

package
v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrentContextVersionEnv     = "C2J_CURRENT_CONTEXT_VERSION"
	CurrentTenantIDEnv           = "C2J_CURRENT_TENANT_ID"
	CurrentJobIDEnv              = "C2J_CURRENT_JOB_ID"
	CurrentJobTypeEnv            = "C2J_CURRENT_JOB_TYPE"
	CurrentOpTypeEnv             = "C2J_CURRENT_OP_TYPE"
	CurrentOpStepEnv             = "C2J_CURRENT_OP_STEP"
	CurrentOpTaskTypeEnv         = "C2J_CURRENT_OP_TASK_TYPE"
	CurrentCellNameEnv           = "C2J_CURRENT_CELL_NAME"
	CurrentRepositorySourceEnv   = "C2J_CURRENT_REPOSITORY_SOURCE"
	CurrentGitRefEnv             = "C2J_CURRENT_GIT_REF"
	CurrentInvocationPathEnv     = "C2J_CURRENT_INVOCATION_PATH"
	CurrentInvocationSequenceEnv = "C2J_CURRENT_INVOCATION_SEQUENCE"
	CurrentInvocationHashEnv     = "C2J_CURRENT_INVOCATION_HASH"

	ChildJobEndpointEnv  = "C2J_CHILD_JOB_ENDPOINT"
	ChildJobTokenEnv     = "C2J_CHILD_JOB_TOKEN"
	ChildJobSessionIDEnv = "C2J_CHILD_JOB_SESSION_ID"

	// TenantIDEnv is kept as a convenience for child tools that still consume a
	// tenant-only environment default. The current c2j CLI resolves through
	// C2J_JOBDB instead.
	TenantIDEnv = "C2J_TENANT_ID"

	CurrentContextVersion = "1"
)

Variables

This section is empty.

Functions

func EnvForChildJobBroker

func EnvForChildJobBroker(b ChildJobBroker) map[string]string

func EnvForCurrent

func EnvForCurrent(c Current) map[string]string

func MergeProtectedEnv

func MergeProtectedEnv(base map[string]string, protected map[string]string) map[string]string

Types

type ChildJobBroker

type ChildJobBroker struct {
	Endpoint  string `json:"endpoint,omitempty"`
	Token     string `json:"token,omitempty"`
	SessionID string `json:"session_id,omitempty"`
}

func ChildJobBrokerFromEnv

func ChildJobBrokerFromEnv(getenv func(string) string) (ChildJobBroker, bool, error)

type Current

type Current struct {
	TenantID           string `json:"tenant_id,omitempty"`
	JobID              string `json:"job_id,omitempty"`
	JobType            string `json:"job_type,omitempty"`
	OpType             string `json:"op_type,omitempty"`
	OpStep             string `json:"op_step,omitempty"`
	OpTaskType         string `json:"op_task_type,omitempty"`
	CellName           string `json:"cell_name,omitempty"`
	RepositorySource   string `json:"repo,omitempty"`
	GitRef             string `json:"git_ref,omitempty"`
	InvocationPath     string `json:"invocation_path,omitempty"`
	InvocationSequence int64  `json:"invocation_seq,omitempty"`
	InvocationHash     string `json:"invocation_hash,omitempty"`
}

func CurrentFromEnv

func CurrentFromEnv(getenv func(string) string) (Current, bool, error)

func (Current) HasJob

func (c Current) HasJob() bool

type Parent

type Parent struct {
	TenantID           string `json:"tenant_id,omitempty"`
	JobID              string `json:"job_id,omitempty"`
	JobType            string `json:"job_type,omitempty"`
	OpType             string `json:"op_type,omitempty"`
	OpStep             string `json:"op_step,omitempty"`
	OpTaskType         string `json:"op_task_type,omitempty"`
	CellName           string `json:"cell_name,omitempty"`
	RepositorySource   string `json:"repo,omitempty"`
	GitRef             string `json:"git_ref,omitempty"`
	InvocationPath     string `json:"invocation_path,omitempty"`
	InvocationSequence int64  `json:"invocation_seq,omitempty"`
	InvocationHash     string `json:"invocation_hash,omitempty"`
}

func ParentFromCurrent

func ParentFromCurrent(c Current) Parent

func ParentFromEnv

func ParentFromEnv(getenv func(string) string) (Parent, bool, error)

func (Parent) HasJob

func (p Parent) HasJob() bool

type StartedJobContext

type StartedJobContext struct {
	TenantID             string `json:"tenant_id,omitempty"`
	JobID                string `json:"job_id,omitempty"`
	RecipeName           string `json:"recipe,omitempty"`
	Status               string `json:"status,omitempty"`
	ParentInvocationHash string `json:"parent_invocation_hash,omitempty"`
}

type StartedJobsContext

type StartedJobsContext struct {
	JobIDs []string            `json:"job_ids,omitempty"`
	Items  []StartedJobContext `json:"items,omitempty"`
}

func EmptyStartedJobsContext

func EmptyStartedJobsContext() StartedJobsContext

Jump to

Keyboard shortcuts

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