deploy

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 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 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
)

type Change

type Change struct {
	Kind   string // "queue" 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 or api.ScheduleConfig.
	Body any
}

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

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
	Schedules               []Schedule
	HasQueues, HasSchedules bool
}

File is a valid workly.yaml. A section left out of the file isn't managed by it (HasQueues, 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, schedules []api.Schedule) (Plan, error)

Plan compares the file with the queues and schedules on the server.

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 and then every declared schedule, in
	// file order, unchanged ones included.
	Changes []Change
	// Undeclared lists the schedules on the server the file doesn't
	// declare, if it has a schedules section. Deploying leaves them alone.
	// Queues aren't listed: enqueueing creates them, so most aren't in a
	// file.
	Undeclared []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
}

Jump to

Keyboard shortcuts

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