pipeline

package
v0.12.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

nolint: dupl // ignore similar code with expand and view

Package pipeline provides the defined pipeline CLI commands for Vela.

Usage:

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

nolint: dupl // ignore similar code with compile and view

nolint: dupl // ignore similar code with compile and expand

Index

Constants

This section is empty.

Variables

View Source
var CommandCompile = &cli.Command{
	Name:        "pipeline",
	Description: "Use this command to compile a pipeline.",
	Usage:       "Compile the provided pipeline",
	Action:      compile,
	Flags: []cli.Flag{

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

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

		&cli.StringFlag{
			EnvVars: []string{"VELA_REF", "PIPELINE_REF"},
			Name:    "ref",
			Usage:   "provide the repository reference for the pipeline",
			Value:   "master",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Compile a pipeline for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo
  2. Compile a pipeline for a repository with json output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output json
  3. Compile a pipeline for a repository when config or environment variables are set.
    $ {{.HelpName}}

DOCUMENTATION:

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

CommandCompile defines the command for compiling a pipeline.

View Source
var CommandExec = &cli.Command{
	Name:        "pipeline",
	Description: "Use this command to execute a pipeline.",
	Usage:       "Execute the provided pipeline",
	Action:      exec,
	Flags: []cli.Flag{

		&cli.StringFlag{
			EnvVars: []string{"VELA_BRANCH", "PIPELINE_BRANCH"},
			Name:    "branch",
			Aliases: []string{"b"},
			Usage:   "provide the build branch for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_COMMENT", "PIPELINE_COMMENT"},
			Name:    "comment",
			Aliases: []string{"c"},
			Usage:   "provide the build comment for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_EVENT", "PIPELINE_EVENT"},
			Name:    "event",
			Aliases: []string{"e"},
			Usage:   "provide the build event for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_TAG", "PIPELINE_TAG"},
			Name:    "tag",
			Aliases: []string{"t"},
			Usage:   "provide the build tag for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_TARGET", "PIPELINE_TARGET"},
			Name:    "target",
			Usage:   "provide the build target for the pipeline",
		},

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

		&cli.StringFlag{
			EnvVars: []string{"VELA_FILE", "PIPELINE_FILE"},
			Name:    "file",
			Aliases: []string{"f"},
			Usage:   "provide the file name for the pipeline",
			Value:   ".vela.yml",
		},
		&cli.BoolFlag{
			EnvVars: []string{"VELA_LOCAL", "PIPELINE_LOCAL"},
			Name:    "local",
			Aliases: []string{"l"},
			Usage:   "enables mounting local directory to pipeline",
			Value:   true,
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PATH", "PIPELINE_PATH"},
			Name:    "path",
			Aliases: []string{"p"},
			Usage:   "provide the path to the file for the pipeline",
		},
		&cli.StringSliceFlag{
			EnvVars: []string{"VELA_VOLUMES", "PIPELINE_VOLUMES"},
			Name:    "volume",
			Aliases: []string{"v"},
			Usage:   "provide list of local volumes to mount",
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "PIPELINE_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "PIPELINE_REPO"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PIPELINE_TYPE", "PIPELINE_TYPE"},
			Name:    "pipeline-type",
			Aliases: []string{"pt"},
			Usage:   "type of pipeline for the compiler to render",
			Value:   constants.PipelineTypeYAML,
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Execute a local Vela pipeline.
    $ {{.HelpName}}
  2. Execute a local Vela pipeline in a nested directory.
    $ {{.HelpName}} --path nested/path/to/dir --file .vela.local.yml
  3. Execute a local Vela pipeline in a specific directory.
    $ {{.HelpName}} --path /absolute/full/path/to/dir --file .vela.local.yml
  4. Execute a local Vela pipeline with ruleset information.
    $ {{.HelpName}} --branch master --event push
  5. Execute a local Vela pipeline with a read-only local volume.
    $ {{.HelpName}} --volume /tmp/foo.txt:/tmp/foo.txt:ro
  6. Execute a local Vela pipeline with a writeable local volume.
    $ {{.HelpName}} --volume /tmp/bar.txt:/tmp/bar.txt:rw
  7. Execute a local Vela pipeline with type of go
    $ {{.HelpName}} --pipeline-type go

DOCUMENTATION:

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

CommandExec defines the command for executing a pipeline.

View Source
var CommandExpand = &cli.Command{
	Name:        "pipeline",
	Description: "Use this command to expand a pipeline.",
	Usage:       "Expand the provided pipeline",
	Action:      expand,
	Flags: []cli.Flag{

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

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

		&cli.StringFlag{
			EnvVars: []string{"VELA_REF", "PIPELINE_REF"},
			Name:    "ref",
			Usage:   "provide the repository reference for the pipeline",
			Value:   "master",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Expand a pipeline for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo
  2. Expand a pipeline for a repository with json output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo --output json
  3. Expand a pipeline for a repository when config or environment variables are set.
    $ {{.HelpName}}

DOCUMENTATION:

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

CommandExpand defines the command for expanding a pipeline.

View Source
var CommandGenerate = &cli.Command{
	Name:        "pipeline",
	Description: "Use this command to generate a pipeline.",
	Usage:       "Generate a valid Vela pipeline",
	Action:      generate,
	Flags: []cli.Flag{

		&cli.StringFlag{
			EnvVars: []string{"VELA_FILE", "PIPELINE_FILE"},
			Name:    "file",
			Aliases: []string{"f"},
			Usage:   "provide the file name for the pipeline",
			Value:   ".vela.yml",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PATH", "PIPELINE_PATH"},
			Name:    "path",
			Aliases: []string{"p"},
			Usage:   "provide the path to the file for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_STAGES", "PIPELINE_STAGES"},
			Name:    "stages",
			Aliases: []string{"s"},
			Usage:   "enable generating the pipeline with stages",
			Value:   "false",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_TYPE", "PIPELINE_TYPE"},
			Name:    "type",
			Aliases: []string{"t"},
			Usage:   "provide the type of pipeline being generated",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Generate a Vela pipeline.
    $ {{.HelpName}}
  2. Generate a Vela pipeline in a nested directory.
    $ {{.HelpName}} --path nested/path/to/dir
  3. Generate a Vela pipeline in a specific directory.
    $ {{.HelpName}} --path /absolute/full/path/to/dir
  4. Generate a Vela pipeline with stages.
    $ {{.HelpName}} --stages true
  5. Generate a go Vela pipeline.
    $ {{.HelpName}} --secret.type go
  6. Generate a java Vela pipeline.
    $ {{.HelpName}} --secret.type java
  7. Generate a node Vela pipeline.
    $ {{.HelpName}} --secret.type node

DOCUMENTATION:

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

CommandGenerate defines the command for producing a pipeline.

View Source
var CommandValidate = &cli.Command{
	Name:        "pipeline",
	Description: "Use this command to validate a pipeline.",
	Usage:       "Validate a Vela pipeline",
	Action:      validate,
	Flags: []cli.Flag{

		&cli.StringFlag{
			EnvVars: []string{"VELA_ORG", "REPO_ORG"},
			Name:    internal.FlagOrg,
			Aliases: []string{"o"},
			Usage:   "provide the organization for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REPO", "REPO_NAME"},
			Name:    internal.FlagRepo,
			Aliases: []string{"r"},
			Usage:   "provide the repository for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PIPELINE_TYPE", "PIPELINE_TYPE"},
			Name:    "pipeline-type",
			Aliases: []string{"pt"},
			Usage:   "type of pipeline for the compiler to render",
			Value:   constants.PipelineTypeYAML,
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_FILE", "PIPELINE_FILE"},
			Name:    "file",
			Aliases: []string{"f"},
			Usage:   "provide the file name for the pipeline",
			Value:   ".vela.yml",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_PATH", "PIPELINE_PATH"},
			Name:    "path",
			Aliases: []string{"p"},
			Usage:   "provide the path to the file for the pipeline",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_REF", "PIPELINE_REF"},
			Name:    "ref",
			Usage:   "provide the repository reference for the pipeline",
			Value:   "master",
		},
		&cli.BoolFlag{
			EnvVars: []string{"VELA_TEMPLATE", "PIPELINE_TEMPLATE"},
			Name:    "template",
			Usage:   "enables validating a pipeline with templates",
			Value:   false,
		},
		&cli.StringSliceFlag{
			EnvVars: []string{"VELA_TEMPLATE_FILE", "PIPELINE_TEMPLATE_FILE"},
			Name:    "template-file",
			Usage:   "enables using a local template file for expansion",
		},
		&cli.BoolFlag{
			EnvVars: []string{"VELA_REMOTE", "PIPELINE_REMOTE"},
			Name:    "remote",
			Usage:   "enables validating a pipeline on a remote server",
			Value:   false,
		},

		&cli.StringFlag{
			EnvVars: []string{"VELA_COMPILER_GITHUB_TOKEN", "COMPILER_GITHUB_TOKEN"},
			Name:    internal.FlagCompilerGitHubToken,
			Aliases: []string{"ct"},
			Usage:   "github compiler token",
		},
		&cli.StringFlag{
			EnvVars: []string{"VELA_COMPILER_GITHUB_URL", "COMPILER_GITHUB_URL"},
			Name:    internal.FlagCompilerGitHubURL,
			Aliases: []string{"cgu"},
			Usage:   "github url, used by compiler, for pulling registry templates",
		},
	},

	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. Validate a local Vela pipeline.
    $ {{.HelpName}}
  2. Validate a local Vela pipeline in a nested directory.
    $ {{.HelpName}} --path nested/path/to/dir
  3. Validate a local Vela pipeline in a specific directory.
    $ {{.HelpName}} --path /absolute/full/path/to/dir
  4. Validate a remote pipeline for a repository.
    $ {{.HelpName}} --remote --org MyOrg --repo MyRepo
  5. Validate a remote pipeline for a repository with json output.
    $ {{.HelpName}} --remote --org MyOrg --repo MyRepo --output json
  6. Validate a template pipeline with expanding steps (when templates are sourced from private Github instance)
    $ {{.HelpName}} --template --compiler.github.token <token> --compiler.github.url <url>
  7. Validate a template pipeline with expanding steps
    $ {{.HelpName}} --template
  8. Validate a local template pipeline with expanding steps
    $ {{.HelpName}} --template --template-file name:/path/to/file
DOCUMENTATION:

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

CommandValidate defines the command for verifying a pipeline.

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

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

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

		&cli.StringFlag{
			EnvVars: []string{"VELA_REF", "PIPELINE_REF"},
			Name:    "ref",
			Usage:   "provide the repository reference for the pipeline",
			Value:   "master",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
  1. View details of a pipeline for a repository.
    $ {{.HelpName}} --org MyOrg --repo MyRepo
  2. View details of a pipeline for a repository with json output.
    $ {{.HelpName}} --org MyOrg --repo MyRepo
  3. View details of a pipeline for a repository when config or environment variables are set.
    $ {{.HelpName}}

DOCUMENTATION:

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

CommandView defines the command for inspecting a pipeline.

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