build

package
v0.26.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package build provides the defined build CLI commands for Vela.

Usage:

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

Index

Constants

This section is empty.

Variables

View Source
var CommandApprove = &cli.Command{
	Name:        internal.FlagBuild,
	Description: "Use this command to Approve a build.",
	Usage:       "Approve the provided build",
	Action:      approve,
	Flags: []cli.Flag{

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

		&cli.IntFlag{
			EnvVars: []string{"VELA_BUILD", "BUILD_NUMBER"},
			Name:    internal.FlagBuild,
			Aliases: []string{"b", "number", "bn"},
			Usage:   "provide the number for the build",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Approve existing build for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --build 1
  2. Approve existing build for a repository when config or environment variables are set.
    $ {{.HelpName}} --build 1

DOCUMENTATION:

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

CommandApprove defines the command for Approveing a build.

View Source
var CommandCancel = &cli.Command{
	Name:        internal.FlagBuild,
	Description: "Use this command to cancel a build.",
	Usage:       "Cancel the provided build",
	Action:      cancel,
	Flags: []cli.Flag{

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

		&cli.IntFlag{
			EnvVars: []string{"VELA_BUILD", "BUILD_NUMBER"},
			Name:    internal.FlagBuild,
			Aliases: []string{"b", "number", "bn"},
			Usage:   "provide the number for the build",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "BUILD_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew or yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Cancel existing build for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --build 1
  2. Cancel existing build for a repository when config or environment variables are set.
    $ {{.HelpName}} --build 1

DOCUMENTATION:

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

CommandCancel defines the command for canceling a build.

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

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "BUILD_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the build",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "BUILD_REPO"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the build",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_EVENT", "BUILD_EVENT"},
			Name:    "event",
			Aliases: []string{"e"},
			Usage:   "provide the event filter for the build",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_STATUS", "BUILD_STATUS"},
			Name:    "status",
			Aliases: []string{"s"},
			Usage:   "provide the status filter for the build",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_BRANCH", "BUILD_BRANCH"},
			Name:    "branch",
			Aliases: []string{"b"},
			Usage:   "provide the branch filter for the build",
		},

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

		&cli.Int64Flag{
			EnvVars: []string{"VELA_BEFORE", "BUILD_BEFORE"},
			Name:    internal.FlagBefore,
			Aliases: []string{"bf"},
			Usage:   "before time constraint",
		},
		&cli.Int64Flag{
			EnvVars: []string{"VELA_AFTER", "BUILD_AFTER"},
			Name:    internal.FlagAfter,
			Aliases: []string{"af"},
			Usage:   "after time constraint",
		},

		&cli.IntFlag{
			EnvVars: []string{"VELA_PAGE", "BUILD_PAGE"},
			Name:    internal.FlagPage,
			Aliases: []string{"p"},
			Usage:   "print a specific page of builds",
			Value:   1,
		},
		&cli.IntFlag{
			EnvVars: []string{"VELA_PER_PAGE", "BUILD_PER_PAGE"},
			Name:    internal.FlagPerPage,
			Aliases: []string{"pp"},
			Usage:   "number of builds to print per page",
			Value:   10,
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Get builds for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo
  2. Get builds for a repository with the pull_request event.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --event pull_request
  3. Get builds for a repository with the status of success.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --status success
  4. Get builds for a repository with the branch of main.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --branch main
  5. Get builds for a repository with wide view output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output wide
  6. Get builds for a repository with yaml output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output yaml
  7. Get builds for a repository with json output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output json
  8. Get builds for a repository when config or environment variables are set.
    $ {{.HelpName}}
  9. Get builds for a repository that were created before 1/2/22 & after 1/1/22.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --before 1641081600 --after 1640995200

DOCUMENTATION:

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

CommandGet defines the command for capturing a list of builds.

View Source
var CommandRestart = &cli.Command{
	Name:        internal.FlagBuild,
	Description: "Use this command to restart a build.",
	Usage:       "Restart the provided build",
	Action:      restart,
	Flags: []cli.Flag{

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

		&cli.IntFlag{
			EnvVars: []string{"VELA_BUILD", "BUILD_NUMBER"},
			Name:    internal.FlagBuild,
			Aliases: []string{"b", "number", "bn"},
			Usage:   "provide the number for the build",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_OUTPUT", "BUILD_OUTPUT"},
			Name:    internal.FlagOutput,
			Aliases: []string{"op"},
			Usage:   "format the output in json, spew or yaml",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Restart existing build for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --build 1
  2. Restart existing build for a repository when config or environment variables are set.
    $ {{.HelpName}} --build 1

DOCUMENTATION:

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

CommandRestart defines the command for restarting a build.

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

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

		&cli.IntFlag{
			EnvVars: []string{"VELA_BUILD", "BUILD_NUMBER"},
			Name:    internal.FlagBuild,
			Aliases: []string{"b", "number", "bn"},
			Usage:   "provide the number for the build",
		},

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

DOCUMENTATION:

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

CommandView defines the command for inspecting a build.

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