worker

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package worker provides the defined worker CLI command for Vela.

Usage:

import "github.com/go-vela/cli/command/worker"

Index

Constants

This section is empty.

Variables

View Source
var CommandAdd = &cli.Command{
	Name:        "worker",
	Description: "(Platform Admin Only) Use this command to add a worker.",
	Usage:       "Add a new worker from the provided configuration",
	Action:      add,
	Flags: []cli.Flag{

		&cli.StringFlag{
			EnvVars: []string{"VELA_WORKER_ADDRESS", "WORKER_ADDRESS"},
			Name:    internal.FlagWorkerAddress,
			Aliases: []string{"wa"},
			Usage:   "provide the address of the worker as a fully qualified url (<scheme>://<host>)",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_WORKER_HOSTNAME", "WORKER_HOSTNAME"},
			Name:    internal.FlagWorkerHostname,
			Aliases: []string{"wh"},
			Usage:   "provide the hostname of the worker (defaults to hostname of worker address)",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "WORKER_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew or yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Add a worker reachable at the provided address.
    $ {{.HelpName}} --worker.address https://myworker.example.com
  2. Add a worker reachable at the provided address with specific hostname.
    $ {{.HelpName}} --worker.hostname MyWorker --worker.address https://myworker.example.com

DOCUMENTATION:

  https://go-vela.github.io/docs/reference/cli/worker/add/
`, cli.CommandHelpTemplate),
}

CommandAdd defines the command for adding a worker.

View Source
var CommandGet = &cli.Command{
	Name:        "worker",
	Aliases:     []string{"workers"},
	Description: "Use this command to get a list of workers.",
	Usage:       "Display a list of workers",
	Action:      get,
	Flags: []cli.Flag{

		&cli.StringFlag{
			EnvVars: []string{"VELA_ACTIVE", "WORKER_ACTIVE"},
			Name:    internal.FlagActive,
			Aliases: []string{"a"},
			Usage:   "return workers based on active status",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_CHECKED_IN_BEFORE", "CHECKED_IN_BEFORE"},
			Name:    internal.FlagBefore,
			Aliases: []string{"bf", "until"},
			Usage:   "before time constraint",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_CHECKED_IN_AFTER", "CHECKED_IN_AFTER"},
			Name:    internal.FlagAfter,
			Aliases: []string{"af", "since"},
			Usage:   "after time constraint",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "WORKER_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in wide, json, spew or yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Get a list of workers.
    $ {{.HelpName}}
  2. Get a list of workers with wide view output.
    $ {{.HelpName}} --output wide
  3. Get a list of workers with yaml output.
    $ {{.HelpName}} --output yaml
  4. Get a list of workers with json output.
    $ {{.HelpName}} --output json
  5. Get a list of workers when config or environment variables are set.
    $ {{.HelpName}}

DOCUMENTATION:

  https://go-vela.github.io/docs/reference/cli/worker/get/
`, cli.CommandHelpTemplate),
}

CommandGet defines the command for capturing a list of workers.

View Source
var CommandUpdate = &cli.Command{
	Name:        "worker",
	Description: "(Platform Admin Only) Use this command to update a worker.",
	Usage:       "Update a worker from the provided configuration",
	Action:      update,
	Flags: []cli.Flag{

		&cli.StringFlag{
			EnvVars: []string{"VELA_WORKER_ACTIVE", "WORKER_ACTIVE"},
			Name:    internal.FlagActive,
			Aliases: []string{"a"},
			Usage:   "current status of the worker",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_WORKER_ADDRESS", "WORKER_ADDRESS"},
			Name:    internal.FlagWorkerAddress,
			Aliases: []string{"wa"},
			Usage:   "provide the address of the worker as a fully qualified url (<scheme>://<host>)",
		},
		&cli.IntFlag{
			EnvVars: []string{"VELA_WORKER_BUILD_LIMIT", "WORKER_BUILD_LIMIT"},
			Name:    "build-limit",
			Aliases: []string{"bl"},
			Usage:   "build limit for the worker",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_WORKER_HOSTNAME", "WORKER_HOSTNAME"},
			Name:    internal.FlagWorkerHostname,
			Aliases: []string{"wh"},
			Usage:   "provide the hostname of the worker",
		},
		&cli.StringSliceFlag{
			EnvVars: []string{"VELA_WORKER_ROUTES", "WORKER_ROUTES"},
			Name:    "routes",
			Aliases: []string{"r"},
			Usage:   "route assignment for the worker",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "WORKER_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew or yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Update a worker to change its build limit to 2.
    $ {{.HelpName}} --worker.hostname MyWorker --build-limit 2
  2. Update a worker with custom routes.
    $ {{.HelpName}} --worker.hostname MyWorker --route large --route small

DOCUMENTATION:

  https://go-vela.github.io/docs/reference/cli/worker/update/
`, cli.CommandHelpTemplate),
}

CommandUpdate defines the command for modifying a worker.

View Source
var CommandView = &cli.Command{
	Name:        "worker",
	Description: "Use this command to view a worker.",
	Usage:       "View details of the provided worker",
	Action:      view,
	Flags: []cli.Flag{

		&cli.StringFlag{
			EnvVars: []string{"VELA_WORKER_HOSTNAME", "WORKER_HOSTNAME"},
			Name:    internal.FlagWorkerHostname,
			Aliases: []string{"wh"},
			Usage:   "provide the hostname of the worker",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_WORKER_REGISTRATION_TOKEN", "WORKER_REGISTRATION_TOKEN"},
			Name:    internal.FlagWorkerRegistrationToken,
			Aliases: []string{"wr"},
			Usage:   "toggle to show the registration token for the worker",
			Value:   "false",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "WORKER_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew or yaml",
			Value:   "yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. View details of a worker.
    $ {{.HelpName}} --worker.hostname MyWorker
  2. View registration token for a worker.
    $ {{.HelpName}} --worker.hostname MyWorker --worker.registration.token true
  3. View details of a worker with json output.
    $ {{.HelpName}} --worker.hostname MyWorker --output json
  4. View details of a worker when config or environment variables are set.
    $ {{.HelpName}}

DOCUMENTATION:

  https://go-vela.github.io/docs/reference/cli/worker/view/
`, cli.CommandHelpTemplate),
}

CommandView defines the command for inspecting a worker.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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