Documentation
¶
Index ¶
- Constants
- Variables
- func CommandAfter(ctx *cli.Context) error
- func CommandBefore(ctx *cli.Context) error
- func CreateEvent(op string) rkquery.Event
- func Error(err error) error
- func FileExists(filePath string) bool
- func Finish(event rkquery.Event, err error)
- func GetEvent(ctx *cli.Context) rkquery.Event
- func GetGoPathBin() string
- func NewActionChain() *actionChain
- func TryReadFile(filePath string) []byte
- func UnmarshalBootConfig(configFilePath string, config interface{}) error
- type BootConfigForBuild
- type Commit
- type Committer
- type Git
- type PkgInfo
Constants ¶
const ( // Event key in context EventKey = "rkEvent" // The folder where build result will be moved to BuildTarget = "target" )
Variables ¶
var ( // BuildConfig match yaml config of build.yaml BuildConfig = &BootConfigForBuild{} // TargetPkgName the compiled target name TargetPkgName = getPkgName() // TargetGitInfo git information while building TargetGitInfo = getGitInfo() )
Functions ¶
func CommandAfter ¶
func CommandBefore ¶
func CreateEvent ¶
func CreateEvent(op string) rkquery.Event
CreateEvent Create an event with operation name
func FileExists ¶
func TryReadFile ¶
func UnmarshalBootConfig ¶
UnmarshalBootConfig Read build.yaml and unmarshal it into config
Types ¶
type BootConfigForBuild ¶
type BootConfigForBuild struct {
Build struct {
Type string `yaml:"type"`
Main string `yaml:"main"`
GOOS string `yaml:"GOOS"`
GOARCH string `yaml:"GOARCH"`
Args []string `yaml:"args"`
Copy []string `yaml:"copy"`
Commands struct {
Before []string `yaml:"before"`
After []string `yaml:"after"`
} `yaml:"commands"`
Scripts struct {
Before []string `yaml:"before"`
After []string `yaml:"after"`
} `yaml:"scripts"`
} `yaml:"build"`
Docker struct {
Build struct {
Registry string `yaml:"registry"`
Tag string `yaml:"tag"`
Args []string `yaml:"args"`
} `yaml:"build"`
Run struct {
Args []string `yaml:"args"`
} `yaml:"run"`
} `yaml:"docker"`
}
BootConfigForBuild match yaml config of build.yaml 1: Build.Type: Required, the type of programming language 2: Build.Main: Optional, path of main.go file, default is current working directory 3: Build.GOOS: Optional, specify GOOS, default from current go env 4: Build.GOARCH: Optional, specify GOARCH, default from current go env 5: Build.Args: Optional, specify arguments while run build 6: Build.Copy: Optional, the files and folders need to copy to target folder 7: Build.Commands.Before: Optional, commands needs to run before build 8: Build.Commands.After: Optional, commands needs to run after build 9: Build.Scripts.Before: Optional, scripts needs to run before build 10: Build.Scripts.After: Optional, scripts needs to run after build 11: Docker.Build.Registry: Optional, docker registry while building docker image 12: Docker.Build.Tag: Optional, docker tag while building docker image 13: Docker.Build.Args: Optional, arguments needs to pass while building docker image 14: Docker.Build.Run.Args: Optional, arguments needs to pass to docker while running docker container
type Commit ¶
type Commit struct {
// Id of current commit
Id string `yaml:"id" json:"id"`
// Date of current commit
Date string `yaml:"date" json:"date"`
// IdAbbr is abbreviation of id of current commit
IdAbbr string `yaml:"idAbbr" json:"idAbbr"`
// Sub is subject of current commit
Sub string `yaml:"sub" json:"sub"`
// Committer of current commit
Committer *Committer `yaml:"committer" json:"committer"`
}
Commit of git from local machine
type Committer ¶
type Committer struct {
// Name of committer
Name string `yaml:"name" json:"name"`
// Email of committer
Email string `yaml:"email" json:"email"`
}
Committer info of current commit
type Git ¶
type Git struct {
// Url of git repo
Url string `yaml:"url" json:"url"`
// Branch of git repo
Branch string `yaml:"branch" json:"branch"`
// Tag of git repo
Tag string `yaml:"tag" json:"tag"`
// Commit info of git repo
Commit *Commit `yaml:"commit" json:"commit"`
}
Git metadata info on local machine