executor

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskTypeCreateAccount = TaskType("CreateAccount")
	TaskTypeCreateRelease = TaskType("CreateRelease")
	TaskTypeDeployRelease = TaskType("DeployRelease")
	TaskTypeRunbookRun    = TaskType("RunbookRun")
)
View Source
const AccountTypeToken = "Token"
View Source
const AccountTypeUsernamePassword = "Username/Password"

account type values match the UI

Variables

This section is empty.

Functions

func ProcessTasks

func ProcessTasks(octopus *client.Client, space *spaces.Space, tasks []*Task) error

ProcessTasks iterates over the list of tasks and attempts to run them all. If everything goes well, a nil error will be returned. On the first failure, the error will be returned and the process will halt. TODO some kind of progress/results callback? A Goroutine with channels?

Types

type Task

type Task struct {
	// which type of task this is.
	Type TaskType

	// task-specific payload (usually a struct containing the data required for this task)
	// rememmber pass this as a pointer
	Options any
}

func NewTask

func NewTask(taskType TaskType, options any) *Task

type TaskOptionsCreateAccount

type TaskOptionsCreateAccount struct {
	Type           string   // REQUIRED. refer to AccountType constant strings
	Name           string   // REQUIRED.
	Description    string   // optional
	EnvironmentIds []string // optional. // TODO the user may have specified environment string names; the outer code should resolve them before building the TaskInput
	Options        any      // subtype-specific payload
}

type TaskOptionsCreateAccountToken

type TaskOptionsCreateAccountToken struct {
	Token *core.SensitiveValue
}

type TaskOptionsCreateAccountUsernamePassword

type TaskOptionsCreateAccountUsernamePassword struct {
	Username string
	Password *core.SensitiveValue
}

type TaskOptionsCreateRelease

type TaskOptionsCreateRelease struct {
	ProjectName             string   // Required
	DefaultPackageVersion   string   // Optional
	GitCommit               string   // Optional
	GitReference            string   // Required for version controlled projects
	Version                 string   // optional
	ChannelName             string   // optional
	ReleaseNotes            string   // optional
	IgnoreIfAlreadyExists   bool     // optional
	IgnoreChannelRules      bool     // optional
	PackageVersionOverrides []string // optional
	// if the task succeeds, the resulting output will be stored here
	Response *releases.CreateReleaseResponseV1
}

type TaskOptionsDeployRelease added in v0.2.1

type TaskOptionsDeployRelease struct {
	ProjectName          string   // required
	ReleaseVersion       string   // the release to deploy
	Environments         []string // multiple for untenanted deployment, only one entry for tenanted deployment
	Tenants              []string
	TenantTags           []string
	ScheduledStartTime   string
	ScheduledExpiryTime  string
	ExcludedSteps        []string
	GuidedFailureMode    string // ["", "true", "false", "default"]. Note default and "" are the same, the only difference is whether interactive mode prompts you
	ForcePackageDownload bool
	DeploymentTargets    []string
	ExcludeTargets       []string
	Variables            map[string]string
	UpdateVariables      bool

	// true if the value was specified on the command line (because ForcePackageDownload is bool, we can't distinguish 'false' from 'missing')
	ForcePackageDownloadWasSpecified bool

	// so the automation command can mask sensitive variable output
	SensitiveVariableNames []string

	// printing a link to the release (to check deployment status) requires the release ID, not version.
	// the interactive process looks this up, so we can cache it here to avoid a second lookup when generating
	// the link for the browser. It isn't neccessary though
	ReleaseID string

	// After we send the request to the server, the response is stored here
	Response *deployments.CreateDeploymentResponseV1
}

type TaskOptionsRunbookRun added in v0.4.0

type TaskOptionsRunbookRun struct {
	ProjectName          string // required
	RunbookName          string // the name of the runbook to run
	Environments         []string
	Tenants              []string
	TenantTags           []string
	ScheduledStartTime   string
	ScheduledExpiryTime  string
	ExcludedSteps        []string
	GuidedFailureMode    string // ["", "true", "false", "default"]. Note default and "" are the same, the only difference is whether interactive mode prompts you
	ForcePackageDownload bool
	RunTargets           []string
	ExcludeTargets       []string
	Variables            map[string]string
	Snapshot             string

	// true if the value was specified on the command line (because ForcePackageDownload is bool, we can't distinguish 'false' from 'missing')
	ForcePackageDownloadWasSpecified bool

	// so the automation command can mask sensitive variable output
	SensitiveVariableNames []string

	// if the task succeeds, the resulting output will be stored here
	Response *runbooks.RunbookRunResponseV1
}

type TaskResultCreateRelease

type TaskResultCreateRelease struct {
	Version string
}

type TaskResultRunbookRun added in v0.4.0

type TaskResultRunbookRun struct {
	Version string
}

type TaskType

type TaskType string

task type definitions

Jump to

Keyboard shortcuts

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