utils

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRegistryName = "dockerhub"
	DefaultRegistry     = "https://registry.hub.docker.com"
)

Default values

Variables

View Source
var (
	// Version returns doriath version
	Version = "dev"
	// Commit returns doriath build commit
	Commit = "unknown"
)

Functions

func CompareDockerName added in v1.2.0

func CompareDockerName(a, b string) bool

CompareDockerName compares 2 docker image names

func DetectRequirement

func DetectRequirement() error

DetectRequirement detects requirement for doriath

func DockerBuild

func DockerBuild(name, tag, buildRoot string) error

DockerBuild builds a docker image

func DockerCheckTagExists

func DockerCheckTagExists(shortName, tag string, credential *DockerCredential) (bool, error)

DockerCheckTagExists checks if a tag exists on registry or not

func DockerFindLatestTag added in v1.4.0

func DockerFindLatestTag(imageInfo *DockerImageInfo, credential *DockerCredential) (string, error)

DockerFindLatestTag .

func DockerImageExistsOnLocal added in v1.4.8

func DockerImageExistsOnLocal(fullname string) (bool, error)

DockerImageExistsOnLocal .

func DockerLogin

func DockerLogin(host, username, password string) error

DockerLogin logins to docker registry

func DockerPull added in v1.4.7

func DockerPull(fullname string) error

DockerPull .

func DockerPush

func DockerPush(name, tag, buildRoot string, platforms []string) error

DockerPush pushes a docker image

func DockerRMI added in v1.1.0

func DockerRMI(name, tag string) error

DockerRMI removes a docker image

func DockerTryRMI added in v1.4.5

func DockerTryRMI(name, tag string) error

DockerTryRMI removes a docker image if exists, and will retry if necessary

func Error added in v1.4.4

func Error(err error)

Error .

func Fatal added in v1.4.4

func Fatal(err error)

Fatal .

func FormatDockerName added in v1.2.0

func FormatDockerName(name string) string

FormatDockerName adds library/ if possible

func FullVersion added in v1.6.0

func FullVersion() string

func Info added in v1.4.4

func Info(msg string, args ...interface{})

Info .

func Info2 added in v1.4.4

func Info2(msg string, args ...interface{})

Info2 .

func ResolveDir

func ResolveDir(rootDir, path string) string

ResolveDir appends a path to a rootDir

func RetryWithFixedDelay added in v1.4.5

func RetryWithFixedDelay(delay time.Duration, retries int, f func() error) error

RetryWithFixedDelay .

func RunShellCommand added in v1.3.0

func RunShellCommand(command string) error

RunShellCommand runs a command under bash shell

func Success added in v1.4.4

func Success(msg string, args ...interface{})

Success .

func Warn added in v1.4.4

func Warn(msg string, args ...interface{})

Warn .

Types

type DockerCredential

type DockerCredential struct {
	Registry      string
	Username      string
	Password      string
	HTTPToken     string
	ChallengeType string
}

DockerCredential holds credential information for a docker registry request

type DockerImageInfo

type DockerImageInfo struct {
	FullName     string
	ShortName    string
	RegistryName string
	Tag          string
}

DockerImageInfo stores common information for dockerfile

func ExtractDockerImageInfo

func ExtractDockerImageInfo(fullnameWithTag string) (*DockerImageInfo, error)

ExtractDockerImageInfo extracts docker image info

func ExtractParentImageFromDockerfile

func ExtractParentImageFromDockerfile(filename string) (*DockerImageInfo, error)

ExtractParentImageFromDockerfile extracs image information from dockerfile

type StringSet

type StringSet map[string]struct{}

StringSet is a set of string

func (StringSet) Add

func (s StringSet) Add(value string)

Add adds a value to the string set

func (StringSet) Exists

func (s StringSet) Exists(value string) bool

Exists checks if the string set contains a value or not

func (StringSet) Remove

func (s StringSet) Remove(value string)

Remove removes a value from the string set

Jump to

Keyboard shortcuts

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