Help us shape the future of Go! Take the 2026 Go Developer Survey

build

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 8 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{
			Sources: cli.EnvVars("VELA_ORG", "BUILD_ORG"),
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the build",
		},
		&cli.StringFlag{
			Sources: cli.EnvVars("VELA_REPO", "BUILD_REPO"),
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the build",
		},

		&cli.Int64Flag{
			Sources: cli.EnvVars("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.
    $ {{.FullName}} --org MyOrg --repo MyRepo --build 1
  2. Approve existing build for a repository when config or environment variables are set.
    $ {{.FullName}} --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{
			Sources: cli.EnvVars("VELA_ORG", "BUILD_ORG"),
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the build",
		},
		&cli.StringFlag{
			Sources: cli.EnvVars("VELA_REPO", "BUILD_REPO"),
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the build",
		},

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

		&cli.StringFlag{
			Sources: cli.EnvVars("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.
    $ {{.FullName}} --org MyOrg --repo MyRepo --build 1
  2. Cancel existing build for a repository when config or environment variables are set.
    $ {{.FullName}} --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{
			Sources: cli.EnvVars("VELA_ORG", "BUILD_ORG"),
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the build",
		},
		&cli.StringFlag{
			Sources: cli.EnvVars("VELA_REPO", "BUILD_REPO"),
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the build",
		},
		&cli.StringFlag{
			Sources: cli.EnvVars("VELA_EVENT", "BUILD_EVENT"),
			Name:    "event",
			Aliases: []string{"e"},
			Usage:   "provide the event filter for the build",
		},
		&cli.StringFlag{
			Sources: cli.EnvVars("VELA_STATUS", "BUILD_STATUS"),
			Name:    "status",
			Aliases: []string{"s"},
			Usage:   "provide the status filter for the build",
		},
		&cli.StringFlag{
			Sources: cli.EnvVars("VELA_BRANCH", "BUILD_BRANCH"),
			Name:    "branch",
			Aliases: []string{"b"},
			Usage:   "provide the branch filter for the build",
		},

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

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

		&cli.IntFlag{
			Sources: cli.EnvVars("VELA_PAGE", "BUILD_PAGE"),
			Name:    internal.FlagPage,
			Aliases: []string{"p"},
			Usage:   "print a specific page of builds",
			Value:   1,
		},
		&cli.IntFlag{
			Sources: cli.EnvVars("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.
    $ {{.FullName}} --org MyOrg --repo MyRepo
  2. Get builds for a repository with the pull_request event.
    $ {{.FullName}} --org MyOrg --repo MyRepo --event pull_request
  3. Get builds for a repository with the status of success.
    $ {{.FullName}} --org MyOrg --repo MyRepo --status success
  4. Get builds for a repository with the branch of main.
    $ {{.FullName}} --org MyOrg --repo MyRepo --branch main
  5. Get builds for a repository with wide view output.
    $ {{.FullName}} --org MyOrg --repo MyRepo --output wide
  6. Get builds for a repository with yaml output.
    $ {{.FullName}} --org MyOrg --repo MyRepo --output yaml
  7. Get builds for a repository with json output.
    $ {{.FullName}} --org MyOrg --repo MyRepo --output json
  8. Get builds for a repository when config or environment variables are set.
    $ {{.FullName}}
  9. Get builds for a repository that were created before 1/2/22 & after 1/1/22.
    $ {{.FullName}} --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{
			Sources: cli.EnvVars("VELA_ORG", "BUILD_ORG"),
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the build",
		},
		&cli.StringFlag{
			Sources: cli.EnvVars("VELA_REPO", "BUILD_REPO"),
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the build",
		},

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

		&cli.StringFlag{
			Sources: cli.EnvVars("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.
    $ {{.FullName}} --org MyOrg --repo MyRepo --build 1
  2. Restart existing build for a repository when config or environment variables are set.
    $ {{.FullName}} --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{
			Sources: cli.EnvVars("VELA_ORG", "BUILD_ORG"),
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the build",
		},
		&cli.StringFlag{
			Sources: cli.EnvVars("VELA_REPO", "BUILD_REPO"),
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the build",
		},

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

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