cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BUILD = command.Command{
	Name:      "build",
	ShortHelp: "Create an pipeline and run it",
	Example:   `$ dice build`,
	Flags: []command.Flag{
		command.StringFlag{Short: "b", Name: "branch", Doc: "branch to create pipeline, default is current branch", DefaultValue: ""},
	},
	Run: RunBuild,
}

BUILD command

View Source
var CHECK = command.Command{
	Name:      "check",
	ShortHelp: "Validate dice.yml file",
	Example: `
  $ dice check -f dice.yml
`,
	Flags: []command.Flag{
		command.StringFlag{Short: "f", Name: "file",
			Doc: "Specify the path of dice.yml file, default: .dice/dice.yml", DefaultValue: ""},
	},
	Run:    RunCheck,
	Hidden: true,
}

CHECK command

View Source
var EXT = command.Command{
	Name:      "ext",
	ShortHelp: "Extensions operation sets,including search, pull, push, retag",
	Example:   `dice ext`,
	Flags: []command.Flag{
		command.BoolFlag{Short: "a", Name: "all", Doc: "query all extensions", DefaultValue: false},
	},
	Run: RunExtensions,
}
View Source
var EXTENSIONSPULL = command.Command{
	Name:       "pull",
	ParentName: "EXT",
	ShortHelp:  "pull extension",
	Example: `
  $ dice ext pull git-checkout@1.0 -o git-checkout
`,
	Args: []command.Arg{
		command.StringArg{}.Name("extension"),
	},
	Flags: []command.Flag{
		command.StringFlag{Short: "o", Name: "output", Doc: "which directory to export to", DefaultValue: ""},
	},
	Run: RunExtensionsPull,
}
View Source
var EXTENSIONSPUSH = command.Command{
	Name:       "push",
	ParentName: "EXT",
	ShortHelp:  "push extension",
	Example: `
  $ dice ext push -f --public
`,
	Flags: []command.Flag{
		command.BoolFlag{Short: "f", Name: "force", Doc: "override exist version", DefaultValue: false},
		command.BoolFlag{Short: "a", Name: "all", Doc: "override exist extension and version,must with -f", DefaultValue: false},
		command.StringFlag{Short: "d", Name: "dir", Doc: "extension dir", DefaultValue: ""},
		command.StringFlag{Short: "r", Name: "registry", Doc: "new registry", DefaultValue: ""},
	},
	Run: RunExtensionsPush,
}
View Source
var EXTENSIONSRETAG = command.Command{
	Name:       "retag",
	ParentName: "EXT",
	ShortHelp:  "generate retag script",
	Example: `
  $ dice ext retag -d extensions -r registry.default.svc.cluster.local:5000 -o retag.sh
`,
	Flags: []command.Flag{
		command.StringFlag{Short: "d", Name: "dir", Doc: "extension dir", DefaultValue: "."},
		command.StringFlag{Short: "r", Name: "registry", Doc: "new registry", DefaultValue: "registry.default.svc.cluster.local:5000"},
		command.StringFlag{Short: "o", Name: "output", Doc: "output script file", DefaultValue: "retag.sh"},
	},
	Run: RunExtensionsReTag,
}
View Source
var INIT = Command{
	Name:      "init",
	ShortHelp: "Init a dice.yml template",
	LongHelp:  "Make a .dice dir in current directory, then create a dice.yml template",
	Example: `
  $ dice init
`,
	Run:    RunInit,
	Hidden: true,
}
View Source
var MigrationLint = command.Command{
	ParentName:     "",
	Name:           "miglint",
	ShortHelp:      "Erda MySQL Migration lint",
	LongHelp:       "Erda MySQL Migration lint",
	Example:        "erda-cli miglint --input=. config=default.yaml --detail",
	Hidden:         false,
	DontHideCursor: false,
	Args:           nil,
	Flags: []command.Flag{
		command.StringFlag{
			Short:        "f",
			Name:         "filename",
			Doc:          "[optional] the file or directory for linting",
			DefaultValue: ".",
		},
		command.StringFlag{
			Short:        "c",
			Name:         "config",
			Doc:          "[optional] the lint config file",
			DefaultValue: "",
		},
		command.BoolFlag{
			Short:        "d",
			Name:         "detail",
			Doc:          "[optional] print details of lint result",
			DefaultValue: true,
		},
		command.StringFlag{
			Short:        "o",
			Name:         "output",
			Doc:          "[optional] result output file name",
			DefaultValue: "",
		},
		command.BoolFlag{
			Short:        "i",
			Name:         "ignoreBase",
			Doc:          "ignore script which marked baseline",
			DefaultValue: true,
		},
	},
	Run: RunMigrationLint,
}
View Source
var PARSE = Command{
	Name:      "parse",
	ShortHelp: "Parse the dice.yml file",
	Flags: []Flag{
		StringFlag{"f", "file",
			"Specify the path of dice.yml file, default: .dice/dice.yml", ""},
		StringFlag{"s", "str", "Provide the content of dice.yml file as a string", ""},
		BoolFlag{"", "dev", "Parse the dice.yml file in development environment ", false},
		BoolFlag{"", "test", "Parse the dice.yml file in test environment", false},
		BoolFlag{"", "staging", "Parse the dice.yml file in staging environment", false},
		BoolFlag{"", "prod", "Parse the dice.yml in production environment", false},
		BoolFlag{"o", "output", "Output the content as yaml", false},
	},
	Run:    RunParse,
	Hidden: true,
}
View Source
var STATUS = command.Command{
	Name:      "status",
	ShortHelp: "Show build status",
	Example: `
  $ dice status -b develop
`,
	Flags: []command.Flag{
		command.StringFlag{Short: "b", Name: "branch", Doc: "specify branch to show pipeline status, default is current branch", DefaultValue: ""},
		command.IntFlag{Short: "i", Name: "pipelineID", Doc: "specify pipeline id to show pipeline status", DefaultValue: 0},
	},
	Run: RunPipelineStatus,
}
View Source
var VERSION = Command{
	Name:      "version",
	ShortHelp: "Show dice version info",
	Example:   `$ dice version`,
	Run:       RunVersion,
}

Functions

func BuildCheckLoop

func BuildCheckLoop(ctx *command.Context, buildID string) error

BuildCheckLoop checks build status in a loop while interactive is true

func PrintWorkFlow

func PrintWorkFlow(ctx *command.Context, buildID string) error

PrintWorkFlow prints build work flow in diagram format

func RunBuild

func RunBuild(ctx *command.Context, branch string) error

RunBuild Create an pipeline and run it

func RunCheck

func RunCheck(ctx *command.Context, ymlPath string) error

RunCheck validates dice.yml file

func RunExtensions

func RunExtensions(ctx *command.Context, all bool) error

func RunExtensionsPull

func RunExtensionsPull(ctx *command.Context, extension string, dir string) error

func RunExtensionsPush

func RunExtensionsPush(ctx *command.Context, force bool, all bool, dir, registry string) error

func RunExtensionsReTag

func RunExtensionsReTag(ctx *command.Context, dir string, registry string, output string) error

func RunInit

func RunInit(ctx *Context) error

func RunMigrationLint

func RunMigrationLint(ctx *command.Context, input, config string, detail bool, output string, ignoreBase bool) error

func RunParse

func RunParse(ctx *Context, ymlPath string, ymlContent string, dev, test, staging, prod, outputYml bool) error

func RunPipelineStatus

func RunPipelineStatus(ctx *command.Context, branch string, pipelineID int) error

RunBuildsInspect displays detailed information on the build record

func RunVersion

func RunVersion(ctx *Context) error

Types

type DockerAuth

type DockerAuth struct {
	Auth string `json:"auth"`
}

type DockerConfig

type DockerConfig struct {
	Auths map[string]DockerAuth `json:"auths"`
}

type ExtensionInfo

type ExtensionInfo struct {
	Path    string
	Spec    apistructs.Spec
	Dice    map[string]interface{}
	DiceErr error
	SpecErr error
}

func GetExtMetas

func GetExtMetas(dir string) []ExtensionInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL