Documentation ¶
Index ¶
- Constants
- type HasController
- func (h *HasController) ApplicationDeleted(application *appservice.Application) wait.ConditionFunc
- func (h *HasController) ApplicationDevfilePresent(application *appservice.Application) wait.ConditionFunc
- func (s *HasController) ApplicationGitopsRepoExists(devfileContent string) wait.ConditionFunc
- func (h *HasController) CheckForImageAnnotation(component *appservice.Component) wait.ConditionFunc
- func (h *HasController) ComponentDeleted(component *appservice.Component) wait.ConditionFunc
- func (h *HasController) ComponentReady(component *appservice.Component) wait.ConditionFunc
- func (h *HasController) CreateApplication(name string, namespace string) (*appservice.Application, error)
- func (h *HasController) CreateApplicationWithTimeout(name string, namespace string, timeout time.Duration) (*appservice.Application, error)
- func (h *HasController) CreateComponent(componentSpec appservice.ComponentSpec, namespace string, ...) (*appservice.Component, error)
- func (h *HasController) CreateComponentDetectionQuery(name string, namespace string, gitSourceURL string, gitSourceRevision string, ...) (*appservice.ComponentDetectionQuery, error)
- func (h *HasController) CreateComponentDetectionQueryWithTimeout(name string, namespace string, gitSourceURL string, gitSourceRevision string, ...) (*appservice.ComponentDetectionQuery, error)
- func (h *HasController) CreateComponentWithDockerSource(...) (*appservice.Component, error)
- func (h *HasController) CreateComponentWithoutGenerateAnnotation(componentSpec appservice.ComponentSpec, namespace string, secret string, ...) (*appservice.Component, error)
- func (h *HasController) DeleteAllApplicationsInASpecificNamespace(namespace string, timeout time.Duration) error
- func (h *HasController) DeleteAllComponentDetectionQueriesInASpecificNamespace(namespace string, timeout time.Duration) error
- func (h *HasController) DeleteAllComponentsInASpecificNamespace(namespace string, timeout time.Duration) error
- func (h *HasController) DeleteApplication(name string, namespace string, reportErrorOnNotFound bool) error
- func (h *HasController) DeleteComponent(name string, namespace string, reportErrorOnNotFound bool) error
- func (h *HasController) GetAllPipelineRunsForApplication(applicationName, namespace string) (*pipeline.PipelineRunList, error)
- func (h *HasController) GetApplication(name string, namespace string) (*appservice.Application, error)
- func (h *HasController) GetComponent(name string, namespace string) (*appservice.Component, error)
- func (h *HasController) GetComponentAnnotation(componentName, annotationKey, namespace string) (string, error)
- func (h *HasController) GetComponentByApplicationName(applicationName string, namespace string) (*appservice.Component, error)
- func (h *HasController) GetComponentConditionStatusMessages(name, namespace string) (messages []string, err error)
- func (h *HasController) GetComponentDetectionQuery(name, namespace string) (*appservice.ComponentDetectionQuery, error)
- func (h *HasController) GetComponentPipelineRun(componentName string, applicationName string, namespace, sha string) (*pipeline.PipelineRun, error)
- func (h *HasController) GetComponentPipelineRunWithType(componentName string, applicationName string, namespace, pipelineType string, ...) (*pipeline.PipelineRun, error)
- func (h *HasController) ListAllApplications(namespace string) (*appservice.ApplicationList, error)
- func (h *HasController) ListAllComponentDetectionQueries(namespace string) (*appservice.ComponentDetectionQueryList, error)
- func (h *HasController) RetriggerComponentPipelineRun(component *appservice.Component, pr *pipeline.PipelineRun) (sha string, err error)
- func (h *HasController) ScaleComponentReplicas(component *appservice.Component, replicas *int) (*appservice.Component, error)
- func (h *HasController) SetComponentAnnotation(componentName, annotationKey, annotationValue, namespace string) error
- func (h *HasController) StoreAllApplications(namespace string) error
- func (h *HasController) StoreAllComponentDetectionQueries(namespace string) error
- func (h *HasController) StoreAllComponents(namespace string) error
- func (h *HasController) StoreApplication(application *appservice.Application) error
- func (h *HasController) StoreComponent(component *appservice.Component) error
- func (h *HasController) StoreComponentDetectionQuery(ComponentDetectionQuery *appservice.ComponentDetectionQuery) error
- func (h *HasController) UpdateComponent(component *appservice.Component) error
- func (h *HasController) WaitForComponentPipelineToBeFinished(component *appservice.Component, sha string, t *tekton.TektonController, ...) error
- type RetryOptions
Constants ¶
const (
RequiredLabelNotFound = "cannot retrigger PipelineRun - required label %q not found"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HasController ¶
type HasController struct { // A Client manages communication with the GitHub API in a specific Organization. Github *github.Github // Generates a kubernetes client to interact with clusters. *kubeCl.CustomClient }
Factory to initialize the comunication against different API like github or kubernetes.
func NewSuiteController ¶
func NewSuiteController(kube *kubeCl.CustomClient) (*HasController, error)
Initializes all the clients and return interface to operate with application-service controller.
func (*HasController) ApplicationDeleted ¶
func (h *HasController) ApplicationDeleted(application *appservice.Application) wait.ConditionFunc
ApplicationDeleted check if a given application object was deleted successfully from the kubernetes cluster.
func (*HasController) ApplicationDevfilePresent ¶
func (h *HasController) ApplicationDevfilePresent(application *appservice.Application) wait.ConditionFunc
ApplicationDevfilePresent check if devfile exists in the application status.
func (*HasController) ApplicationGitopsRepoExists ¶
func (s *HasController) ApplicationGitopsRepoExists(devfileContent string) wait.ConditionFunc
ApplicationGitopsRepoExists check from the devfile content if application-service creates a gitops repo in GitHub.
func (*HasController) CheckForImageAnnotation ¶
func (h *HasController) CheckForImageAnnotation(component *appservice.Component) wait.ConditionFunc
func (*HasController) ComponentDeleted ¶
func (h *HasController) ComponentDeleted(component *appservice.Component) wait.ConditionFunc
Waits for a component until is deleted and if not will return an error
func (*HasController) ComponentReady ¶
func (h *HasController) ComponentReady(component *appservice.Component) wait.ConditionFunc
Waits for a component to be reconciled in the application service.
func (*HasController) CreateApplication ¶
func (h *HasController) CreateApplication(name string, namespace string) (*appservice.Application, error)
CreateApplication creates an application in the kubernetes cluster with 10 minutes default time for creation.
func (*HasController) CreateApplicationWithTimeout ¶
func (h *HasController) CreateApplicationWithTimeout(name string, namespace string, timeout time.Duration) (*appservice.Application, error)
CreateHasApplicationWithTimeout creates an application in the kubernetes cluster with a custom default time for creation.
func (*HasController) CreateComponent ¶
func (h *HasController) CreateComponent(componentSpec appservice.ComponentSpec, namespace string, outputContainerImage string, secret string, applicationName string, skipInitialChecks bool, annotations map[string]string) (*appservice.Component, error)
Universal method to create a component in the kubernetes clusters.
func (*HasController) CreateComponentDetectionQuery ¶
func (h *HasController) CreateComponentDetectionQuery(name string, namespace string, gitSourceURL string, gitSourceRevision string, gitSourceContext string, secret string, isMultiComponent bool) (*appservice.ComponentDetectionQuery, error)
CreateComponentDetectionQuery create a has componentdetectionquery from a given name, namespace, and git source
func (*HasController) CreateComponentDetectionQueryWithTimeout ¶
func (h *HasController) CreateComponentDetectionQueryWithTimeout(name string, namespace string, gitSourceURL string, gitSourceRevision string, gitSourceContext string, secret string, isMultiComponent bool, timeout time.Duration) (*appservice.ComponentDetectionQuery, error)
CreateComponentDetectionQueryWithTimeout create a has componentdetectionquery from a given name, namespace, and git source and waits for it to be read
func (*HasController) CreateComponentWithDockerSource ¶
func (h *HasController) CreateComponentWithDockerSource(applicationName, componentName, namespace, gitSourceURL, containerImageSource, outputContainerImage, secret string) (*appservice.Component, error)
CreateComponentWithDockerSource creates a component based on container image source.
func (*HasController) CreateComponentWithoutGenerateAnnotation ¶
func (h *HasController) CreateComponentWithoutGenerateAnnotation(componentSpec appservice.ComponentSpec, namespace string, secret string, applicationName string, skipInitialChecks bool) (*appservice.Component, error)
specific for tests/remote-secret/image-repository-cr-image-pull-remote-secret.go
func (*HasController) DeleteAllApplicationsInASpecificNamespace ¶
func (h *HasController) DeleteAllApplicationsInASpecificNamespace(namespace string, timeout time.Duration) error
DeleteAllApplicationsInASpecificNamespace removes all application CRs from a specific namespace. Useful when creating a lot of resources and want to remove all of them
func (*HasController) DeleteAllComponentDetectionQueriesInASpecificNamespace ¶
func (h *HasController) DeleteAllComponentDetectionQueriesInASpecificNamespace(namespace string, timeout time.Duration) error
DeleteAllComponentDetectionQueriesInASpecificNamespace removes all CDQs CRs from a specific namespace. Useful when creating a lot of resources and want to remove all of them
func (*HasController) DeleteAllComponentsInASpecificNamespace ¶
func (h *HasController) DeleteAllComponentsInASpecificNamespace(namespace string, timeout time.Duration) error
DeleteAllComponentsInASpecificNamespace removes all component CRs from a specific namespace. Useful when creating a lot of resources and want to remove all of them
func (*HasController) DeleteApplication ¶
func (h *HasController) DeleteApplication(name string, namespace string, reportErrorOnNotFound bool) error
DeleteApplication delete a HAS Application resource from the namespace. Optionally, it can avoid returning an error if the resource did not exist: - specify 'false', if it's likely the Application has already been deleted (for example, because the Namespace was deleted)
func (*HasController) DeleteComponent ¶
func (h *HasController) DeleteComponent(name string, namespace string, reportErrorOnNotFound bool) error
DeleteComponent delete an has component from a given name and namespace
func (*HasController) GetAllPipelineRunsForApplication ¶
func (h *HasController) GetAllPipelineRunsForApplication(applicationName, namespace string) (*pipeline.PipelineRunList, error)
GetAllPipelineRunsForApplication returns the pipelineruns for a given application in the namespace
func (*HasController) GetApplication ¶
func (h *HasController) GetApplication(name string, namespace string) (*appservice.Application, error)
GetApplication returns an application given a name and namespace from kubernetes cluster.
func (*HasController) GetComponent ¶
func (h *HasController) GetComponent(name string, namespace string) (*appservice.Component, error)
GetComponent return a component object from kubernetes cluster
func (*HasController) GetComponentAnnotation ¶
func (h *HasController) GetComponentAnnotation(componentName, annotationKey, namespace string) (string, error)
Gets value of a specified annotation in a component
func (*HasController) GetComponentByApplicationName ¶
func (h *HasController) GetComponentByApplicationName(applicationName string, namespace string) (*appservice.Component, error)
GetComponentByApplicationName returns a component from kubernetes cluster given a application name.
func (*HasController) GetComponentConditionStatusMessages ¶
func (h *HasController) GetComponentConditionStatusMessages(name, namespace string) (messages []string, err error)
Get the message from the status of a component. Usefull for debugging purposes.
func (*HasController) GetComponentDetectionQuery ¶
func (h *HasController) GetComponentDetectionQuery(name, namespace string) (*appservice.ComponentDetectionQuery, error)
GetComponentDetectionQuery return the status from the ComponentDetectionQuery Custom Resource object
func (*HasController) GetComponentPipelineRun ¶
func (h *HasController) GetComponentPipelineRun(componentName string, applicationName string, namespace, sha string) (*pipeline.PipelineRun, error)
GetComponentPipeline returns the pipeline for a given component labels
func (*HasController) GetComponentPipelineRunWithType ¶
func (h *HasController) GetComponentPipelineRunWithType(componentName string, applicationName string, namespace, pipelineType string, sha string) (*pipeline.PipelineRun, error)
GetComponentPipeline returns the pipeline for a given component labels with pipeline type within label "pipelines.appstudio.openshift.io/type" ("build", "test")
func (*HasController) ListAllApplications ¶
func (h *HasController) ListAllApplications(namespace string) (*appservice.ApplicationList, error)
ListAllApplications returns a list of all Applications in a given namespace.
func (*HasController) ListAllComponentDetectionQueries ¶
func (h *HasController) ListAllComponentDetectionQueries(namespace string) (*appservice.ComponentDetectionQueryList, error)
ListAllComponentDetectionQueries returns a list of all ComponentDetectionQueries in a given namespace.
func (*HasController) RetriggerComponentPipelineRun ¶
func (h *HasController) RetriggerComponentPipelineRun(component *appservice.Component, pr *pipeline.PipelineRun) (sha string, err error)
Universal method to retrigger pipelineruns in kubernetes cluster
func (*HasController) ScaleComponentReplicas ¶
func (h *HasController) ScaleComponentReplicas(component *appservice.Component, replicas *int) (*appservice.Component, error)
ScaleDeploymentReplicas scales the replicas of a given deployment
func (*HasController) SetComponentAnnotation ¶
func (h *HasController) SetComponentAnnotation(componentName, annotationKey, annotationValue, namespace string) error
Sets annotation in a component
func (*HasController) StoreAllApplications ¶
func (h *HasController) StoreAllApplications(namespace string) error
StoreAllApplications stores all Applications in a given namespace.
func (*HasController) StoreAllComponentDetectionQueries ¶
func (h *HasController) StoreAllComponentDetectionQueries(namespace string) error
StoreAllComponentDetectionQueries stores all ComponentDetectionQueries in a given namespace.
func (*HasController) StoreAllComponents ¶
func (h *HasController) StoreAllComponents(namespace string) error
StoreAllComponents stores all Components in a given namespace.
func (*HasController) StoreApplication ¶
func (h *HasController) StoreApplication(application *appservice.Application) error
StoreApplication stores a given Application as an artifact.
func (*HasController) StoreComponent ¶
func (h *HasController) StoreComponent(component *appservice.Component) error
StoreComponent stores a given Component as an artifact.
func (*HasController) StoreComponentDetectionQuery ¶
func (h *HasController) StoreComponentDetectionQuery(ComponentDetectionQuery *appservice.ComponentDetectionQuery) error
StoreComponentDetectionQuery stores a given ComponentDetectionQuery as an artifact.
func (*HasController) UpdateComponent ¶
func (h *HasController) UpdateComponent(component *appservice.Component) error
UpdateComponent updates a component
func (*HasController) WaitForComponentPipelineToBeFinished ¶
func (h *HasController) WaitForComponentPipelineToBeFinished(component *appservice.Component, sha string, t *tekton.TektonController, r *RetryOptions, prToUpdate *pipeline.PipelineRun) error
WaitForComponentPipelineToBeFinished waits for a given component PipelineRun to be finished In case of hitting issues like `TaskRunImagePullFailed` or `CouldntGetTask` it will re-trigger the PLR. Due to re-trigger mechanism this function can invalidate the related PLR object which might be used later in the test (by deleting the original PLR and creating a new one in case the PLR fails on one of the attempts). For that case this function gives an option to pass in a pointer to a related PLR object (`prToUpdate`) which will be updated (with a valid PLR object) before the end of this function and the PLR object can be then used for making assertions later in the test. If there's no intention for using the original PLR object later in the test, use `nil` instead of the pointer.
type RetryOptions ¶
type RetryOptions struct { // Indicate how many times a pipelineRun should be retriggered in case of flakines Retries int // If is set to true the PipelineRun will be retriggered always in case if pipelinerun fail for any reason. Time to time in RHTAP CI // we see that there are a lot of components which fail with QPS in build-container which cannot be controlled. // By default is false will retrigger a pipelineRun only when meet CouldntGetTask or TaskRunImagePullFailed conditions Always bool }
Set of options to retrigger pipelineRuns in CI to fight against flakynes