common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: AGPL-3.0 Imports: 24 Imported by: 4

Documentation

Index

Constants

View Source
const AlpineImage = "alpine:3.12.0"

Variables

This section is empty.

Functions

func CheckDockerHostConnection

func CheckDockerHostConnection() (string, error)

func CopyDirectory

func CopyDirectory(w io.Writer, scrDir, dest string) error

func CopyFile

func CopyFile(srcFile, dstFile string) error

func CreateDir

func CreateDir(opt CreateDirOption) error

func CreateDirInContainer

func CreateDirInContainer(workDir, folderName string) error

func CreateIfNotExists

func CreateIfNotExists(dir string, perm os.FileMode) error

func DeleteDir

func DeleteDir(option DeleteDirOption) error

func DeleteDirOnContainer

func DeleteDirOnContainer(workDir, folderName string) error

func Exists

func Exists(filePath string) bool

func IsEmptyString

func IsEmptyString(s string) bool

func PrintLog

func PrintLog(msg string, v ...interface{})

func PrintLogW

func PrintLogW(w io.Writer, msg string, v ...interface{})

func SetDockerHost

func SetDockerHost(hosts []string)

func SetGitClient

func SetGitClient(cli GitClient)

func SumContentMD5

func SumContentMD5(file string) (string, error)

func ValidateDockerHostConnection

func ValidateDockerHostConnection() error

Types

type CreateDirOption

type CreateDirOption struct {
	WorkDir       string
	RelativePath  string
	AbsPath       string
	SkipContainer bool
	Perm          os.FileMode
}

type DeleteDirOption

type DeleteDirOption struct {
	WorkDir       string
	RelativePath  string
	AbsPath       string
	SkipContainer bool
}

type DockerAuth

type DockerAuth struct {
	Registry string
	Username string
	Password string
}

type DockerClient

type DockerClient struct {
	Client *client.Client
	Host   string
}

func NewClient

func NewClient() (DockerClient, error)

func (*DockerClient) BuildImage

func (c *DockerClient) BuildImage(ctx context.Context, file string, tags []string, auths []DockerAuth) (types.ImageBuildResponse, error)

func (*DockerClient) BuildImageWithSpecificDockerFile

func (c *DockerClient) BuildImageWithSpecificDockerFile(ctx context.Context, tarFile, dockerFile string, tags []string) (types.ImageBuildResponse, error)

func (*DockerClient) DeployImage

func (c *DockerClient) DeployImage(ctx context.Context, username, password, image string) (io.ReadCloser, error)

func (*DockerClient) PullImage

func (c *DockerClient) PullImage(ctx context.Context, username, password, image string) (io.ReadCloser, error)

func (*DockerClient) RemoveImage

func (c *DockerClient) RemoveImage(ctx context.Context, image string) ([]types.ImageDelete, error)

func (*DockerClient) TagImage

func (c *DockerClient) TagImage(ctx context.Context, src, dest string) error

type GitClient

type GitClient struct {
	WorkDir       string
	AccessToken   string
	Name          string
	Email         string
	Repo          *git.Repository
	CurrentBranch *plumbing.Reference
	Remote        *git.Remote
}

func GetGitClient

func GetGitClient() GitClient

func (*GitClient) Add

func (c *GitClient) Add(path string) error

func (*GitClient) Close

func (cli *GitClient) Close()

func (*GitClient) Commit

func (c *GitClient) Commit(msg string) error

func (*GitClient) CreateNewBranch

func (c *GitClient) CreateNewBranch(branchName string) error

func (*GitClient) OpenCurrentRepo

func (cli *GitClient) OpenCurrentRepo() (err error)

func (*GitClient) Push

func (c *GitClient) Push() error

func (*GitClient) Tag

func (c *GitClient) Tag(version string) error

func (*GitClient) Validate

func (c *GitClient) Validate() error

type POM

type POM struct {
	XMLName    xml.Name  `xml:"project"`
	Parent     ParentPOM `xml:"parent"`
	GroupId    string    `xml:"groupId"`
	ArtifactId string    `xml:"artifactId"`
	Classifier string    `xml:"packaging"`
	Version    string    `xml:"version"`
}

func ReadPOM

func ReadPOM(pomFile string) (POM, error)

type PackageJson

type PackageJson struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

func ReadNodeJSPackageJson

func ReadNodeJSPackageJson(file string) (pj PackageJson, err error)

type ParentPOM

type ParentPOM struct {
	GroupId    string `xml:"groupId"`
	ArtifactId string `xml:"artifactId"`
	Version    string `xml:"version"`
}

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

func Parse

func Parse(s string) (v Version, err error)

func (*Version) MajorBranch

func (v *Version) MajorBranch() string

func (*Version) MinorBranch

func (v *Version) MinorBranch() string

func (*Version) NextMajor

func (v *Version) NextMajor()

func (*Version) NextMinor

func (v *Version) NextMinor()

func (*Version) NextPatch

func (v *Version) NextPatch()

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

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