transform

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Package transform provides helper functions to transform URLs to airgap equivalents

Package transform provides helper functions to transform URLs to airgap equivalents

Package transform provides helper functions to transform URLs to airgap equivalents

Index

Constants

View Source
const (
	// NoTransform is the URL prefix added to HTTP 3xx or text URLs that instructs Zarf not to transform on a subsequent request.
	NoTransform = "/zarf-3xx-no-transform"
)

Variables

This section is empty.

Functions

func GenTransformURL

func GenTransformURL(targetBaseURL string, sourceURL string) (*url.URL, error)

GenTransformURL finds the generic API path on a given URL and transforms that to align with the offline registry.

func GitURL

func GitURL(targetBaseURL string, sourceURL string, pushUser string) (*url.URL, error)

GitURL takes a base URL, a source url and a username and returns a Zarf-compatible url.

func GitURLSplitRef

func GitURLSplitRef(sourceURL string) (string, string, error)

GitURLSplitRef takes a git url and returns a separated source url and zarf reference.

func GitURLtoFolderName

func GitURLtoFolderName(sourceURL string) (string, error)

GitURLtoFolderName takes a git url and returns the folder name for the repo in the Zarf package.

func GitURLtoRepoName

func GitURLtoRepoName(sourceURL string) (string, error)

GitURLtoRepoName takes a git url and returns the name of the repo in the remote airgap repository.

func ImageTransformHost

func ImageTransformHost(targetHost, srcReference string) (string, error)

ImageTransformHost replaces the base url for an image and adds a crc32 of the original url to the end of the src (note image refs are not full URLs).

func ImageTransformHostWithoutChecksum

func ImageTransformHostWithoutChecksum(targetHost, srcReference string) (string, error)

ImageTransformHostWithoutChecksum replaces the base url for an image but avoids adding a checksum of the original url (note image refs are not full URLs).

func MutateGitURLsInText

func MutateGitURLsInText(logger Log, targetBaseURL string, text string, pushUser string) string

MutateGitURLsInText changes the gitURL hostname to use the repository Zarf is configured to use.

func NoTransformTarget

func NoTransformTarget(address string, path string) (*url.URL, error)

NoTransformTarget takes an address that Zarf should not transform, and removes the NoTransform prefix.

func NpmTransformURL

func NpmTransformURL(targetBaseURL string, sourceURL string) (*url.URL, error)

NpmTransformURL finds the npm API path on a given URL and transforms that to align with the offline registry.

func PipTransformURL

func PipTransformURL(targetBaseURL string, sourceURL string) (*url.URL, error)

PipTransformURL finds the pip API path on a given URL and transforms that to align with the offline registry.

Types

type Image

type Image struct {
	Host        string
	Name        string
	Path        string
	Tag         string
	Digest      string
	Reference   string
	TagOrDigest string
}

Image represents a config for an OCI image.

func ParseImageRef

func ParseImageRef(srcReference string) (Image, error)

ParseImageRef parses a source reference into an Image struct

type Log

type Log func(string, ...any)

Log is a function that logs a message.

Jump to

Keyboard shortcuts

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