Documentation ¶
Index ¶
- func AllCmds() []string
- func CheckFileExist(path string) bool
- func CheckTrustedRepositories(image, user, pass string) error
- func CopyFileWithProgress(src, dst string, logger event.Logger) error
- func CopyToFile(outfile string, r io.Reader) error
- func CopyWithProgress(srcFile SrcFile, dstFile DstFile, allSize int64, logger event.Logger) (err error)
- func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error)
- func EncodePrivateKey(private *rsa.PrivateKey) []byte
- func EncodeSSHKey(public *rsa.PublicKey) ([]byte, error)
- func GenerateKey(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)
- func GetCodeSourceDir(RepositoryURL, branch, tenantID string, ServiceID string) string
- func GetLastCommit(re *git.Repository) (*object.Commit, error)
- func GetPrivateFile(tenantId string) string
- func GetPublicKey(tenantId string) string
- func GitClone(csi CodeSourceInfo, sourceDir string, logger event.Logger, timeout int) (*git.Repository, error)
- func GitCloneOrPull(csi CodeSourceInfo, sourceDir string, logger event.Logger, timeout int) (*git.Repository, error)
- func GitPull(csi CodeSourceInfo, sourceDir string, logger event.Logger, timeout int) (*git.Repository, error)
- func Home() (string, error)
- func ImageBuild(dockerCli *client.Client, contextDir string, options types.ImageBuildOptions, ...) error
- func ImageImport(dockerCli *client.Client, image, source string, logger event.Logger) error
- func ImageInspectWithRaw(dockerCli *client.Client, image string) (*types.ImageInspect, error)
- func ImageLoad(dockerCli *client.Client, tarFile string, logger event.Logger) error
- func ImageNameHandle(imageName string) *model.ImageName
- func ImagePull(dockerCli *client.Client, image string, username, password string, ...) (*types.ImageInspect, error)
- func ImagePush(dockerCli *client.Client, image, user, pass string, logger event.Logger, ...) error
- func ImageRemove(dockerCli *client.Client, image string) error
- func ImageSave(dockerCli *client.Client, image, destination string, logger event.Logger) error
- func ImageTag(dockerCli *client.Client, source, target string, logger event.Logger, ...) error
- func MakeSSHKeyPair() (string, string, error)
- func RemoveDir(path string) error
- func SvnClone(dir, url, user, password string, logger event.Logger, timeout time.Duration) (string, error)
- func SvnPull(dir, user, password string) error
- func TrustedImagePush(dockerCli *client.Client, image, user, pass string, logger event.Logger, ...) error
- type CodeSourceInfo
- type Command
- type Commit
- type DstFile
- type IOError
- type Info
- type JSONError
- type JSONMessage
- type JSONProgress
- type Logs
- type ParseError
- type Repostory
- type RepostoryBuildInfo
- type SFTPClient
- type SVNClient
- type SrcFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckTrustedRepositories ¶
CheckTrustedRepositories check Repositories is exist ,if not create it.
func CopyFileWithProgress ¶
CopyFileWithProgress 复制文件,带进度
func CopyToFile ¶
CopyToFile writes the content of the reader to the specified file
func CopyWithProgress ¶
func CopyWithProgress(srcFile SrcFile, dstFile DstFile, allSize int64, logger event.Logger) (err error)
CopyWithProgress copy file
func EncodeAuthToBase64 ¶
func EncodeAuthToBase64(authConfig types.AuthConfig) (string, error)
EncodeAuthToBase64 serializes the auth configuration as JSON base64 payload
func EncodePrivateKey ¶
func EncodePrivateKey(private *rsa.PrivateKey) []byte
func GenerateKey ¶
func GetCodeSourceDir ¶
GetCodeSourceDir 获取源码下载目录
func GetLastCommit ¶
GetLastCommit get last commit info get commit by head reference
func GitClone ¶
func GitClone(csi CodeSourceInfo, sourceDir string, logger event.Logger, timeout int) (*git.Repository, error)
GitClone git clone code
func GitCloneOrPull ¶
func GitCloneOrPull(csi CodeSourceInfo, sourceDir string, logger event.Logger, timeout int) (*git.Repository, error)
GitCloneOrPull if code exist in local,use git pull.
func GitPull ¶
func GitPull(csi CodeSourceInfo, sourceDir string, logger event.Logger, timeout int) (*git.Repository, error)
GitPull git pull code
func Home ¶
Home returns the home directory for the executing user.
This uses an OS-specific method for discovering the home directory. An error is returned if a home directory cannot be detected.
func ImageBuild ¶
func ImageBuild(dockerCli *client.Client, contextDir string, options types.ImageBuildOptions, logger event.Logger, timeout int) error
ImageBuild ImageBuild
func ImageImport ¶
ImageImport save image to tar file source source file name eg. /tmp/xxx.tar
func ImageInspectWithRaw ¶
ImageInspectWithRaw get image inspect
func ImageLoad ¶
ImageSave save image to tar file destination destination file name eg. /tmp/xxx.tar
func ImageNameHandle ¶
ImageNameHandle 解析imagename
func ImagePull ¶
func ImagePull(dockerCli *client.Client, image string, username, password string, logger event.Logger, timeout int) (*types.ImageInspect, error)
ImagePull 拉取镜像 timeout 分钟为单位
func ImagePush ¶
func ImagePush(dockerCli *client.Client, image, user, pass string, logger event.Logger, timeout int) error
ImagePush 推送镜像 timeout 分钟为单位
func ImageRemove ¶
ImageRemove remove image
func ImageSave ¶
ImageSave save image to tar file destination destination file name eg. /tmp/xxx.tar
func ImageTag ¶
func ImageTag(dockerCli *client.Client, source, target string, logger event.Logger, timeout int) error
ImageTag 修改镜像tag
Types ¶
type CodeSourceInfo ¶
type CodeSourceInfo struct { ServerType string `json:"server_type"` RepositoryURL string `json:"repository_url"` Branch string `json:"branch"` User string `json:"user"` Password string `json:"password"` //避免项目之间冲突,代码缓存目录提高到租户 TenantID string `json:"tenant_id"` ServiceID string `json:"service_id"` }
CodeSourceInfo 代码源信息
func (CodeSourceInfo) GetCodeCacheDir ¶
func (c CodeSourceInfo) GetCodeCacheDir() string
GetCodeCacheDir 获取代码缓存目录
func (CodeSourceInfo) GetCodeSourceDir ¶
func (c CodeSourceInfo) GetCodeSourceDir() string
GetCodeSourceDir 获取代码下载目录
func (*CodeSourceInfo) InitServerType ¶
func (c *CodeSourceInfo) InitServerType()
InitServerType init server type
type Command ¶
type Command struct { Cmd string // lowercased command name (ex: `from`) SubCmd string // for ONBUILD only this holds the sub-command Json bool // whether the value is written in json form Original string // The original source line StartLine int // The original source line number Flags []string // Any flags such as `--from=...` for `COPY`. Value []string // The contents of the command (ex: `ubuntu:xenial`) }
Command Represents a single line (layer) in a Dockerfile. For example `FROM ubuntu:xenial`
type Commit ¶
type Commit struct { Revision string `xml:"revision,attr"` Author string `xml:"author"` Msg string `xml:"msg"` Date string `xml:"date"` }
Commit Commit
type Info ¶
type Info struct { XMLName xml.Name `xml:"info"` URL string `xml:"entry>url"` RelativeURL string `xml:"entry>relative-url"` Root string `xml:"entry>repository>root"` UUID string `xml:"entry>repository>uuid"` WcrootAbspath string `xml:"entry>wc-info>wcroot-abspath"` Schedule string `xml:"entry>wc-info>schedule"` Depth string `xml:"entry>wc-info>depth"` Logs *Logs Branchs []string Tags []string }
Info Info
type JSONError ¶
type JSONError struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` }
JSONError wraps a concrete Code and Message, `Code` is is an integer error code, `Message` is the error message.
type JSONMessage ¶
type JSONMessage struct { Stream string `json:"stream,omitempty"` Status string `json:"status,omitempty"` Progress *JSONProgress `json:"progressDetail,omitempty"` ProgressMessage string `json:"progress,omitempty"` //deprecated ID string `json:"id,omitempty"` From string `json:"from,omitempty"` Time int64 `json:"time,omitempty"` TimeNano int64 `json:"timeNano,omitempty"` Error *JSONError `json:"errorDetail,omitempty"` ErrorMessage string `json:"error,omitempty"` //deprecated // Aux contains out-of-band data, such as digests for push signing. Aux *json.RawMessage `json:"aux,omitempty"` }
JSONMessage JSONMessage
func (*JSONMessage) JSONString ¶
func (j *JSONMessage) JSONString() string
JSONString return json string
type JSONProgress ¶
type JSONProgress struct { Current int64 `json:"current,omitempty"` Total int64 `json:"total,omitempty"` Start int64 `json:"start,omitempty"` // If true, don't show xB/yB HideCounts bool `json:"hidecounts,omitempty"` // contains filtered or unexported fields }
JSONProgress describes a Progress. terminalFd is the fd of the current terminal, Start is the initial value for the operation. Current is the current status and value of the progress made towards Total. Total is the end value describing when we made 100% progress for an operation.
type ParseError ¶
type ParseError struct {
Msg string
}
ParseError A failure in parsing the file as a dockerfile.
func (ParseError) Error ¶
func (e ParseError) Error() string
type Repostory ¶
type Repostory struct { ID int `json:"id,omitempty"` Namespace string `json:"namespace,omitempty"` NamespaceType string `json:"namespaceType,omitempty"` Name string `json:"name"` ShortDescription string `json:"shortDescription"` LongDescription string `json:"longDescription"` Visibility string `json:"visibility"` Status string `json:"status,omitempty"` }
Repostory repostory info
type RepostoryBuildInfo ¶
type RepostoryBuildInfo struct { RepostoryURL string RepostoryURLType string BuildBranch string BuildPath string CodeHome string // contains filtered or unexported fields }
RepostoryBuildInfo 源码编译信息
func CreateRepostoryBuildInfo ¶
func CreateRepostoryBuildInfo(repoURL, repoType, branch, tenantID string, ServiceID string) (*RepostoryBuildInfo, error)
CreateRepostoryBuildInfo 创建源码编译信息 repoType git or svn
func (*RepostoryBuildInfo) GetCodeBuildAbsPath ¶
func (r *RepostoryBuildInfo) GetCodeBuildAbsPath() string
GetCodeBuildAbsPath 获取代码编译绝对目录
func (*RepostoryBuildInfo) GetCodeBuildPath ¶
func (r *RepostoryBuildInfo) GetCodeBuildPath() string
GetCodeBuildPath 获取代码编译相对目录
func (*RepostoryBuildInfo) GetCodeHome ¶
func (r *RepostoryBuildInfo) GetCodeHome() string
GetCodeHome 获取代码目录
func (*RepostoryBuildInfo) GetProtocol ¶
func (r *RepostoryBuildInfo) GetProtocol() string
GetProtocol 获取协议
type SFTPClient ¶
type SFTPClient struct { UserName string `json:"username"` PassWord string `json:"password"` Host string `json:"host"` Port int `json:"int"` // contains filtered or unexported fields }
SFTPClient sFTP客户端
func NewSFTPClient ¶
func NewSFTPClient(username, password, host, port string) (*SFTPClient, error)
NewSFTPClient NewSFTPClient
func (*SFTPClient) DownloadFile ¶
func (s *SFTPClient) DownloadFile(src, dst string, logger event.Logger) error
DownloadFile DownloadFile