diff --git a/command/pipeline/validate.go b/command/pipeline/validate.go index aea6d949..ca3cf074 100644 --- a/command/pipeline/validate.go +++ b/command/pipeline/validate.go @@ -28,138 +28,159 @@ var CommandValidate = &cli.Command{ // Repo Flags &cli.StringFlag{ - EnvVars: []string{"VELA_ORG", "REPO_ORG"}, - Name: internal.FlagOrg, - Aliases: []string{"o"}, - Usage: "provide the organization for the pipeline", + EnvVars: []string{"VELA_ORG", "REPO_ORG"}, + Name: internal.FlagOrg, + Aliases: []string{"o"}, + Usage: "provide the organization for the pipeline", + Category: "1. Repo:", }, &cli.StringFlag{ - EnvVars: []string{"VELA_REPO", "REPO_NAME"}, - Name: internal.FlagRepo, - Aliases: []string{"r"}, - Usage: "provide the repository for the pipeline", + EnvVars: []string{"VELA_REPO", "REPO_NAME"}, + Name: internal.FlagRepo, + Aliases: []string{"r"}, + Usage: "provide the repository for the pipeline", + Category: "1. Repo:", }, &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, + 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, + Category: "1. Repo:", }, // Pipeline Flags &cli.StringFlag{ - EnvVars: []string{"VELA_FILE", "PIPELINE_FILE"}, - Name: "file", - Aliases: []string{"f"}, - Usage: "provide the file name for the pipeline", - Value: ".vela.yml", + EnvVars: []string{"VELA_FILE", "PIPELINE_FILE"}, + Name: "file", + Aliases: []string{"f"}, + Usage: "provide the file name for the pipeline", + Value: ".vela.yml", + Category: "2. Pipeline:", }, &cli.StringFlag{ - EnvVars: []string{"VELA_PATH", "PIPELINE_PATH"}, - Name: "path", - Aliases: []string{"p"}, - Usage: "provide the path to the file for the pipeline", + EnvVars: []string{"VELA_PATH", "PIPELINE_PATH"}, + Name: "path", + Aliases: []string{"p"}, + Usage: "provide the path to the file for the pipeline", + Category: "2. Pipeline:", }, &cli.StringFlag{ - EnvVars: []string{"VELA_REF", "PIPELINE_REF"}, - Name: "ref", - Usage: "provide the repository reference for the pipeline", - Value: "main", + EnvVars: []string{"VELA_REF", "PIPELINE_REF"}, + Name: "ref", + Usage: "provide the repository reference for the pipeline", + Value: "main", + Category: "2. Pipeline:", }, &cli.BoolFlag{ - EnvVars: []string{"VELA_TEMPLATE", "PIPELINE_TEMPLATE"}, - Name: "template", - Usage: "DEPRECATED (Vela CLI will attempt to fetch templates if they exist)", + EnvVars: []string{"VELA_TEMPLATE", "PIPELINE_TEMPLATE"}, + Name: "template", + Usage: "DEPRECATED (Vela CLI will attempt to fetch templates if they exist)", + Category: "2. Pipeline:", }, &cli.StringSliceFlag{ - EnvVars: []string{"VELA_TEMPLATE_FILE", "PIPELINE_TEMPLATE_FILE"}, - Name: "template-file", - Usage: "enables using a local template file for expansion", + EnvVars: []string{"VELA_TEMPLATE_FILE", "PIPELINE_TEMPLATE_FILE"}, + Name: "template-file", + Usage: "enables using a local template file for expansion", + Category: "2. Pipeline:", }, &cli.IntFlag{ - EnvVars: []string{"VELA_MAX_TEMPLATE_DEPTH", "MAX_TEMPLATE_DEPTH"}, - Name: "max-template-depth", - Usage: "set the maximum depth for nested templates", - Value: 3, + EnvVars: []string{"VELA_MAX_TEMPLATE_DEPTH", "MAX_TEMPLATE_DEPTH"}, + Name: "max-template-depth", + Usage: "set the maximum depth for nested templates", + Value: 3, + Category: "2. Pipeline:", }, &cli.Uint64Flag{ - EnvVars: []string{"VELA_COMPILER_STARLARK_EXEC_LIMIT", "COMPILER_STARLARK_EXEC_LIMIT"}, - Name: "compiler-starlark-exec-limit", - Aliases: []string{"starlark-exec-limit", "sel"}, - Usage: "set the starlark execution step limit for compiling starlark pipelines", - Value: 7500, + EnvVars: []string{"VELA_COMPILER_STARLARK_EXEC_LIMIT", "COMPILER_STARLARK_EXEC_LIMIT"}, + Name: "compiler-starlark-exec-limit", + Aliases: []string{"starlark-exec-limit", "sel"}, + Usage: "set the starlark execution step limit for compiling starlark pipelines", + Value: 7500, + Category: "2. Pipeline:", }, &cli.BoolFlag{ - EnvVars: []string{"VELA_REMOTE", "PIPELINE_REMOTE"}, - Name: "remote", - Usage: "enables validating a pipeline on a remote server", - Value: false, + EnvVars: []string{"VELA_REMOTE", "PIPELINE_REMOTE"}, + Name: "remote", + Usage: "enables validating a pipeline on a remote server", + Value: false, + Category: "2. Pipeline:", }, // RuleData Flags &cli.StringFlag{ - EnvVars: []string{"VELA_BRANCH", "PIPELINE_BRANCH", "VELA_BUILD_BRANCH"}, - Name: "branch", - Aliases: []string{"b"}, - Usage: "provide the build branch for the pipeline", + EnvVars: []string{"VELA_BRANCH", "PIPELINE_BRANCH", "VELA_BUILD_BRANCH"}, + Name: "branch", + Aliases: []string{"b"}, + Usage: "provide the build branch for the pipeline", + Category: "3. Ruleset:", }, &cli.StringFlag{ - EnvVars: []string{"VELA_COMMENT", "PIPELINE_COMMENT", "VELA_BUILD_COMMENT"}, - Name: "comment", - Aliases: []string{"c"}, - Usage: "provide the build comment for the pipeline", + EnvVars: []string{"VELA_COMMENT", "PIPELINE_COMMENT", "VELA_BUILD_COMMENT"}, + Name: "comment", + Aliases: []string{"c"}, + Usage: "provide the build comment for the pipeline", + Category: "3. Ruleset:", }, &cli.StringFlag{ - EnvVars: []string{"VELA_EVENT", "PIPELINE_EVENT", "VELA_BUILD_EVENT"}, - Name: "event", - Aliases: []string{"e"}, - Usage: "provide the build event for the pipeline", + EnvVars: []string{"VELA_EVENT", "PIPELINE_EVENT", "VELA_BUILD_EVENT"}, + Name: "event", + Aliases: []string{"e"}, + Usage: "provide the build event for the pipeline", + Category: "3. Ruleset:", }, &cli.StringFlag{ - EnvVars: []string{"VELA_STATUS", "PIPELINE_STATUS", "VELA_BUILD_STATUS"}, - Name: "status", - Usage: "provide the expected build status for the local validation", - Value: "success", + EnvVars: []string{"VELA_STATUS", "PIPELINE_STATUS", "VELA_BUILD_STATUS"}, + Name: "status", + Usage: "provide the expected build status for the local validation", + Value: "success", + Category: "3. Ruleset:", }, &cli.StringFlag{ - EnvVars: []string{"VELA_TAG", "PIPELINE_TAG", "VELA_BUILD_TAG"}, - Name: "tag", - Usage: "provide the build tag for the pipeline", + EnvVars: []string{"VELA_TAG", "PIPELINE_TAG", "VELA_BUILD_TAG"}, + Name: "tag", + Usage: "provide the build tag for the pipeline", + Category: "3. Ruleset:", }, &cli.StringFlag{ - EnvVars: []string{"VELA_TARGET", "PIPELINE_TARGET", "VELA_BUILD_TARGET"}, - Name: "target", - Usage: "provide the build target for the pipeline", + EnvVars: []string{"VELA_TARGET", "PIPELINE_TARGET", "VELA_BUILD_TARGET"}, + Name: "target", + Usage: "provide the build target for the pipeline", + Category: "3. Ruleset:", }, &cli.StringSliceFlag{ - EnvVars: []string{"VELA_FILE_CHANGESET", "FILE_CHANGESET"}, - Name: "file-changeset", - Aliases: []string{"fcs"}, - Usage: "provide a list of files changed for ruleset matching", + EnvVars: []string{"VELA_FILE_CHANGESET", "FILE_CHANGESET"}, + Name: "file-changeset", + Aliases: []string{"fcs"}, + Usage: "provide a list of files changed for ruleset matching", + Category: "3. Ruleset:", }, // Compiler Flags &cli.StringFlag{ - EnvVars: []string{"VELA_COMPILER_GITHUB_TOKEN", "COMPILER_GITHUB_TOKEN"}, - Name: internal.FlagCompilerGitHubToken, - Aliases: []string{"ct"}, - Usage: "github compiler token", + EnvVars: []string{"VELA_COMPILER_GITHUB_TOKEN", "COMPILER_GITHUB_TOKEN"}, + Name: internal.FlagCompilerGitHubToken, + Aliases: []string{"ct"}, + Usage: "github compiler token", + Category: "4. Compiler:", }, &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", + 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", + Category: "4. Compiler:", }, &cli.StringFlag{ EnvVars: []string{"VELA_CLONE_IMAGE", "COMPILER_CLONE_IMAGE"}, Name: "clone-image", Usage: "the clone image to use for the injected clone step", // renovate: image=target/vela-git - Value: "target/vela-git:v0.8.0@sha256:02de004ae9dbf184c70039cb9ce431c31d6e7580eb9e6ec64a97ebf108aa65cb", + Value: "target/vela-git:v0.8.0@sha256:02de004ae9dbf184c70039cb9ce431c31d6e7580eb9e6ec64a97ebf108aa65cb", + Category: "4. Compiler:", }, }, CustomHelpTemplate: fmt.Sprintf(`%s @@ -176,9 +197,11 @@ EXAMPLES: $ {{.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}} --compiler.github.token --compiler.github.url - 7. Validate a local template pipeline with expanding steps + 7. Validate a pipeline with ruleset data + $ {{.HelpName}} --branch dev --event push + 8. Validate a local template pipeline with expanding steps $ {{.HelpName}} --template-file name:/path/to/file - 8. Validate a local, nested template pipeline with custom template depth. + 9. Validate a local, nested template pipeline with custom template depth. $ {{.HelpName}} --template-file name:/path/to/file name:/path/to/file --max-template-depth 2 DOCUMENTATION: