Documentation ¶
Index ¶
- Constants
- func CompareFiles(t *testing.T, path1, path2 string)
- func CompleteImageRef(ref string) string
- func ExtractDigest(t *testing.T, out string) string
- func GetDockerHubRegistry() string
- type Assertion
- func (a *Assertion) AssertBundleLock(path, expectedBundleRef, expectedTag string)
- func (a *Assertion) AssertImagesLock(path string, images []lockconfig.ImageRef)
- func (a *Assertion) ImagesDigestIsOnTar(tarFilePath string, imagesDigestRef ...string)
- func (a *Assertion) ValidateCosignSignature(refs []string)
- func (a *Assertion) ValidateImagesPresenceInRegistry(refs []string) error
- type Assets
- func (a *Assets) AddFileToFolder(path, content string)
- func (a *Assets) AddFileToFolderWithPermissions(path, content string, perm os.FileMode)
- func (a *Assets) AddFolder(path string, perm os.FileMode)
- func (a *Assets) CleanCreatedFolders()
- func (a *Assets) CreateAndCopySimpleApp(prefix string) string
- func (a *Assets) CreateTempFolder(prefix string) string
- func (a Assets) FilesInFolder() []string
- func (a Assets) SimpleAppDir() string
- func (a *Assets) ValidateFilesAreEqual(expected, got string, fileToCheck []string)
- type BundleFactory
- type BundleInfo
- type Env
- type FakeTestRegistryBuilder
- func (r *FakeTestRegistryBuilder) Build() registry.Registry
- func (r *FakeTestRegistryBuilder) BuildWithRegistryOpts(opts registry.Opts) registry.Registry
- func (r *FakeTestRegistryBuilder) CleanUp()
- func (r *FakeTestRegistryBuilder) CopyAllImagesFromRepo(imageRef, to string)
- func (r *FakeTestRegistryBuilder) CopyBundleImage(bundleInfo BundleInfo, to string) BundleInfo
- func (r *FakeTestRegistryBuilder) CopyFromImageRef(imageRef, to string) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) CopyImage(img ImageOrImageIndexWithTarPath, to string) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) Host() string
- func (r *FakeTestRegistryBuilder) IsConfigBlobLayer(digest v1.Hash) bool
- func (r *FakeTestRegistryBuilder) Layer(digest v1.Hash) (v1.Layer, error)
- func (r *FakeTestRegistryBuilder) ProcessedImages() *imageset.ProcessedImages
- func (r *FakeTestRegistryBuilder) ReferenceOnTestServer(repo string) string
- func (r *FakeTestRegistryBuilder) RemoveByImageRef(imageRef string)
- func (r *FakeTestRegistryBuilder) RemoveImage(imageRef string)
- func (r *FakeTestRegistryBuilder) ResetHandler() *FakeTestRegistryBuilder
- func (r *FakeTestRegistryBuilder) Tag(imageRef, tag string)
- func (r *FakeTestRegistryBuilder) WithARandomImageIndex(imageName string, numImages int64) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) WithBasicAuth(username string, password string)
- func (r *FakeTestRegistryBuilder) WithBasicAuthPerRepository(repo, username, password string)
- func (r *FakeTestRegistryBuilder) WithBundleFromPath(bundleName string, path string) BundleInfo
- func (r *FakeTestRegistryBuilder) WithCustomHandler(handler func(http.ResponseWriter, *http.Request) bool)
- func (r *FakeTestRegistryBuilder) WithHandlerFunc(handler func(writer http.ResponseWriter, request *http.Request) bool)
- func (r *FakeTestRegistryBuilder) WithIdentityToken(idToken string)
- func (r *FakeTestRegistryBuilder) WithImage(imageNameFromTest string, image v1.Image) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) WithImageFromPath(imageNameFromTest string, path string, labels map[string]string) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) WithImageIndex(imageIndexName string, images ...mutate.Appendable) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) WithImageStatusCodeRemap(img string, originalStatusCode int, remappedStatusCode int) *FakeTestRegistryBuilder
- func (r *FakeTestRegistryBuilder) WithImmutableTags(repo string, imgTag string) *FakeTestRegistryBuilder
- func (r *FakeTestRegistryBuilder) WithLocationsImage(bundleRef string, tmpFolder string, config bundle.ImageLocationsConfig) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) WithNonDistributableLayerInImage(imageNames ...string)
- func (r *FakeTestRegistryBuilder) WithRandomBundle(bundleName string) BundleInfo
- func (r *FakeTestRegistryBuilder) WithRandomBundleAndImages(bundleName string, imageRefs []lockconfig.ImageRef) BundleInfo
- func (r *FakeTestRegistryBuilder) WithRandomImage(imageNameFromTest string) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) WithRandomImageWithLayers(imageNameFromTest string, n int64) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) WithRandomTaggedImage(imageNameFromTest, tag string) *ImageOrImageIndexWithTarPath
- func (r *FakeTestRegistryBuilder) WithRegistryToken(regToken string)
- func (r *FakeTestRegistryBuilder) WithRequestLogging() *HTTPRequestLogs
- type HTTPRequestLog
- type HTTPRequestLogs
- type ImageFactory
- func (i *ImageFactory) Download(imgRef, location string)
- func (i *ImageFactory) GetImageLayersDigest(image string) []string
- func (i *ImageFactory) ImageDigest(imgRef string) string
- func (i *ImageFactory) PushImageIndex(imgRef string)
- func (i *ImageFactory) PushImageWithANonDistributableLayer(imgRef string, mediaType types.MediaType) string
- func (i *ImageFactory) PushImageWithLayerSize(imgRef string, size int64) string
- func (i *ImageFactory) PushSimpleAppImageWithRandomFile(imgpkg Imgpkg, imgRef string) string
- func (i *ImageFactory) PushSimpleAppImageWithRandomFileWithAuth(imgpkg Imgpkg, imgRef string, host, username, password string) string
- func (i *ImageFactory) SignImage(imgRef string) string
- type ImageOrImageIndexWithTarPath
- type Imgpkg
- type LogLevel
- type Logger
- func (l Logger) Debugf(msg string, args ...interface{})
- func (l Logger) Errorf(msg string, args ...interface{})
- func (l Logger) Logf(msg string, args ...interface{})
- func (l Logger) Section(msg string, f func())
- func (l Logger) Tracef(msg string, args ...interface{})
- func (l Logger) Warnf(msg string, args ...interface{})
- type RunOpts
Constants ¶
const BundleFile = "bundle.yml"
const BundleYAML = `` /* 152-byte string literal not displayed */
const ImageFile = "images.yml"
const ImagesYAML = `---
apiVersion: imgpkg.carvel.dev/v1alpha1
kind: ImagesLock
`
Variables ¶
This section is empty.
Functions ¶
func CompareFiles ¶
func CompleteImageRef ¶
CompleteImageRef returns image reference
func GetDockerHubRegistry ¶
func GetDockerHubRegistry() string
GetDockerHubRegistry returns dockerhub registry or proxy
Types ¶
type Assertion ¶
func (*Assertion) AssertBundleLock ¶
func (*Assertion) AssertImagesLock ¶
func (a *Assertion) AssertImagesLock(path string, images []lockconfig.ImageRef)
func (*Assertion) ImagesDigestIsOnTar ¶
func (*Assertion) ValidateCosignSignature ¶
func (*Assertion) ValidateImagesPresenceInRegistry ¶
type Assets ¶
func (*Assets) AddFileToFolder ¶
AddFileToFolder Adds a file to a folder with 0600 permission
func (*Assets) AddFileToFolderWithPermissions ¶
AddFileToFolderWithPermissions Adds a file to a folder and sets permissions
func (*Assets) CleanCreatedFolders ¶
func (a *Assets) CleanCreatedFolders()
func (*Assets) CreateAndCopySimpleApp ¶
func (*Assets) CreateTempFolder ¶
func (Assets) FilesInFolder ¶
func (Assets) SimpleAppDir ¶
func (*Assets) ValidateFilesAreEqual ¶
type BundleFactory ¶
type BundleFactory struct {
// contains filtered or unexported fields
}
func NewBundleDir ¶
func NewBundleDir(t *testing.T, assets *Assets) BundleFactory
func (*BundleFactory) AddFileToBundle ¶
func (b *BundleFactory) AddFileToBundle(path, content string)
func (*BundleFactory) CreateBundleDir ¶
func (b *BundleFactory) CreateBundleDir(bYml, iYml string) string
type BundleInfo ¶
type BundleInfo struct { Image v1.Image BundleName string BundlePath string Digest string RefDigest string Tag string // contains filtered or unexported fields }
func (BundleInfo) WithEveryImageFromPath ¶
func (b BundleInfo) WithEveryImageFromPath(path string, labels map[string]string) BundleInfo
func (BundleInfo) WithImageRefs ¶
func (b BundleInfo) WithImageRefs(imageRefs []lockconfig.ImageRef) BundleInfo
type Env ¶
type Env struct { Image string ImgpkgPath string RelocationRepo string BundleFactory BundleFactory Assets *Assets Assert Assertion ImageFactory ImageFactory Logger *Logger // contains filtered or unexported fields }
func (*Env) AddCleanup ¶
func (e *Env) AddCleanup(f func())
type FakeTestRegistryBuilder ¶
type FakeTestRegistryBuilder struct {
// contains filtered or unexported fields
}
func NewFakeRegistry ¶
func NewFakeRegistry(t *testing.T, logger *Logger) *FakeTestRegistryBuilder
NewFakeRegistry Creates a registry that uses the ggcr version
func NewFakeRegistryWithDiskBackend ¶
func NewFakeRegistryWithDiskBackend(t *testing.T, logger *Logger) *FakeTestRegistryBuilder
NewFakeRegistryWithDiskBackend Creates a registry that saves blobs to disk
func NewFakeRegistryWithRepoSeparation ¶
func NewFakeRegistryWithRepoSeparation(t *testing.T, logger *Logger) *FakeTestRegistryBuilder
NewFakeRegistryWithRepoSeparation Creates a registry that saves the blobs based on the repository
func (*FakeTestRegistryBuilder) Build ¶
func (r *FakeTestRegistryBuilder) Build() registry.Registry
func (*FakeTestRegistryBuilder) BuildWithRegistryOpts ¶
func (r *FakeTestRegistryBuilder) BuildWithRegistryOpts(opts registry.Opts) registry.Registry
BuildWithRegistryOpts Builds registry with provided Registry Opts
func (*FakeTestRegistryBuilder) CleanUp ¶
func (r *FakeTestRegistryBuilder) CleanUp()
func (*FakeTestRegistryBuilder) CopyAllImagesFromRepo ¶
func (r *FakeTestRegistryBuilder) CopyAllImagesFromRepo(imageRef, to string)
CopyAllImagesFromRepo Copies all images in a particular repository to a destination
func (*FakeTestRegistryBuilder) CopyBundleImage ¶
func (r *FakeTestRegistryBuilder) CopyBundleImage(bundleInfo BundleInfo, to string) BundleInfo
CopyBundleImage Copies a bundle metadata that will create a bundle in to location
func (*FakeTestRegistryBuilder) CopyFromImageRef ¶
func (r *FakeTestRegistryBuilder) CopyFromImageRef(imageRef, to string) *ImageOrImageIndexWithTarPath
func (*FakeTestRegistryBuilder) CopyImage ¶
func (r *FakeTestRegistryBuilder) CopyImage(img ImageOrImageIndexWithTarPath, to string) *ImageOrImageIndexWithTarPath
func (*FakeTestRegistryBuilder) Host ¶
func (r *FakeTestRegistryBuilder) Host() string
func (*FakeTestRegistryBuilder) IsConfigBlobLayer ¶
func (r *FakeTestRegistryBuilder) IsConfigBlobLayer(digest v1.Hash) bool
IsConfigBlobLayer checks if digest is from configuration blob
func (*FakeTestRegistryBuilder) Layer ¶
Layer retrieves a layer from images At this point the function does *NOT* search on Indexes
func (*FakeTestRegistryBuilder) ProcessedImages ¶
func (r *FakeTestRegistryBuilder) ProcessedImages() *imageset.ProcessedImages
ProcessedImages returns the images that where created in the registry
func (*FakeTestRegistryBuilder) ReferenceOnTestServer ¶
func (r *FakeTestRegistryBuilder) ReferenceOnTestServer(repo string) string
func (*FakeTestRegistryBuilder) RemoveByImageRef ¶
func (r *FakeTestRegistryBuilder) RemoveByImageRef(imageRef string)
RemoveByImageRef This function only works as expected before running Build() Prevents the creation in the registry of the image provided
func (*FakeTestRegistryBuilder) RemoveImage ¶
func (r *FakeTestRegistryBuilder) RemoveImage(imageRef string)
func (*FakeTestRegistryBuilder) ResetHandler ¶
func (r *FakeTestRegistryBuilder) ResetHandler() *FakeTestRegistryBuilder
func (*FakeTestRegistryBuilder) Tag ¶
func (r *FakeTestRegistryBuilder) Tag(imageRef, tag string)
Tag the referenced image
func (*FakeTestRegistryBuilder) WithARandomImageIndex ¶
func (r *FakeTestRegistryBuilder) WithARandomImageIndex(imageName string, numImages int64) *ImageOrImageIndexWithTarPath
WithARandomImageIndex Creates random index with reference imageName and with numImages images
func (*FakeTestRegistryBuilder) WithBasicAuth ¶
func (r *FakeTestRegistryBuilder) WithBasicAuth(username string, password string)
func (*FakeTestRegistryBuilder) WithBasicAuthPerRepository ¶
func (r *FakeTestRegistryBuilder) WithBasicAuthPerRepository(repo, username, password string)
WithBasicAuthPerRepository Adds authentication check for a particular repository
func (*FakeTestRegistryBuilder) WithBundleFromPath ¶
func (r *FakeTestRegistryBuilder) WithBundleFromPath(bundleName string, path string) BundleInfo
WithBundleFromPath Creates bundle from the provided path
func (*FakeTestRegistryBuilder) WithCustomHandler ¶
func (r *FakeTestRegistryBuilder) WithCustomHandler(handler func(http.ResponseWriter, *http.Request) bool)
WithCustomHandler Adds the provided http handler that will be called before the default one If the provided handler returns true it means that no further processing is needed. this will skip any further handlers
func (*FakeTestRegistryBuilder) WithHandlerFunc ¶
func (r *FakeTestRegistryBuilder) WithHandlerFunc(handler func(writer http.ResponseWriter, request *http.Request) bool)
WithHandlerFunc Adds authentication check for a particular repository
func (*FakeTestRegistryBuilder) WithIdentityToken ¶
func (r *FakeTestRegistryBuilder) WithIdentityToken(idToken string)
func (*FakeTestRegistryBuilder) WithImage ¶
func (r *FakeTestRegistryBuilder) WithImage(imageNameFromTest string, image v1.Image) *ImageOrImageIndexWithTarPath
func (*FakeTestRegistryBuilder) WithImageFromPath ¶
func (r *FakeTestRegistryBuilder) WithImageFromPath(imageNameFromTest string, path string, labels map[string]string) *ImageOrImageIndexWithTarPath
func (*FakeTestRegistryBuilder) WithImageIndex ¶
func (r *FakeTestRegistryBuilder) WithImageIndex(imageIndexName string, images ...mutate.Appendable) *ImageOrImageIndexWithTarPath
func (*FakeTestRegistryBuilder) WithImageStatusCodeRemap ¶
func (r *FakeTestRegistryBuilder) WithImageStatusCodeRemap(img string, originalStatusCode int, remappedStatusCode int) *FakeTestRegistryBuilder
func (*FakeTestRegistryBuilder) WithImmutableTags ¶
func (r *FakeTestRegistryBuilder) WithImmutableTags(repo string, imgTag string) *FakeTestRegistryBuilder
func (*FakeTestRegistryBuilder) WithLocationsImage ¶
func (r *FakeTestRegistryBuilder) WithLocationsImage(bundleRef string, tmpFolder string, config bundle.ImageLocationsConfig) *ImageOrImageIndexWithTarPath
func (*FakeTestRegistryBuilder) WithNonDistributableLayerInImage ¶
func (r *FakeTestRegistryBuilder) WithNonDistributableLayerInImage(imageNames ...string)
WithNonDistributableLayerInImage Adds non-distributable layer of the type types.OCIUncompressedRestrictedLayer to all the provided images
func (*FakeTestRegistryBuilder) WithRandomBundle ¶
func (r *FakeTestRegistryBuilder) WithRandomBundle(bundleName string) BundleInfo
WithRandomBundle sample function This function creates a bundle image, but WithImageRefs or WithEveryImageFromPath needs to be called on the return value of this function to ensure that a bundle is correctly created on the registry
func (*FakeTestRegistryBuilder) WithRandomBundleAndImages ¶
func (r *FakeTestRegistryBuilder) WithRandomBundleAndImages(bundleName string, imageRefs []lockconfig.ImageRef) BundleInfo
WithRandomBundleAndImages creates a random bundle image with the provided images
func (*FakeTestRegistryBuilder) WithRandomImage ¶
func (r *FakeTestRegistryBuilder) WithRandomImage(imageNameFromTest string) *ImageOrImageIndexWithTarPath
WithRandomImage adds a new random image with 3 layers
func (*FakeTestRegistryBuilder) WithRandomImageWithLayers ¶
func (r *FakeTestRegistryBuilder) WithRandomImageWithLayers(imageNameFromTest string, n int64) *ImageOrImageIndexWithTarPath
WithRandomImageWithLayers adds a new random image with n number of layers provided
func (*FakeTestRegistryBuilder) WithRandomTaggedImage ¶
func (r *FakeTestRegistryBuilder) WithRandomTaggedImage(imageNameFromTest, tag string) *ImageOrImageIndexWithTarPath
WithRandomTaggedImage Creates a random image with a tag
func (*FakeTestRegistryBuilder) WithRegistryToken ¶
func (r *FakeTestRegistryBuilder) WithRegistryToken(regToken string)
func (*FakeTestRegistryBuilder) WithRequestLogging ¶
func (r *FakeTestRegistryBuilder) WithRequestLogging() *HTTPRequestLogs
WithRequestLogging enables the logging of the HTTP requests sent to the registry
type HTTPRequestLog ¶
HTTPRequestLog Log entry for HTTP requests sent to the registry
type HTTPRequestLogs ¶
type HTTPRequestLogs struct {
// contains filtered or unexported fields
}
HTTPRequestLogs Slice of HTTP Requests
func NewHTTPRequestLogs ¶
func NewHTTPRequestLogs() *HTTPRequestLogs
NewHTTPRequestLogs Build a new HTTPRequestLogs struct
func (*HTTPRequestLogs) Add ¶
func (h *HTTPRequestLogs) Add(request HTTPRequestLog)
Add new HTTP Request to the Log
func (*HTTPRequestLogs) Last ¶
func (h *HTTPRequestLogs) Last() HTTPRequestLog
Last Retrieve Last HTTP Request
type ImageFactory ¶
func (*ImageFactory) Download ¶
func (i *ImageFactory) Download(imgRef, location string)
func (*ImageFactory) GetImageLayersDigest ¶ added in v0.40.0
func (i *ImageFactory) GetImageLayersDigest(image string) []string
GetImageLayersDigest will return image's layers digest
func (*ImageFactory) ImageDigest ¶
func (i *ImageFactory) ImageDigest(imgRef string) string
func (*ImageFactory) PushImageIndex ¶
func (i *ImageFactory) PushImageIndex(imgRef string)
func (*ImageFactory) PushImageWithANonDistributableLayer ¶
func (i *ImageFactory) PushImageWithANonDistributableLayer(imgRef string, mediaType types.MediaType) string
func (*ImageFactory) PushImageWithLayerSize ¶
func (i *ImageFactory) PushImageWithLayerSize(imgRef string, size int64) string
func (*ImageFactory) PushSimpleAppImageWithRandomFile ¶
func (i *ImageFactory) PushSimpleAppImageWithRandomFile(imgpkg Imgpkg, imgRef string) string
func (*ImageFactory) PushSimpleAppImageWithRandomFileWithAuth ¶
func (i *ImageFactory) PushSimpleAppImageWithRandomFileWithAuth(imgpkg Imgpkg, imgRef string, host, username, password string) string
func (*ImageFactory) SignImage ¶
func (i *ImageFactory) SignImage(imgRef string) string
type ImageOrImageIndexWithTarPath ¶
type ImageOrImageIndexWithTarPath struct { Image v1.Image ImageIndex v1.ImageIndex RefDigest string Digest string Tag string // contains filtered or unexported fields }
func (*ImageOrImageIndexWithTarPath) WithNonDistributableLayer ¶
func (r *ImageOrImageIndexWithTarPath) WithNonDistributableLayer() (*ImageOrImageIndexWithTarPath, v1.Layer)
WithNonDistributableLayer Adds non-distributable layer of the type types.OCIUncompressedRestrictedLayer to the current image
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package registry implements a docker V2 registry and the OCI distribution specification.
|
Package registry implements a docker V2 registry and the OCI distribution specification. |
httptest
Package httptest provides a method for testing a TLS server a la net/http/httptest.
|
Package httptest provides a method for testing a TLS server a la net/http/httptest. |