meta

package
v1.16.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ProviderGithub ...
	ProviderGithub = "github"
	// ProviderGitlab ...
	ProviderGitlab = "gitlab"

	// ProviderGerrit
	ProviderGerrit = "gerrit"

	// ProviderCodehub
	ProviderCodehub = "codehub"

	// ProviderGitee
	ProviderGitee = "gitee"

	// ProviderGiteeEE
	ProviderGiteeEE = "gitee-enterprise"

	// ProviderOther
	ProviderOther = "other"

	//	Oauth prefix
	OauthTokenPrefix = "oauth2"

	FileName = "reaper.tar.gz"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive

type Archive struct {
	Dir            string `yaml:"dir"`
	File           string `yaml:"file"`
	TestReportFile string `yaml:"test_report_file"`
}

Archive ...

type ArtifactInfo added in v1.6.0

type ArtifactInfo struct {
	URL          string `yaml:"url"`
	WorkflowName string `yaml:"workflow_name"`
	TaskID       int64  `yaml:"task_id"`
	FileName     string `yaml:"file_name"`
}

type Context

type Context struct {
	// API token 服务访问使用的api token
	APIToken string `yaml:"api_token"`
	// Workspace 容器工作目录 [必填]
	Workspace string `yaml:"workspace"`

	// TODO: Deprecated.
	// CleanWorkspace 是否清理工作目录 [选填, 默认为 false]
	CleanWorkspace bool `yaml:"clean_workspace"`

	// Paths 执行脚本Path
	Paths string `yaml:"-"`

	// Proxy 翻墙配置信息
	Proxy *Proxy `yaml:"proxy"`

	// Envs 用户注入环境变量, 包括安装脚本环境变量 [optional]
	Envs EnvVar `yaml:"envs"`

	// SecretEnvs 用户注入敏感信息环境变量, value不能在stdout stderr中输出 [optional]
	SecretEnvs EnvVar `yaml:"secret_envs"`

	// Installs 安装程序脚本 [optional]
	Installs []*Install `yaml:"installs"`

	// Repos 用户需要下载的repos
	Repos []*Repo `yaml:"repos"`

	// Scripts 执行主要编译脚本
	Scripts []string `yaml:"scripts"`

	// PostScripts 后置编译脚本
	PostScripts []string `yaml:"post_scripts"`

	// PMDeployScripts 物理机部署脚本
	PMDeployScripts []string `yaml:"pm_deploy_scripts"`

	// SSH ssh连接参数
	SSHs []*SSH `yaml:"sshs"`

	// GinkgoTest 执行 ginkgo test 配置
	GinkgoTest *GinkgoTest `yaml:"ginkgo_test"`

	// Archive: 归档配置 [optional]
	Archive *Archive `yaml:"archive"`

	// DockerRegistry: 镜像仓库配置 [optional]
	DockerRegistry *DockerRegistry `yaml:"docker_registry"`

	// DockerBuildContext image 构建context
	DockerBuildCtx *DockerBuildCtx `yaml:"docker_build_ctx"`

	// FileArchiveCtx 二进制包构建
	FileArchiveCtx *FileArchiveCtx `yaml:"file_archive_ctx"`

	// Git Github/Gitlab 配置
	Git *Git `yaml:"git"`

	// TODO: Deprecated.
	// Caches Caches配置
	Caches []string `yaml:"caches"`

	// testType
	TestType string `yaml:"test_type"`

	// Classic build
	ClassicBuild bool `yaml:"classic_build"`

	// StorageURI
	StorageURI string `yaml:"storage_uri"`
	// PipelineName
	PipelineName string `yaml:"pipeline_name"`
	// TaskID
	TaskID int64 `yaml:"task_id"`
	// ServiceName
	ServiceName string `yaml:"service_name"`

	// ResetCache ignore workspace cache [runtime]
	ResetCache bool `yaml:"reset_cache"`

	// IgnoreCache ignore docker build cache [runtime]
	IgnoreCache bool `yaml:"ignore_cache"`

	StorageEndpoint string        `yaml:"storage_endpoint"`
	StorageAK       string        `yaml:"storage_ak"`
	StorageSK       string        `yaml:"storage_sk"`
	StorageBucket   string        `yaml:"storage_bucket"`
	StorageProvider int           `yaml:"storage_provider"`
	StorageRegion   string        `yaml:"storage_region"`
	ArtifactInfo    *ArtifactInfo `yaml:"artifact_info"`
	ArtifactPath    string        `yaml:"artifact_path"`
	AesKey          string        `yaml:"aes_key"`

	// New since V1.10.0.
	CacheEnable  bool               `yaml:"cache_enable"`
	Cache        types.Cache        `yaml:"cache"`
	CacheDirType types.CacheDirType `yaml:"cache_dir_type"`
	CacheUserDir string             `yaml:"cache_user_dir"`

	// Upload To S3 related context
	UploadEnabled     bool                             `yaml:"upload_enabled"`
	UploadStorageInfo *types.ObjectStorageInfo         `yaml:"upload_storage_info"`
	UploadInfo        []*types.ObjectStoragePathDetail `yaml:"upload_info"`

	// scanner used flag
	ScannerFlag           bool   `yaml:"scanner_flag"`
	ScannerType           string `yaml:"scanner_type"`
	SonarParameter        string `yaml:"sonar_parameter"`
	SonarServer           string `yaml:"sonar_server"`
	SonarLogin            string `yaml:"sonar_login"`
	SonarCheckQualityGate bool   `yaml:"sonar_check_quality_gate"`
}

type DockerBuildCtx

type DockerBuildCtx struct {
	Source                string `yaml:"source"      bson:"source"      json:"source"`
	WorkDir               string `yaml:"work_dir"    bson:"work_dir"    json:"work_dir"`
	DockerFile            string `yaml:"docker_file" bson:"docker_file" json:"docker_file"`
	ImageName             string `yaml:"image_name"  bson:"image_name"  json:"image_name"`
	BuildArgs             string `yaml:"build_args"  bson:"build_args"  json:"build_args"`
	ImageReleaseTag       string `yaml:"image_release_tag,omitempty" bson:"image_release_tag,omitempty" json:"image_release_tag"`
	DockerTemplateContent string `yaml:"docker_template_content" bson:"docker_template_content" json:"docker_template_content"`
}

DockerBuildCtx ... Docker build参数 WorkDir: docker build执行路径 DockerFile: dockerfile名称, 默认为Dockerfile ImageBuild: build image镜像全称, e.g. xxx.com/spock-release-candidates/image:tag

func (*DockerBuildCtx) GetDockerFile

func (c *DockerBuildCtx) GetDockerFile() string

type DockerRegistry

type DockerRegistry struct {
	Host      string `yaml:"host"`
	Namespace string `yaml:"namespace"`
	UserName  string `yaml:"username"`
	Password  string `yaml:"password"`
}

DockerRegistry 推送镜像到 docker registry 配置

type EnvVar

type EnvVar []string

EnvVar ...

func (EnvVar) Environs

func (ev EnvVar) Environs() []string

Environs 返回用户注入Env 格式为: "key=value". 支持 val 包含 $HOME

type Error

type Error struct {
	Message string `bson:"message"  json:"message" xml:"message,attr"`
	Type    string `bson:"type"     json:"type"    xml:"type,attr"`
	Text    string `bson:"text"     json:"text"    xml:",chardata"`
}

type Failure

type Failure struct {
	Message string `bson:"message"  json:"message" xml:"message,attr"`
	Type    string `bson:"type"     json:"type"    xml:"type,attr"`
	Text    string `bson:"text"     json:"text"    xml:",chardata"`
}

type FileArchiveCtx

type FileArchiveCtx struct {
	FileLocation string `yaml:"file_location" bson:"file_location" json:"file_location"`
	FileName     string `yaml:"file_name" bson:"file_name" json:"file_name"`
}

type GinkgoTest

type GinkgoTest struct {
	ResultPath     string   `yaml:"result_path"`
	TestReportPath string   `yaml:"test_report_path"`
	ArtifactPaths  []string `yaml:"artifact_paths"`
}

GinkgoTest ...

type Git

type Git struct {
	UserName string `yaml:"username"`

	Email string `yaml:"email"`

	GithubHost string `yaml:"github_host"`

	GithubSSHKey string `yaml:"github_ssh_key"`

	GitlabHost string `yaml:"gitlab_host"`
	// encoded in base64
	GitlabSSHKey string `yaml:"gitlab_ssh_key"`

	GitKnownHost string `yaml:"git_known_host"`
}

Git ...

func (*Git) GetEmail

func (g *Git) GetEmail() string

GetEmail ...

func (*Git) GetGithubHost

func (g *Git) GetGithubHost() string

GetGithubHost returns github host By default it returns github.com

func (*Git) GetGitlabHost

func (g *Git) GetGitlabHost() string

GetGitlabHost returns gitlab host By default it returns gitlab.koderover.io

func (*Git) GetUserName

func (g *Git) GetUserName() string

GetUserName ...

func (*Git) HTTPSCloneURL

func (g *Git) HTTPSCloneURL(source, token, owner, name string, optionalGiteeAddr string) string

HTTPSCloneURL returns HTTPS clone url

func (*Git) OAuthCloneURL

func (g *Git) OAuthCloneURL(source, token, address, owner, name, scheme string) string

SSHCloneURL returns Oauth clone url e.g. https://oauth2:ACCESS_TOKEN@somegitlab.com/owner/name.git

func (*Git) SSHCloneURL

func (g *Git) SSHCloneURL(source, owner, name string) string

SSHCloneURL returns SSH clone url

func (*Git) WriteGithubSSHFile

func (g *Git) WriteGithubSSHFile() error

WriteGithubSSHFile ...

func (*Git) WriteGitlabSSHFile

func (g *Git) WriteGitlabSSHFile() error

WriteGitlabSSHFile ...

func (*Git) WriteKnownHostFile

func (g *Git) WriteKnownHostFile() error

WriteKnownHostFile ...

func (*Git) WriteSSHConfigFile

func (g *Git) WriteSSHConfigFile(proxy *Proxy) error

WriteSSHConfigFile ...

type Install

type Install struct {
	// 安装名称
	Name string `yaml:"name"`
	// 安装版本
	Version string `yaml:"version"`
	// 安装脚本
	Scripts []string `yaml:"scripts"`
	// 可执行文件目录
	BinPath string `yaml:"bin_path"`
	// Optional: 安装脚本环境变量
	Envs EnvVar `yaml:"envs"`
	// 安装包位置
	Download string `yaml:"download"`
}

Install ...

type Proxy

type Proxy struct {
	Type                   string `yaml:"type"`
	Address                string `yaml:"address"`
	Port                   int    `yaml:"port"`
	NeedPassword           bool   `yaml:"need_password"`
	Username               string `yaml:"username"`
	Password               string `yaml:"password"`
	EnableRepoProxy        bool   `yaml:"enable_repo_proxy"`
	EnableApplicationProxy bool   `yaml:"enable_application_proxy"`
}

Proxy 翻墙配置信息

func (*Proxy) GetProxyURL

func (p *Proxy) GetProxyURL() string

type Repo

type Repo struct {
	Source             string         `yaml:"source"`
	Address            string         `yaml:"address"`
	Owner              string         `yaml:"owner"`
	Name               string         `yaml:"name"`
	Namespace          string         `yaml:"namespace"`
	RemoteName         string         `yaml:"remote_name"`
	Branch             string         `yaml:"branch"`
	PR                 int            `yaml:"pr"`
	PRs                []int          `yaml:"prs"`
	Tag                string         `yaml:"tag"`
	CheckoutPath       string         `yaml:"checkout_path"`
	SubModules         bool           `yaml:"submodules"`
	OauthToken         string         `yaml:"oauthToken"`
	User               string         `yaml:"username"`
	Password           string         `yaml:"password"`
	CheckoutRef        string         `yaml:"checkout_ref"`
	EnableProxy        bool           `yaml:"enable_proxy"`
	AuthType           types.AuthType `yaml:"auth_type,omitempty"`
	SSHKey             string         `yaml:"ssh_key,omitempty"`
	PrivateAccessToken string         `yaml:"private_access_token,omitempty"`
}

Repo ...

func (*Repo) BranchRef

func (r *Repo) BranchRef() string

BranchRef returns branch refs format e.g. refs/heads/master

func (*Repo) PRRef

func (r *Repo) PRRef() string

PRRef returns refs format It will check repo provider type, by default returns github refs format.

e.g. github returns refs/pull/1/head e.g. gitlab returns merge-requests/1/head

func (*Repo) PRRefByPRID added in v1.9.9

func (r *Repo) PRRefByPRID(pr int) string

func (*Repo) Ref

func (r *Repo) Ref() string

Ref returns the changes ref of current repo in the following order: 1. tag ref 2. branch ref 3. pr ref

func (*Repo) TagRef

func (r *Repo) TagRef() string

TagRef returns the tag ref of current repo e.g. refs/tags/v1.0.0

type SSH

type SSH struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	UserName   string `json:"user_name"`
	IP         string `json:"ip"`
	Port       int64  `json:"port"`
	IsProd     bool   `json:"is_prod"`
	Label      string `json:"label"`
	PrivateKey string `json:"private_key"`
}

type Skipped

type Skipped struct {
}

type TestCase

type TestCase struct {
	Name      string   `bson:"tc_name"                 json:"tc_name"      xml:"name,attr"`
	ClassName string   `bson:"classname"               json:"classname"    xml:"classname,attr"`
	Time      float64  `bson:"time"                    json:"time"         xml:"time,attr"`
	Failure   *Failure `bson:"failure,omitempty"       json:"failure"      xml:"failure,omitempty"`
	Skipped   *Skipped `bson:"skipped,omitempty"       json:"skipped"      xml:"skipped,omitempty"`
	SystemOut string   `bson:"system_out,omitempty"    json:"system_out"   xml:"system-out,omitempty"`
	SystemErr string   `bson:"system-err,omitempty"    json:"system_err"   xml:"system-err,omitempty"`
	Error     *Error   `bson:"error,omitempty"         json:"error"        xml:"error,omitempty"`
}

type TestSuite

type TestSuite struct {
	// 总数=tests+skips 成功=tests-failures-errors
	Tests     int        `bson:"tests"                   json:"tests"                    xml:"tests,attr"`
	Failures  int        `bson:"failures"                json:"failures"                 xml:"failures,attr"`
	Successes int        `bson:"successes,omitempty"     json:"successes,omitempty"      xml:"successes,attr,omitempty"`
	Skips     int        `bson:"skips"                   json:"skips"                    xml:"skips,attr"`
	Errors    int        `bson:"errors,omitempty"        json:"errors"                   xml:"errors,attr,omitempty"`
	Time      float64    `bson:"time"                    json:"time"                     xml:"time,attr"`
	SystemOut string     `bson:"system_out,omitempty"    json:"system_out"               xml:"system-out,omitempty"`
	SystemErr string     `bson:"system-err,omitempty"    json:"system_err"               xml:"system-err,omitempty"`
	TestCases []TestCase `bson:"testcase"                json:"testcase"                 xml:"testcase"`
	SuiteType string     `bson:"-"                       json:"-"                        xml:"-"`
	Name      string     `bson:"name"                    json:"-"                        xml:"-"`
}

type TestSuites

type TestSuites struct {
	Tests      int          `bson:"tests"                   json:"tests"          xml:"tests,attr"`
	Skips      int          `bson:"skips"                   json:"skips"          xml:"skips,attr"`
	Failures   int          `bson:"failures"                json:"failures"       xml:"failures,attr"`
	Errors     int          `bson:"errors,omitempty"        json:"errors"         xml:"errors,attr,omitempty"`
	Time       float64      `bson:"time"                    json:"time"           xml:"time,attr"`
	TestSuites []*TestSuite `bson:"testsuite"               json:"testsuite"      xml:"testsuite"`
}

Jump to

Keyboard shortcuts

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