deploy

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deploy reads a workly.yaml, which declares queues, workflows and schedules, and works out the changes that make a server match it. The CLI's validate, plan and deploy commands are built on it.

Index

Constants

View Source
const Version = 1

Version is the file format version this package reads.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int
const (
	Unchanged Action = iota
	Create
	Update
	// Delete is planned only with prune: true, for what the file leaves out.
	Delete
)

type Change

type Change struct {
	Kind   string // "queue", "workflow" or "schedule"
	Name   string
	Action Action
	// Diffs lists the settings an update changes.
	Diffs []Diff
	// Paused is set for an existing queue or schedule that is paused.
	// Deploying leaves it paused.
	Paused bool
	// Body is the PUT request body: an api.QueueConfig, api.WorkflowConfig
	// or api.ScheduleConfig. Deletes have none.
	Body any
	// Failed counts the failed tasks a queue's delete takes with it.
	Failed int
}

Change is what deploying does to one declared queue, workflow or schedule.

type Default added in v0.4.1

type Default struct {
	Line  int
	Field string
	Name  string
	Value string
}

Default is a ${NAME:-value} reference whose variable wasn't set (or was empty), so value was used for it in Field.

type Diff

type Diff struct {
	Field  string
	Change string
}

Diff is one changed setting. Change reads "old → new", or for header values and bodies, which may hold secrets, just "changed", "added" or "removed".

type File

type File struct {
	Path                                  string
	Queues                                []Queue
	Workflows                             []Workflow
	Schedules                             []Schedule
	HasQueues, HasWorkflows, HasSchedules bool
	// Prune deletes what a managed section leaves out (prune: true).
	Prune bool
	// Defaults lists the ${NAME:-default} references that took their
	// default, in file order, so plan can show them: a variable CI forgot
	// to set would otherwise deploy a local default without a word.
	Defaults []Default
}

File is a valid workly.yaml. A section left out of the file isn't managed by it (HasQueues, HasWorkflows, HasSchedules); an empty one declares nothing.

func Load

func Load(path string, getenv func(string) (string, bool)) (*File, error)

Load reads and validates the file at path, replacing ${NAME} in values with environment variables looked up by getenv (os.LookupEnv in the CLI).

func Parse

func Parse(path string, data []byte, getenv func(string) (string, bool)) (*File, error)

Parse is Load for a file already read.

func (*File) Plan

func (f *File) Plan(queues []api.Queue, workflows []api.Workflow, schedules []api.Schedule) (Plan, error)

Plan compares the file with the queues, workflows and schedules on the server. With prune, it fails if a queue it would delete still has tasks to deliver: those tasks would be lost, and the next enqueue would bring the queue back anyway.

type InvalidError

type InvalidError struct {
	Path     string
	Problems []Problem
}

InvalidError lists every problem found in a file.

func (*InvalidError) Error

func (e *InvalidError) Error() string

type Plan

type Plan struct {
	// Changes has every declared queue, then every declared workflow, then
	// every declared schedule, in file order, unchanged ones included. That
	// is the order they are applied in, so a schedule's workflow exists by
	// the time the schedule is put. With prune, the deletes follow, in the
	// reverse order (schedules, workflows, queues), so nothing is deleted
	// while something left on the server still points at it.
	Changes []Change
	// Undeclared lists the schedules on the server the file doesn't
	// declare, if it has a schedules section and doesn't prune. Deploying
	// leaves them alone. Queues aren't listed: enqueueing creates them, so
	// most aren't in a file.
	Undeclared []string
	// UndeclaredWorkflows does the same for workflows.
	UndeclaredWorkflows []string
}

func (Plan) Count

func (p Plan) Count(a Action) int

type Problem

type Problem struct {
	Line    int
	Field   string
	Message string
}

Problem is one thing wrong with a file: where, which field (a path such as schedules.nightly.cron) and what.

type Queue

type Queue struct {
	Name   string
	Config api.QueueConfig
	// contains filtered or unexported fields
}

Queue is a declared queue: Config is the PUT body, settings what it becomes with defaults applied.

type Schedule

type Schedule struct {
	Name   string
	Config api.ScheduleConfig
	// contains filtered or unexported fields
}

type Workflow added in v0.4.0

type Workflow struct {
	Name   string
	Config api.WorkflowConfig
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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