Documentation
¶
Index ¶
- Constants
- Variables
- func AddSourceToImage(imagesSet map[string]map[string]bool, image string, sources ...string)
- func AppendFileLine(fileName string, line string) error
- func Base64(s string) string
- func ConstructRegistry(image, registryOverride string) string
- func CopyPolicy(src *signature.Policy) (*signature.Policy, error)
- func CopySystemContext(src *types.SystemContext) *types.SystemContext
- func DecodeBase64(s string) (string, error)
- func DeleteIfExist(name string) error
- func EnsureDirExists(directory string) error
- func EnsureSemverValid(v string) (string, error)
- func GetAbsPath(dir string) (string, error)
- func GetImageName(image string) string
- func GetImageTag(image string) string
- func GetProjectName(image string) string
- func GetRegistryName(image string) string
- func IsDirEmpty(name string) (bool, error)
- func PrintObject(a any) string
- func ReplaceProjectName(image, project string) string
- func SaveJson(data interface{}, fileName string) error
- func SaveSlice(fileName string, data []string) error
- func Scanf(ctx context.Context, format string, a ...any) (int, error)
- func SemverCompare(a, b string) (int, error)
- func SemverMajorEqual(a, b string) bool
- func SemverMajorMinorEqual(a, b string) bool
- func Sha256Sum(s string) string
- func SystemContextWithSharedBlobDir(sysctx *types.SystemContext, dir string) *types.SystemContext
- func SystemContextWithTlsVerify(sysctx *types.SystemContext, tlsVerify bool) *types.SystemContext
- func ToObj(data interface{}, into interface{}) error
Constants ¶
View Source
const ( HangarGitHubURL = "https://github.com/cnrancher/hangar" DockerHubRegistry = "docker.io" CacheCloneRepoDirectory = "charts-repo-cache" MAX_WORKER_NUM = 20 MIN_WORKER_NUM = 1 // Deprecated SavedImageListFile = "saved-images-list.json" // Deprecated CacheImageDirectory = "saved-image-cache" )
Variables ¶
View Source
var ( ErrVersionIsEmpty = errors.New("version is empty string") ErrNoAvailableImage = errors.New("no avaiable image for specified arch and os") )
View Source
var ( Version = "v1.7.0-dev" GitCommit = "" )
Functions ¶
func AddSourceToImage ¶
AddSourceToImage adds image into map[image][source]bool
func AppendFileLine ¶
func ConstructRegistry ¶
ConstructRegistry will re-construct the image url:
If `registryOverride` is empty string, example:
nginx --> docker.io/nginx (add docker.io prefix) reg.io/nginx --> reg.io/nginx (nothing changed) reg.io/user/nginx --> reg.io/user/nginx (nothing changed)
If `registryOverride` set, example:
nginx --> ${registryOverride}/nginx (add ${registryOverride} prefix) reg.io/nginx --> ${registryOverride}/nginx (set registry ${registryOverride}) reg.io/user/nginx --> ${registryOverride}/user/nginx (same as above)
func CopySystemContext ¶ added in v1.7.0
func CopySystemContext(src *types.SystemContext) *types.SystemContext
func DecodeBase64 ¶
func DeleteIfExist ¶
func EnsureDirExists ¶
func EnsureSemverValid ¶
func GetAbsPath ¶
func GetImageName ¶ added in v1.5.0
GetImageName gets the image name, example:
nginx:latest -> nginx reg.io/nginx:latest -> nginx library/nginx:latest -> nginx reg.io/library/nginx -> nginx
func GetImageTag ¶ added in v1.7.0
GetImageTag gets the image tag, example:
nginx:latest -> latest reg.io/nginx:1.22 -> 1.22 library/nginx -> latest reg.io/library/nginx -> latest
func GetProjectName ¶
GetProjectName gets the project name of the image, example:
nginx -> "library" docker.io/nginx -> "library" library/nginx -> "library" docker.io/library/nginx -> "library"
func GetRegistryName ¶
GetRegistryName gets the registry name of the image, example:
nginx -> docker.io reg.io/nginx -> reg.io library/nginx -> docker.io reg.io/library/nginx -> reg.io
func IsDirEmpty ¶
func PrintObject ¶ added in v1.7.0
func ReplaceProjectName ¶
ReplaceProjectName will replace the image project name:
If `project` is empty string, the project name will be removed:
nginx --> nginx (nothing changed) reg.io/nginx --> reg.io/nginx (nothing changed) user/nginx --> nginx (remove project name) reg.io/user/nginx --> reg.io/nginx (remove project name)
If `project` set, example:
nginx --> ${project}/nginx (add project name) user/nginx --> ${project}/nginx (replace project name) reg.io/nginx --> reg.io/${project}/nginx reg.io/user/nginx --> reg.io/${project}/nginx
func SemverCompare ¶
SemverCompare compares two semvers
func SemverMajorEqual ¶
func SemverMajorMinorEqual ¶
func SystemContextWithSharedBlobDir ¶ added in v1.7.0
func SystemContextWithSharedBlobDir(sysctx *types.SystemContext, dir string) *types.SystemContext
func SystemContextWithTlsVerify ¶
func SystemContextWithTlsVerify(sysctx *types.SystemContext, tlsVerify bool) *types.SystemContext
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.