Documentation
¶
Index ¶
- Constants
- func ConvertAnsibleImageKey(ansibleImageKey string) string
- func DecompressGzipFile(gzipPath string, outputPath string) error
- func EnsureStringKeys(input interface{}) interface{}
- func ExtractFirstFileFromTarGz(tarGzPath, destDir string) (string, error)
- func ExtractHash(image string) string
- func ExtractHashes(images []string) []string
- func FileFromImage(ctx context.Context, imageName, filePath, outputPath string) error
- func GetAnsibleCollectionArchiveFromImage(ctx context.Context, imageName string) ([]byte, error)
- func GetAnsibleImageKeysFromConfig(defaultsYaml []byte) ([]string, []string, error)
- func GetEnv(key string) string
- func GetEnvAsSecret(key string) string
- func GetFileContent(filePath string) ([]byte, error)
- func GetImageLabel(imageDefinition, labelName string) (string, error)
- func GetMapKeys[V any](m map[string]V) []string
- func GetMapKeysSorted[V any](m map[string]V) []string
- func GetMapValues(m map[string]string) []string
- func GetTestConfigContent() ([]byte, error)
- func InspectImageForLabels(imageDefinition string) (map[string]string, error)
- func IsBeforeVersion(testedVersion string) bool
- func IsVersion(testedVersion string) bool
- func LoadAnsibleCollectionFromImage(ctx context.Context, imageRef, ansibleImagesFile string) ([]byte, error)
- func LogArray(message string, data []string)
- func LogMap[V any](message string, data map[string]V)
- func LogMapByProvidedKeys[V any](message string, data map[string]V, keysToLog []string)
- func MergeDefaultsConfig(baseDefaults, fileContent []byte) ([]byte, error)
- func ParseOperatorImages(helpContent string, otherKeys []string) (OperatorMap, OperatorMap)
- func ParsePCOperatorImages(valuesFile string) (OperatorMap, OperatorMap)
- func PullImageIfNotPresentLocally(ctx context.Context, imageDefinition string) error
- func RequiredImageLabels() map[string]string
- func ResolveManifestListForPlatform(ctx context.Context, imageRef, platform string) (string, error)
- func RunImage(imageDefinition string, entrypoint, commands []string) (string, error)
- func SplitMap(original map[string]string, keysToKeep []string) (map[string]string, map[string]string)
- func SuiteLevelMap(data []byte) (map[string]interface{}, error)
- type AnsibleMap
- type ImageData
- type OSArchMatrix
- type OperatorMap
- type Repository
- type RepositoryList
- type SnapshotData
Constants ¶
const ( EnvReleasesSnapshotFile = "SNAPSHOT" EnvRepositoriesFile = "REPOSITORIES" EnvTestGithubToken = "TEST_GITHUB_TOKEN" // #nosec G101 EnvVersion = "VERSION" EnvTestConfig = "TEST_CONFIG" OperatorImageKey = "rhtas-operator-image" OperatorBundleImageKey = "rhtas-operator-bundle-image" AnsibleCollectionImageKey = "artifact-signer-ansible.collection.image" AnsibleCollectionPathInImage = "/releases" AnsibleCollectionSnapshotFile = "roles/tas_single_node/defaults/main.yml" TasImageDefinitionRegexp = `^registry.redhat.io/rhtas/[\w/-]+@sha256:\w{64}$` OtherImageDefinitionRegexp = `^(registry.redhat.io|registry.access.redhat.com)` SnapshotImageDefinitionRegexp = `^[\.\w/-]+@sha256:\w{64}$` DefaultRepositoriesFile = "testdata/repositories.json" )
Variables ¶
This section is empty.
Functions ¶
func ConvertAnsibleImageKey ¶
func DecompressGzipFile ¶
DecompressGzipFile decompresses a Gzip file and writes the decompressed content to a specified output file.
func EnsureStringKeys ¶
func EnsureStringKeys(input interface{}) interface{}
EnsureStringKeys converts map[interface{}]interface{} to map[string]interface{} recursively so yaml.Marshal produces correct keys (e.g. catalogPath) when decoding from parsed YAML.
func ExtractFirstFileFromTarGz ¶
ExtractFirstFileFromTarGz opens a .tar.gz file and extracts the first regular file it finds into destDir, returning the path to the extracted file.
func ExtractHash ¶
func ExtractHashes ¶
func FileFromImage ¶
func GetAnsibleCollectionArchiveFromImage ¶
GetAnsibleCollectionArchiveFromImage copies /releases from the image, finds redhat-artifact_signer*.tar.gz in the tar stream, and returns its content.
func GetAnsibleImageKeysFromConfig ¶
GetAnsibleImageKeysFromConfig returns ansible imageKeys and otherImageKeys (ansible.imageKeys, ansible.otherImageKeys).
func GetEnvAsSecret ¶
func GetFileContent ¶
func GetImageLabel ¶
func GetMapKeys ¶
func GetMapKeysSorted ¶
func GetMapValues ¶
func GetTestConfigContent ¶
GetTestConfigContent returns the content of the file pointed to by TEST_CONFIG when set. Returns (nil, nil) when TEST_CONFIG is empty. Callers should use embedded defaults when nil. This allows the config file to override embedded defaults for operator keys, ansible keys, and FBC.
func InspectImageForLabels ¶
func IsBeforeVersion ¶
func LoadAnsibleCollectionFromImage ¶
func LoadAnsibleCollectionFromImage(ctx context.Context, imageRef, ansibleImagesFile string) ([]byte, error)
LoadAnsibleCollectionFromImage extracts the collection archive from the image at /releases/redhat-artifact_signer-*.tar.gz and returns the content of the given file inside that archive (e.g. roles/tas_single_node/defaults/main.yml).
func LogMapByProvidedKeys ¶
func MergeDefaultsConfig ¶
MergeDefaultsConfig overlays fileContent on top of baseDefaults. Both may use package wrapper (rhtas:) or suite-level (operator, ansible, fbc). Result is always suite-level. Keys in fileContent override baseDefaults.
func ParseOperatorImages ¶
func ParseOperatorImages(helpContent string, otherKeys []string) (OperatorMap, OperatorMap)
ParseOperatorImages parses operator help output into TAS and other image maps. otherKeys is the list of image keys that belong to "other" (e.g. from otherOperatorImageKeys in config).
func ParsePCOperatorImages ¶
func ParsePCOperatorImages(valuesFile string) (OperatorMap, OperatorMap)
func RequiredImageLabels ¶
If no value is provided, the label must exist, but can have any non-empty value.
func SuiteLevelMap ¶
SuiteLevelMap returns config with operator/ansible/fbc at top level. If the root has a "rhtas" key (package wrapper), returns that inner map; otherwise returns root.
Types ¶
type AnsibleMap ¶
func MapAnsibleImages ¶
func MapAnsibleImages(ansibleDefinitionFileContent []byte) (AnsibleMap, error)
func (*AnsibleMap) UnmarshalYAML ¶
func (data *AnsibleMap) UnmarshalYAML(value *yaml.Node) error
type OSArchMatrix ¶
func GetOSArchMatrix ¶
func GetOSArchMatrix() OSArchMatrix
type OperatorMap ¶
type Repository ¶
type RepositoryList ¶
type RepositoryList struct {
Data []Repository `json:"data"`
}
func LoadRepositoryList ¶
func LoadRepositoryList() (*RepositoryList, error)
func (*RepositoryList) FindByImage ¶
func (r *RepositoryList) FindByImage(image string) *Repository
type SnapshotData ¶
func ParseSnapshotData ¶
func ParseSnapshotData() (SnapshotData, error)
func (*SnapshotData) UnmarshalJSON ¶
func (data *SnapshotData) UnmarshalJSON(b []byte) error