deployment

package
v0.23.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package deployment provides the defined deployment CLI commands for Vela.

Usage:

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

Index

Constants

This section is empty.

Variables

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

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "DEPLOYMENT_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the deployment",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "DEPLOYMENT_REPO"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the deployment",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_REF", "DEPLOYMENT_REF"},
			Name:    "ref",
			Usage:   "provide the reference to deploy - this can be a branch, commit (SHA) or tag",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_TARGET", "DEPLOYMENT_TARGET"},
			Name:    "target",
			Aliases: []string{"t"},
			Usage:   "provide the name for the target deployment environment",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_DESCRIPTION", "DEPLOYMENT_DESCRIPTION"},
			Name:    "description",
			Aliases: []string{"d"},
			Usage:   "provide the description for the deployment",
			Value:   "Deployment request from Vela",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_TASK", "DEPLOYMENT_TASK"},
			Name:    "task",
			Aliases: []string{"tk"},
			Usage:   "Provide the task for the deployment",
			Value:   "deploy:vela",
		},
		&cli.StringSliceFlag{
			EnvVars: []string{"VELA_PARAMETERS", "DEPLOYMENT_PARAMETERS"},
			Name:    "parameter",
			Aliases: []string{"p"},
			Usage:   "provide the parameter(s) within `key=value` format for the deployment",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PARAMETERS_FILE", "DEPLOYMENT_PARAMETERS_FILE"},
			Name:    "parameters-file",
			Aliases: []string{"pf", "parameter-file"},
			Usage:   "provide deployment parameters via a JSON or env file",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "DEPLOYMENT_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew or yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Add a deployment for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo
  2. Add a deployment for a repository with a specific target environment.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --target stage
  3. Add a deployment for a repository with a specific branch reference.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --ref dev
  4. Add a deployment for a repository with a specific commit reference.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --ref 48afb5bdc41ad69bf22588491333f7cf71135163
  5. Add a deployment for a repository with a specific tag reference.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --ref refs/tags/1.0.0
  6. Add a deployment for a repository with a specific description.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --description 'my custom message'
  7. Add a deployment for a repository with two parameters.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --parameter 'key=value' --parameter 'foo=bar'
  8. Add a deployment for a repository with a parameters JSON file.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --parameters-file params.json
  9. Add a deployment for a repository when config or environment variables are set.
    $ {{.HelpName}}

DOCUMENTATION:

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

CommandAdd defines the command for creating a deployment.

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

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "DEPLOYMENT_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the deployment",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "DEPLOYMENT_REPO"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the deployment",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "DEPLOYMENT_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew, wide or yaml",
		},

		&cli.IntFlag{
			EnvVars: []string{"VELA_PAGE", "DEPLOYMENT_PAGE"},
			Name:    internal.FlagPage,
			Aliases: []string{"p"},
			Usage:   "print a specific page of deployments",
			Value:   1,
		},
		&cli.IntFlag{
			EnvVars: []string{"VELA_PER_PAGE", "DEPLOYMENT_PER_PAGE"},
			Name:    internal.FlagPerPage,
			Aliases: []string{"pp"},
			Usage:   "number of deployments to print per page",
			Value:   10,
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Get deployments for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo
  2. Get deployments for a repository with wide view output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output wide
  3. Get deployments for a repository with yaml output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output yaml
  4. Get deployments for a repository with json output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output json
  5. Get deployments for a repository when config or environment variables are set.
    $ {{.HelpName}}

DOCUMENTATION:

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

CommandGet defines the command for capturing a list of deployments.

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

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "DEPLOYMENT_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the deployment",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "DEPLOYMENT_REPO"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the deployment",
		},

		&cli.IntFlag{
			EnvVars: []string{"VELA_DEPLOYMENT", "DEPLOYMENT_NUMBER"},
			Name:    "deployment",
			Aliases: []string{"d", "number", "dn"},
			Usage:   "provide the number for the deployment",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "DEPLOYMENT_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 deployment details for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --deployment 1
  2. View deployment details for a repository with json output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --deployment 1 --output json
  3. View deployment details for a repository config or environment variables are set.
    $ {{.HelpName}} --deployment 1

DOCUMENTATION:

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

CommandView defines the command for inspecting a deployment.

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