support

package
v0.0.0-...-3b51e81 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvReleasesSnapshotFile = "SNAPSHOT"
	EnvRepositoriesFile     = "REPOSITORIES"
	EnvTestGithubToken      = "TEST_GITHUB_TOKEN" // #nosec G101
	EnvVersion              = "VERSION"
	EnvTestConfig           = "TEST_CONFIG"

	PolicyControllerOperatorImageKey       = "policy-controller-operator-image"
	PolicyControllerOperatorBundleImageKey = "policy-controller-operator-bundle-image"
	ModelValidationOperatorImageKey        = "model-validation-operator-image"
	ModelValidationOperatorBundleImageKey  = "model-validation-operator-bundle-image"
	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"
	OperatorBundleClusterServiceVersionFile                 = "rhtas-operator.clusterserviceversion.yaml"
	PolicyControllerOperatorBundleClusterServiceVersionFile = "policy-controller-operator.clusterserviceversion.yaml"
	ModelValidationOperatorBundleClusterServiceVersionFile  = "model-validation-operator.clusterserviceversion.yaml"
	OperatorBundleClusterServiceVersionPath                 = "manifests/" + OperatorBundleClusterServiceVersionFile
	PolicyControllerOperatorBundleClusterServiceVersionPath = "manifests/" + PolicyControllerOperatorBundleClusterServiceVersionFile
	ModelValidationOperatorBundleClusterServiceVersionPath  = "manifests/" + ModelValidationOperatorBundleClusterServiceVersionFile

	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 ConvertAnsibleImageKey(ansibleImageKey string) string

func DecompressGzipFile

func DecompressGzipFile(gzipPath string, outputPath string) error

DecompressGzipFile decompresses a Gzip file and writes the decompressed content to a specified output file.

func ExtractFirstFileFromTarGz

func ExtractFirstFileFromTarGz(tarGzPath, destDir string) (string, error)

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 ExtractHash(image string) string

func ExtractHashes

func ExtractHashes(images []string) []string

func FileFromImage

func FileFromImage(ctx context.Context, imageName, filePath, outputPath string) error

func GetAnsibleCollectionArchiveFromImage

func GetAnsibleCollectionArchiveFromImage(ctx context.Context, imageName string) ([]byte, error)

GetAnsibleCollectionArchiveFromImage copies /releases from the image, finds redhat-artifact_signer*.tar.gz in the tar stream, and returns its content.

func GetAnsibleImageKeysFromConfig

func GetAnsibleImageKeysFromConfig(defaultsYaml []byte) ([]string, []string, error)

GetAnsibleImageKeysFromConfig returns ansible imageKeys and otherImageKeys (ansible.imageKeys, ansible.otherImageKeys).

func GetEnv

func GetEnv(key string) string

func GetEnvAsSecret

func GetEnvAsSecret(key string) string

func GetFileContent

func GetFileContent(filePath string) ([]byte, error)

func GetImageLabel

func GetImageLabel(imageDefinition, labelName string) (string, error)

func GetMapKeys

func GetMapKeys[V any](m map[string]V) []string

func GetMapKeysSorted

func GetMapKeysSorted[V any](m map[string]V) []string

func GetMapValues

func GetMapValues(m map[string]string) []string

func GetOperatorImageKeysFromConfig

func GetOperatorImageKeysFromConfig(defaultsYaml []byte) ([]string, error)

GetOperatorImageKeysFromConfig returns the TAS operator image key list (operator.imageKeys).

func GetOperatorOtherImageKeysFromConfig

func GetOperatorOtherImageKeysFromConfig(defaultsYaml []byte) ([]string, error)

GetOperatorOtherImageKeysFromConfig returns the other operator image key list (operator.otherImageKeys).

func GetTestConfigContent

func GetTestConfigContent() ([]byte, error)

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 InspectImageForLabels(imageDefinition string) (map[string]string, error)

func IsBeforeVersion

func IsBeforeVersion(testedVersion string) bool

func IsVersion

func IsVersion(testedVersion string) bool

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 LogArray

func LogArray(message string, data []string)

func LogMap

func LogMap[V any](message string, data map[string]V)

func LogMapByProvidedKeys

func LogMapByProvidedKeys[V any](message string, data map[string]V, keysToLog []string)

func MandatoryMvoOperatorImageKeys

func MandatoryMvoOperatorImageKeys() []string

func MandatoryPcoOperatorImageKeys

func MandatoryPcoOperatorImageKeys() []string

func MergeRhtasConfig

func MergeRhtasConfig(baseDefaults, fileContent []byte) ([]byte, error)

MergeRhtasConfig 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 OtherPCOOperatorImageKeys

func OtherPCOOperatorImageKeys() []string

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 PullImageIfNotPresentLocally

func PullImageIfNotPresentLocally(ctx context.Context, imageDefinition string) error

func RequiredImageLabels

func RequiredImageLabels() map[string]string

If no value is provided, the label must exist, but can have any non-empty value.

func ResolveManifestListForPlatform

func ResolveManifestListForPlatform(ctx context.Context, imageRef, platform string) (string, error)

func RunImage

func RunImage(imageDefinition string, entrypoint, commands []string) (string, error)

func SplitMap

func SplitMap(original map[string]string, keysToKeep []string) (map[string]string, map[string]string)

func SuiteLevelMap

func SuiteLevelMap(data []byte) (map[string]interface{}, error)

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

type AnsibleMap map[string]string

func MapAnsibleImages

func MapAnsibleImages(ansibleDefinitionFileContent []byte) (AnsibleMap, error)

func (*AnsibleMap) UnmarshalYAML

func (data *AnsibleMap) UnmarshalYAML(value *yaml.Node) error

type ImageData

type ImageData struct {
	Image  string
	Labels map[string]string
}

type OSArchMatrix

type OSArchMatrix map[string][]string

func GetOSArchMatrix

func GetOSArchMatrix() OSArchMatrix

type OperatorMap

type OperatorMap map[string]string

func ParseMVOperatorImages

func ParseMVOperatorImages(valuesFile string) OperatorMap

type Repository

type Repository struct {
	Name      string `json:"repository"`
	ID        string `json:"_id"` //nolint:tagliatelle
	Published bool   `json:"published"`
}

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

type SnapshotData struct {
	Images map[string]string
	Others map[string]string
}

func ParseSnapshotData

func ParseSnapshotData() (SnapshotData, error)

func (*SnapshotData) UnmarshalJSON

func (data *SnapshotData) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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