Documentation
¶
Index ¶
- Constants
- func AddOutputData(key string, data interface{})
- func AddQualityData(qualityKey string, qualitydata *Qualitydata)
- func ChangeLocalizer(l string)
- func FinishBuild(status Status, msg string)
- func FinishBuildWithError(status Status, msg string, errorCode int, errorType ErrorType)
- func FinishBuildWithErrorCode(status Status, msg string, errorCode int)
- func GetBuildContextByKey(key string) string
- func GetBuildVar() (map[string]interface{}, error)
- func GetBuildVarByKey(key string) (string, error)
- func GetCertificate(certificateId string) map[string]string
- func GetGitOauth(userID string) (map[string]interface{}, error)
- func GetInputParam(name string) string
- func GetOutputData(key string) interface{}
- func GetPipelineBuildId() string
- func GetPipelineBuildNumber() string
- func GetPipelineCreateUser() string
- func GetPipelineId() string
- func GetPipelineModifyUser() string
- func GetPipelineName() string
- func GetPipelineStartTimeMills() string
- func GetPipelineStartType() string
- func GetPipelineStartUserId() string
- func GetPipelineStartUserName() string
- func GetPipelineVersion() string
- func GetPostActionParam() string
- func GetProjectDisplayName() string
- func GetProjectName() string
- func GetQualityData(qualityKey string) interface{}
- func GetRepoInfo(repoType repositoryType, repoId string) (map[string]interface{}, error)
- func GetRuntimeLanguage() string
- func GetSensitiveConfParam(fieldName string) string
- func GetVariableByName(name string) string
- func GetWorkspace() string
- func InitI18n(translations map[string][][]string, nowLanguage string) error
- func LoadInputParam(v interface{}) error
- func Localize(messageId string, params ...interface{}) (string, error)
- func RemoveOutputData(key string)
- func RemoveQualityData(qualityKey string)
- func SetAtomOutputType(atomOutputType string)
- func SetPlatformCode(platformCode string)
- func SetPlatformErrorCode(platformErrorCode int)
- func WriteOutput() error
- type ArtifactData
- type AtomBaseParam
- type AtomOutput
- type BuildRequest
- type BuildType
- type Certificate
- type CommitData
- type CommitResponse
- type CommitResult
- type DataType
- type ErrorType
- type FileChecksums
- type FileDetail
- type Qualitydata
- type ReportData
- type ReportType
- type Result
- type SdkEnv
- type Status
- type StringData
- type StringResult
Constants ¶
const ( Pipeline artifactType = "PIPELINE" // 流水线仓库 CustomDir artifactType = "CUSTOM_DIR" // 自定义仓库 )
仓库类型
const ( RepoTypeId repositoryType = "ID" RepoTypeName repositoryType = "NAME" )
代码库选择方式
const ( DEFAULT_LANGUAGE_TYPE = "zh_CN" I18NFILE_PREFIX = "message_" I18NFILE_SUFFIX = ".properties" )
const ( AuthHeaderBuildId = "X-SODA-BID" AuthHeaderProjectId = "X-SODA-PID" AuthHeaderDevopsBuildType = "X-DEVOPS-BUILD-TYPE" AuthHeaderDevopsProjectId = "X-DEVOPS-PROJECT-ID" AuthHeaderDevopsBuildId = "X-DEVOPS-BUILD-ID" AuthHeaderDevopsVmSeqId = "X-DEVOPS-VM-SID" AuthHeaderDevopsVmSeqName = "X-DEVOPS-VM-NAME" AuthHeaderDevopsAgentId = "X-DEVOPS-AGENT-ID" AuthHeaderDevopsAgentSecretKey = "X-DEVOPS-AGENT-SECRET-KEY" AuthHeaderDevopsCiTaskId = "X-DEVOPS-CI-TASK-ID" )
http head keys
const ( DataDirEnv = "bk_data_dir" InputFileEnv = "bk_data_input" OutputFileEnv = "bk_data_output" )
consts
const ( BuildTypeWorker = "WORKER" BuildTypeAgent = "AGENT" BuildTypePluginAgent = "PLUGIN_AGENT" BuildTypeDocker = "DOCKER" BuildTypeDockerHost = "DOCKER_HOST" BuildTypeTstackAgent = "TSTACK_AGENT" )
构建类型
Variables ¶
This section is empty.
Functions ¶
func AddQualityData ¶ added in v1.2.3
func AddQualityData(qualityKey string, qualitydata *Qualitydata)
AddQualityData 添加质量红线信息
func FinishBuildWithError ¶ added in v1.2.3
FinishBuildWithError 结束构建 @status 任务状态 @msg 消息 @errorCode 错误码 @errorType 错误类型
func FinishBuildWithErrorCode ¶
FinishBuildWithErrorCode 结束构建 @status 任务状态 @msg 消息 @errorCode 错误码
func GetBuildContextByKey ¶ added in v1.2.3
GetBuildContextByKey 获取指定构建下的构建上下文 Deprecated: 该接口将在后期弃用,请改用 GetVariableByName.
func GetBuildVar ¶ added in v1.2.3
GetBuildVar 获取指定构建下的构建参数
func GetBuildVarByKey ¶ added in v1.2.3
GetBuildVarByKey 获取指定构建下的构建参数
func GetCertificate ¶ added in v1.2.3
GetCertificate 获取指定ID的凭证
func GetGitOauth ¶ added in v1.2.3
GetGitOauth 获取 git oauth 信息
func GetPipelineCreateUser ¶ added in v1.2.3
func GetPipelineCreateUser() string
GetPipelineCreateUser 获取流水线创建人
func GetPipelineModifyUser ¶ added in v1.2.3
func GetPipelineModifyUser() string
GetPipelineModifyUser 获取流水线最后修改人
func GetPipelineStartTimeMills ¶
func GetPipelineStartTimeMills() string
GetPipelineStartTimeMills 获取流水线启动时间
func GetPipelineStartUserId ¶
func GetPipelineStartUserId() string
GetPipelineStartUserId 获取流水线启动用户ID
func GetPipelineStartUserName ¶
func GetPipelineStartUserName() string
GetPipelineStartUserName 获取流水线启动用户名
func GetPostActionParam ¶ added in v1.2.3
func GetPostActionParam() string
GetPostActionParam 获取后置执行参数
func GetQualityData ¶ added in v1.2.3
func GetQualityData(qualityKey string) interface{}
GetQualityData 获取质量红线信息
func GetRepoInfo ¶ added in v1.2.3
GetRepoInfo 获取指定GIT仓库的信息(包括代码库地址),这里的返回值字段因代码库的类型(@type字段)决定,所以返回值设为map
func GetRuntimeLanguage ¶ added in v1.2.4
func GetRuntimeLanguage() string
GetRuntimeLanguage 获取当前运行时的插件语言
func GetSensitiveConfParam ¶ added in v1.2.3
GetSensitiveConfParam 获取插件敏感参数
func GetVariableByName ¶ added in v1.2.3
GetVariableByName 获取指定构建下的构建上下文新版
func InitI18n ¶ added in v1.2.4
Initi18n 初始化国际化,并切换为指定语言 translations 生成的国际化数据,可配合 i18ngenerator 使用,机构为 language{key, value}
func RemoveQualityData ¶ added in v1.2.3
func RemoveQualityData(qualityKey string)
RemoveQualityData 删除质量红线信息
func SetPlatformCode ¶ added in v1.2.3
func SetPlatformCode(platformCode string)
SetPlatformCode 设置插件对接平台代码
func SetPlatformErrorCode ¶ added in v1.2.3
func SetPlatformErrorCode(platformErrorCode int)
SetPlatformErrorCode 设置插件对接平台错误码
Types ¶
type ArtifactData ¶
type ArtifactData struct { Type DataType `json:"type"` Value []string `json:"value"` ArtifactType artifactType `json:"artifactoryType"` Path string `json:"path"` }
ArtifactData 构件输出数据
func (*ArtifactData) AddArtifact ¶
func (a *ArtifactData) AddArtifact(artifact string)
AddArtifact 添加待归档构件输出
func (*ArtifactData) AddArtifactAll ¶
func (a *ArtifactData) AddArtifactAll(artifacts []string)
AddArtifactAll 批量添加待归档构件输出
func (*ArtifactData) AddArtifactAllToCustomRepo ¶ added in v1.2.3
func (a *ArtifactData) AddArtifactAllToCustomRepo(artifacts []string, customPath string)
AddArtifactAllToCustomRepo 批量添加待归档构件输出至自定义仓库
func (*ArtifactData) AddArtifactToCustomRepo ¶ added in v1.2.3
func (a *ArtifactData) AddArtifactToCustomRepo(artifact string, customPath string)
AddArtifactToCustomRepo 添加待归档构件输出至自定义仓库
type AtomBaseParam ¶
type AtomBaseParam struct { PipelineVersion string `json:"BK_CI_PIPELINE_VERSION"` ProjectName string `json:"BK_CI_PROJECT_NAME"` ProjectNameCn string `json:"BK_CI_PROJECT_NAME_CN"` PipelineId string `json:"BK_CI_PIPELINE_ID"` PipelineBuildNum string `json:"BK_CI_BUILD_NUM"` PipelineBuildId string `json:"BK_CI_BUILD_ID"` PipelineName string `json:"BK_CI_PIPELINE_NAME"` PipelineStartTimeMills string `json:"BK_CI_BUILD_START_TIME"` PipelineStartType string `json:"BK_CI_START_TYPE"` PipelineStartUserId string `json:"BK_CI_START_USER_ID"` PipelineStartUserName string `json:"BK_CI_START_USER_NAME"` BkWorkspace string `json:"bkWorkspace"` PipelineCreateUser string `json:"BK_CI_PIPELINE_CREATE_USER"` PipelineModifyUser string `json:"BK_CI_PIPELINE_UPDATE_USER"` BkSensitiveConfInfo map[string]string `json:"bkSensitiveConfInfo"` PostActionParam string `json:"postEntryParam"` TestVersionFlag string `json:"testVersionFlag"` TaskId string `json:"BK_CI_BUILD_TASK_ID"` TaskAtomCode string `json:"BK_CI_ATOM_CODE"` TaskAtomName string `json:"BK_CI_ATOM_NAME"` TaskAtomVersion string `json:"BK_CI_ATOM_VERSION"` TaskName string `json:"BK_CI_TASK_NAME"` StepId string `json:"BK_CI_STEP_ID"` }
AtomBaseParam 插件基本参数
type AtomOutput ¶
type AtomOutput struct { Status Status `json:"status"` Message string `json:"message"` ErrorCode int `json:"errorCode"` ErrorType ErrorType `json:"errorType"` Type string `json:"type"` Data map[string]interface{} `json:"data"` QualityData map[string]*Qualitydata `json:"qualityData"` PlatformCode string `json:"platformCode"` PlatformErrorCode int `json:"platformErrorCode"` }
AtomOutput 插件输出
type BuildRequest ¶ added in v1.2.3
type BuildRequest struct {
// contains filtered or unexported fields
}
BuildRequest 构建请求
type Certificate ¶ added in v1.2.3
type Certificate struct { Data map[string]string `json:"data"` // contains filtered or unexported fields }
Certificate 请求凭证结果
type CommitData ¶ added in v1.2.3
type CommitData struct { Type int8 `json:"type"` PipelineId string `json:"pipelineId"` BuildId string `json:"buildId"` Commit string `json:"commit"` Committer string `json:"committer"` CommitTime int64 `json:"commitTime"` Comment string `json:"comment"` RepoId string `json:"repoId"` RepoName string `json:"repoName"` ElementId string `json:"elementId"` Url string `json:"url"` }
CommitData 代码变更记录详细信息
type CommitResponse ¶ added in v1.2.3
type CommitResponse struct { Name string `json:"name"` ElementId string `json:"elementId"` Records []CommitData `json:"records"` }
CommitResponse 代码变更记录信息响应体
type CommitResult ¶ added in v1.2.3
type CommitResult struct { Status int `json:"status"` Data []CommitResponse `json:"data"` }
CommitResult 代码变更记录信息
func GetCommit ¶ added in v1.2.3
func GetCommit() (*CommitResult, error)
GetCommit 获取当前流水线构建下的“代码变更记录”
type FileChecksums ¶ added in v1.2.3
FileChecksums 文件校验值
type FileDetail ¶ added in v1.2.3
type FileDetail struct { Name string `json:"name"` FullName string `json:"fullName"` FullPath string `json:"fullPath"` Size float64 `json:"size"` CreateTime float64 `json:"createTime"` ModifiedTime float64 `json:"modifiedTime"` CheckSums FileChecksums `json:"checksums"` Meta map[string]interface{} `json:"meta"` }
FileDetail 构建文件信息
type Qualitydata ¶ added in v1.2.3
type Qualitydata struct {
Value string `json:"value"`
}
Qualitydata 质量红线数据
func NewQualityData ¶ added in v1.2.3
func NewQualityData(value string) *Qualitydata
NewQualityData 创建质量红线数据
type ReportData ¶
type ReportData struct { Type DataType `json:"type"` Label string `json:"label"` Path string `json:"path"` Url string `json:"url"` Target string `json:"target"` ReportType ReportType `json:"reportType"` }
ReportData 报告输出数据
func NewInternalReportData ¶ added in v1.2.3
func NewInternalReportData(label string, path string, target string) *ReportData
NewInternalReportData 添加内部报告输出
func NewReportData ¶
func NewReportData(label string, path string, target string) *ReportData
NewReportData 添加报告输出
func NewThirdpartyReportData ¶ added in v1.2.3
func NewThirdpartyReportData(label string, url string) *ReportData
NewThirdpartyReportData 添加第三方报告输出
type ReportType ¶ added in v1.2.3
type ReportType string
ReportType 报告类型
const ( ReportTypeInternal ReportType = "INTERNAL" // 内部报告,文件 ReportTypeThirdparty ReportType = "THIRDPARTY" // 外部报告,URL连接 )
报告类型
type Result ¶ added in v1.2.3
type Result struct { Status int `json:"status"` Data interface{} `json:"data"` }
Result 插件执行结果
type SdkEnv ¶
type SdkEnv struct { BuildType string `json:"buildType"` ProjectId string `json:"projectId"` AgentId string `json:"agentId"` SecretKey string `json:"secretKey"` Gateway string `json:"gateway"` BuildId string `json:"buildId"` VmSeqId string `json:"vmSeqId"` TaskId string `json:"taskId"` }
SdkEnv 插件运行环境变量
type StringData ¶
StringData 变量输出数据
type StringResult ¶ added in v1.2.3
type StringResult struct { Status int `json:"status"` Data interface{} `json:"data"` }
StringResult 蓝盾后台返回结果