registry

package
v0.0.0-...-9da1c94 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: AGPL-3.0, AGPL-3.0-or-later Imports: 30 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src string, dst string) (err error)

CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist Symlinks are ignored and skipped.

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile credit https://gist.github.com/r0l1/92462b38df26839a3ca324697c8cba04

func Escape

func Escape(path string) string

Escape slashes in path variables

func MoveFile

func MoveFile(src string, dst string) (err error)

MoveFile use instead of os.Rename() to avoid issues moving a file whose source and destination paths are on different file systems or drive e.g. when running in Kubernetes by Tekton

func MoveFolderContent

func MoveFolderContent(srcFolder, dstFolder string) error

Types

type Api

type Api struct {
	// contains filtered or unexported fields
}

Api HTTP Registry API

func (*Api) DeletePackage

func (r *Api) DeletePackage(group, name, tag, user, pwd string, https bool) error

func (*Api) DeletePackageInfo

func (r *Api) DeletePackageInfo(group, name, packageId, user, pwd string, https bool) error

func (*Api) Download

func (r *Api) Download(group, name, filename, user, pwd string, isSeal, https bool) (string, error, int)

func (*Api) GetAllRepositoryInfo

func (r *Api) GetAllRepositoryInfo(user, pwd string, showWarnings bool) ([]Repository, error, int, bool)

func (*Api) GetDigest

func (r *Api) GetDigest(group, name, tag, user, pwd string, tls bool) (*DigestInfo, error, int)

func (*Api) GetPackageInfo

func (r *Api) GetPackageInfo(group, name, id, user, pwd string, https bool) (*Package, error)

func (*Api) GetRepositoryInfo

func (r *Api) GetRepositoryInfo(group, name, user, pwd string, https bool) (*Repository, error, int)

func (*Api) UploadPackage

func (r *Api) UploadPackage(name *core.PackageName, packageRef string, zipFile multipart.File, jsonFile multipart.File, metaInfo *Package, user string, pwd string, https bool, artHome string) error

func (*Api) UpsertPackageInfo

func (r *Api) UpsertPackageInfo(name *core.PackageName, pack *Package, user string, pwd string, https bool) error

type DigestInfo

type DigestInfo struct {
	Date  string `json:"date"`
	Value string `json:"value"`
}

type LocalRegistry

type LocalRegistry struct {
	Repositories []*Repository `json:"repositories"`
	ArtHome      string
}

LocalRegistry the default local registry implemented as a file system

func NewLocalRegistry

func NewLocalRegistry(artHome string) *LocalRegistry

NewLocalRegistry create a localRepo management structure

func (*LocalRegistry) Add

func (r *LocalRegistry) Add(filename string, name *core.PackageName, s *data.Seal) error

Add the package and seal to the LocalRegistry

func (*LocalRegistry) AllPackages

func (r *LocalRegistry) AllPackages() []string

func (*LocalRegistry) ExportPackage

func (r *LocalRegistry) ExportPackage(names []core.PackageName, sourceCreds, targetUri, targetCreds string) ([]string, error)

ExportPackage exports one or more packages as a tar archive to the target URI names: the slice of packages to save sourceCreds: the artisan registry credentials to pull the packages to save (in the format user:password) targetUri: the URI where the tar archive should be saved (could be S3 or file system) targetCreds: the credentials to connect to the targetUri (if it is authenticated S3 in the format user:password)

func (*LocalRegistry) FindPackageById

func (r *LocalRegistry) FindPackageById(id string) *Package

func (*LocalRegistry) FindPackageByName

func (r *LocalRegistry) FindPackageByName(name *core.PackageName) *Package

FindPackageByName return the package that matches the specified: - domain/group/name:tag nil if not found in the LocalRegistry

func (*LocalRegistry) FindPackageNamesById

func (r *LocalRegistry) FindPackageNamesById(id string) []*core.PackageName

FindPackageNamesById return the packages that matches the specified: - package id substring

func (*LocalRegistry) GetManifest

func (r *LocalRegistry) GetManifest(name *core.PackageName) *data.Manifest

func (*LocalRegistry) GetNetwork

func (r *LocalRegistry) GetNetwork(pkg *core.PackageName, functionName string) (*data.Network, error)

func (*LocalRegistry) GetPackagesByName

func (r *LocalRegistry) GetPackagesByName(name *core.PackageName) ([]*Package, bool)

GetPackagesByName return all the packages within the same repository

func (*LocalRegistry) GetSeal

func (r *LocalRegistry) GetSeal(name *Package) (*data.Seal, error)

func (*LocalRegistry) Import

func (r *LocalRegistry) Import(uri []string, creds string, v data.VerifyHandler, allowedAuthors []string, flags uint8) error

Import a package tar archive into the local registry uri: the uri of the package to import (can be file path or S3 bucket uri) creds: the credentials to connect to the endpoint if it is authenticated S3 in the format user:password localPath: if specified, it downloads the remote files to a target folder

func (*LocalRegistry) List

func (r *LocalRegistry) List(artHome string, extended bool)

List packages to stdout

func (*LocalRegistry) ListQ

func (r *LocalRegistry) ListQ()

ListQ list (quiet) package IDs only

func (*LocalRegistry) Load

func (r *LocalRegistry) Load() error

Load the content of the LocalRegistry

func (*LocalRegistry) Open

func (r *LocalRegistry) Open(name *core.PackageName, credentials string, targetPath string, v data.VerifyHandler, rh data.RunHandler, authorisedAuthors []string) error

func (*LocalRegistry) Prune

func (r *LocalRegistry) Prune() error

func (*LocalRegistry) Pull

func (r *LocalRegistry) Pull(name *core.PackageName, credentials string, showWarnings bool) (*Package, error)

func (*LocalRegistry) Push

func (r *LocalRegistry) Push(name *core.PackageName, credentials string, showWarnings bool) error

func (*LocalRegistry) Remove

func (r *LocalRegistry) Remove(names []string) error

func (*LocalRegistry) RemoveAll

func (r *LocalRegistry) RemoveAll() error

func (*LocalRegistry) Tag

func (r *LocalRegistry) Tag(srcName, tgtName string) error

Tag remove a given tag from an package

func (*LocalRegistry) UpdatePkgId

func (r *LocalRegistry) UpdatePkgId(name *core.PackageName, p *Package, s *data.Seal) error

Update Package Id based on Seal checksum

type Package

type Package struct {
	// a unique identifier for the package calculated as the checksum of the complete seal
	Id string `json:"id"`
	// the type of application in the package
	Type string `json:"type"`
	// the package actual file name
	FileRef string `json:"file_ref"`
	// the list of Tags associated with the package
	Tags []string `json:"tags"`
	// the size
	Size string `json:"size"`
	// the creation time
	Created string `json:"created"`
}

Package metadata for an Artisan package

func (*Package) HasTag

func (a *Package) HasTag(tag string) bool

HasTag determines if the package has the specified tag

func (*Package) IsDangling

func (a *Package) IsDangling() bool

func (*Package) RemoveTag

func (a *Package) RemoveTag(tag string) bool

RemoveTag removes a specified tag returns true if the tag was found and removed, otherwise false

func (*Package) String

func (a *Package) String() string

func (*Package) ToJson

func (a *Package) ToJson() (string, error)

type RemoteRegistry

type RemoteRegistry struct {
	ArtHome string `json:"-"`
	// contains filtered or unexported fields
}

RemoteRegistry enables admin operations on a remote registry

func NewRemoteRegistry

func NewRemoteRegistry(domain, user, pwd, artHome string) (*RemoteRegistry, error)

NewRemoteRegistry creates an object to manage a remote registry

func (*RemoteRegistry) GetDigest

func (r *RemoteRegistry) GetDigest(name *core.PackageName) (*DigestInfo, error, int)

GetDigest get the digest of the package in the remote registry

func (*RemoteRegistry) List

func (r *RemoteRegistry) List(quiet bool)

List all packages in the remote registry

func (*RemoteRegistry) RemoveByNameFilter

func (r *RemoteRegistry) RemoveByNameFilter(filter string, dryRun bool) error

RemoveByNameFilter remove one or more packages whose name matches the filter regex

func (*RemoteRegistry) RemoveByNameOrId

func (r *RemoteRegistry) RemoveByNameOrId(nameOrId []string) error

RemoveByNameOrId remove any package matching the passed in name or id

type RepoDiff

type RepoDiff struct {
	Added   []*Package
	Removed []*Package
	Updated []*UpdatedPackage
}

type Repository

type Repository struct {
	// the package repository (name without tag)
	Repository string `json:"repository"`
	// the reference name of the package corresponding to different builds
	Packages []*Package `json:"artefacts"`
}

func (*Repository) DeepCopy

func (r *Repository) DeepCopy() *Repository

DeepCopy creates a copy that is totally unrelated to the original entity

func (*Repository) Diff

func (r *Repository) Diff(repo *Repository) (*RepoDiff, error)

func (*Repository) FindPackage

func (r *Repository) FindPackage(id string) *Package

FindPackage find a package using its unique id

func (*Repository) FindPackageByRef

func (r *Repository) FindPackageByRef(ref string) *Package

func (*Repository) GetFileRef

func (r *Repository) GetFileRef(tag string) (string, error)

GetFileRef get the file reference for a specific tag

func (*Repository) GetTag

func (r *Repository) GetTag(tag string) (*Package, bool)

GetTag determines if the repository contains a package with the specified tag

func (*Repository) Group

func (r *Repository) Group() string

func (*Repository) IsDangling

func (r *Repository) IsDangling() bool

func (*Repository) Name

func (r *Repository) Name() string

func (*Repository) RemovePackage

func (r *Repository) RemovePackage(id string) error

func (*Repository) ToJsonBytes

func (r *Repository) ToJsonBytes() ([]byte, error)

func (*Repository) UpsertPackage

func (r *Repository) UpsertPackage(a *Package) (updated bool)

UpsertPackage updates the specified package information if exists, otherwise adds it to the repository returns true if the package info was updated or false if the package info was added

type UpdatedPackage

type UpdatedPackage struct {
	Package     *Package
	TagsAdded   []string
	TagsRemoved []string
}

Jump to

Keyboard shortcuts

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