Versions in this module Expand all Collapse all v1 v1.15.0 Sep 4, 2024 v1.14.0 Jul 30, 2024 v1.13.0 Jun 18, 2024 v1.12.0 Apr 17, 2024 v1.11.0 Feb 21, 2024 v1.10.0 Jan 16, 2024 v1.9.0 Dec 18, 2023 v1.8.0 Nov 28, 2023 v1.7.0 Nov 27, 2023 v1.6.0 Nov 1, 2023 v1.5.0 Aug 30, 2023 Changes in this version + const DefaultContainerdSock + const DefaultDockerSock v1.4.0 Aug 8, 2023 Changes in this version + const CONTAINER_ACTION_CREATE + const CONTAINER_ACTION_DESTROY + const CONTAINER_ACTION_DIE + const CONTAINER_ACTION_START + const CONTAINER_ACTION_STOP + const ContainerRuntimeContainerd + const ContainerRuntimeDocker + const ContainerdSock + const DockerContainerdSock + const RunDockerContainerdSock + const RuntimeEndpointContainerd + const RuntimeEndpointDocker + var ErrorNoAuth = fmt.Errorf("pull image require docker login") + var ErrorNoImage = fmt.Errorf("image not exist") + var Namespace = "k8s.io" + func AllCmds() []string + func CacheContainer(cchan chan ContainerEvent, cs ...ContainerEvent) + func CheckFileExist(path string) bool + func CheckIfImageExists(containerdClient *containerd.Client, image string) (imageName string, isExists bool, err error) + 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 CreateImageName(ServiceID, DeployVersion string) string + func CreateVolumesAndMounts(contextDir, buildType string) (volumes []corev1.Volume, volumeMounts []corev1.VolumeMount) + 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, tenantEnvID string, ServiceID string) string + func GetLastCommit(re *git.Repository) (*object.Commit, error) + func GetPrivateFile(tenantEnvID string) string + func GetPublicKey(tenantEnvID string) string + func GetTagFromNamedRef(ref reference.Named) string + func GitCheckout(sourceDir, branch string) error + 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(contextDir, WtNamespace, ServiceID, DeployVersion string, logger event.Logger, ...) error + func ImageExist(imageName, user, password string) (bool, 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 ImageNameWithNamespaceHandle(imageName string) *model.ImageName + func ImagePull(client *containerd.Client, ref string, username, password string, ...) (*containerd.Image, error) + func ImagePush(client *containerd.Client, rawRef, user, pass string, logger event.Logger, ...) error + func ImageRemove(containerdClient *containerd.Client, image string) error + func ImageSave(dockerCli *client.Client, image, destination string, logger event.Logger) error + func ImageTag(containerdClient *containerd.Client, source, target string, ...) error + func ImagesPullAndPush(sourceImage, targetImage, username, password string, logger event.Logger) error + func MakeSSHKeyPair() (string, string, error) + func MultiImageSave(ctx context.Context, dockerCli *client.Client, destination string, ...) error + func RemoveDir(path string) error + func TrustedImagePush(containerdClient *containerd.Client, image, user, pass string, ...) error + func WaitingComplete(reChan *channels.RingChannel) (err error) + type ClientFactory interface + NewClient func(endpoint string, timeout time.Duration) (ContainerImageCli, error) + type CodeSourceInfo struct + Branch string + Password string + RepositoryURL string + ServerType string + ServiceID string + TenantEnvID string + User string + func (c CodeSourceInfo) GetCodeSourceDir() string + type Command struct + Cmd string + Flags []string + Json bool + Original string + StartLine int + SubCmd string + Value []string + func ParseFile(filename string) ([]Command, error) + func ParseReader(file io.Reader) ([]Command, error) + type Commit struct + Author string + Date string + Msg string + Revision string + type ContainerConfig struct + Annotations map[string]string + Args []string + AttachStderr bool + AttachStdin bool + AttachStdout bool + Command []string + Devices []*Device + Envs []*KeyValue + ExtraHosts []string + Image *ImageSpec + Labels map[string]string + LogPath string + Metadata *ContainerMetadata + Mounts []*Mount + NetworkConfig *NetworkConfig + Stdin bool + StdinOnce bool + Tty bool + WorkingDir string + func (m *ContainerConfig) GetAnnotations() map[string]string + func (m *ContainerConfig) GetDevices() []*Device + func (m *ContainerConfig) GetEnvs() []*KeyValue + func (m *ContainerConfig) GetImage() *ImageSpec + func (m *ContainerConfig) GetLabels() map[string]string + func (m *ContainerConfig) GetMetadata() *ContainerMetadata + func (m *ContainerConfig) GetMounts() []*Mount + type ContainerDesc struct + ContainerRuntime string + Info map[string]string + func (c *ContainerDesc) GetId() string + func (c *ContainerDesc) GetLogPath() string + type ContainerEvent struct + Action string + Container *ContainerDesc + type ContainerImageCli interface + GetDockerClient func() (*dockercli.Client, error) + GetRuntimeClient func() (*runtimeapi.RuntimeServiceClient, error) + InspectContainer func(containerID string) (*ContainerDesc, error) + ListContainers func() ([]*runtimeapi.Container, error) + WatchContainers func(ctx context.Context, cchan chan ContainerEvent) error + func NewContainerImageClient(containerRuntime, endpoint string, timeout time.Duration) (c ContainerImageCli, err error) + type ContainerMetadata struct + Attempt uint32 + Name string + type Device struct + ContainerPath string + HostPath string + Permissions string + type DstFile interface + Write func([]byte) (int, error) + type IOError struct + Msg string + func (e IOError) Error() string + type ImageClient interface + CheckIfImageExists func(imageName string) (imageRef string, exists bool, err error) + GetContainerdClient func() *containerd.Client + GetDockerClient func() *dockercli.Client + ImageLoad func(tarFile string, logger event.Logger) error + ImagePull func(image string, username, password string, logger event.Logger, timeout int) (*ocispec.ImageConfig, error) + ImagePush func(image, user, pass string, logger event.Logger, timeout int) error + ImageRemove func(image string) error + ImageSave func(image, destination string) error + ImageTag func(source, target string, logger event.Logger, timeout int) error + ImagesPullAndPush func(sourceImage, targetImage, username, password string, logger event.Logger) error + TrustedImagePush func(image, user, pass string, logger event.Logger, timeout int) error + func NewImageClient(containerRuntime, endpoint string, timeout time.Duration) (c ImageClient, err error) + type ImageClientFactory interface + NewClient func(endpoint string, timeout time.Duration) (ImageClient, error) + type ImageSpec struct + Image string + type Info struct + Branchs []string + Depth string + Logs *Logs + RelativeURL string + Root string + Schedule string + Tags []string + URL string + UUID string + WcrootAbspath string + XMLName xml.Name + type JSONError struct + Code int + Message string + func (e *JSONError) Error() string + type JSONMessage struct + Aux *json.RawMessage + Error *JSONError + ErrorMessage string + From string + ID string + Progress *JSONProgress + ProgressMessage string + Status string + Stream string + Time int64 + TimeNano int64 + func (j *JSONMessage) JSONString() string + type JSONProgress struct + Current int64 + HideCounts bool + Start int64 + Total int64 + type KeyValue struct + Key string + Value string + type Logs struct + CommitEntrys []Commit + XMLName xml.Name + type Mount struct + ContainerPath string + HostPath string + Readonly bool + SelinuxRelabel bool + type NetworkConfig struct + NetworkMode string + type ParseError struct + Msg string + func (e ParseError) Error() string + type Repostory struct + ID int + LongDescription string + Name string + Namespace string + NamespaceType string + ShortDescription string + Status string + Visibility string + type RepostoryBuildInfo struct + BuildBranch string + BuildPath string + CodeHome string + RepostoryURL string + RepostoryURLType string + func CreateRepostoryBuildInfo(repoURL, repoType, branch, tenantEnvID string, ServiceID string) (*RepostoryBuildInfo, error) + func (r *RepostoryBuildInfo) GetCodeBuildAbsPath() string + func (r *RepostoryBuildInfo) GetCodeBuildPath() string + func (r *RepostoryBuildInfo) GetCodeHome() string + func (r *RepostoryBuildInfo) GetProtocol() string + type SFTPClient struct + Host string + PassWord string + Port int + UserName string + func NewSFTPClient(username, password, host, port string) (*SFTPClient, error) + func (s *SFTPClient) Close() + func (s *SFTPClient) DownloadFile(src, dst string, logger event.Logger) error + func (s *SFTPClient) FileExist(filepath string) (bool, error) + func (s *SFTPClient) MkdirAll(dirpath string) error + func (s *SFTPClient) PushFile(src, dst string, logger event.Logger) error + type SVNClient interface + Checkout func() (*Info, error) + Update func(childpath string) (*Info, error) + UpdateOrCheckout func(childpath string) (*Info, error) + func NewClient(csi CodeSourceInfo, codeHome string, logger event.Logger) SVNClient + func NewClientWithEnv(username, password, url, sourceDir string, env []string) SVNClient + type SrcFile interface + Read func([]byte) (int, error)