Documentation ¶
Index ¶
- Constants
- Variables
- func AddIntegrationTestRerunLabel(ctx context.Context, adapterClient client.Client, ...) error
- func AnnotateSnapshot(ctx context.Context, snapshot *applicationapiv1alpha1.Snapshot, ...) error
- func CanSnapshotBePromoted(snapshot *applicationapiv1alpha1.Snapshot) (bool, []string)
- func CompareSnapshots(expectedSnapshot *applicationapiv1alpha1.Snapshot, ...) bool
- func CopySnapshotLabelsAndAnnotations(application *applicationapiv1alpha1.Application, ...)
- func FilterIntegrationTestScenariosWithContext(scenarios *[]v1beta2.IntegrationTestScenario, ...) *[]v1beta2.IntegrationTestScenario
- func FindMatchingSnapshot(application *applicationapiv1alpha1.Application, ...) *applicationapiv1alpha1.Snapshot
- func FindMatchingSnapshotComponent(snapshot *applicationapiv1alpha1.Snapshot, ...) applicationapiv1alpha1.SnapshotComponent
- func GetAppStudioTestsFinishedTime(snapshot *applicationapiv1alpha1.Snapshot) (metav1.Time, bool)
- func GetComponentSourceFromComponent(component *applicationapiv1alpha1.Component) *applicationapiv1alpha1.ComponentSource
- func GetIntegrationTestRunLabelValue(obj metav1.Object) (string, bool)
- func GetLatestUpdateTime(snapshot *applicationapiv1alpha1.Snapshot) (time.Time, error)
- func GetPRGroupFromSnapshot(snapshot *applicationapiv1alpha1.Snapshot) (string, string)
- func GetSourceRepoOwnerFromSnapshot(snapshot *applicationapiv1alpha1.Snapshot) string
- func GetTestSucceededCondition(snapshot *applicationapiv1alpha1.Snapshot) (condition *metav1.Condition, ok bool)
- func HasPRGroupProcessed(snapshot *applicationapiv1alpha1.Snapshot) bool
- func HasSnapshotRerunLabelChanged(objectOld, objectNew client.Object) bool
- func HasSnapshotTestAnnotationChanged(objectOld, objectNew client.Object) bool
- func HasSnapshotTestingChangedToFinished(objectOld, objectNew client.Object) bool
- func HaveAppStudioTestsFinished(snapshot *applicationapiv1alpha1.Snapshot) bool
- func HaveAppStudioTestsSucceeded(snapshot *applicationapiv1alpha1.Snapshot) bool
- func HaveGitSource(snapshotComponent applicationapiv1alpha1.SnapshotComponent) bool
- func IntegrationSnapshotChangePredicate() predicate.Predicate
- func IsComponentSnapshot(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsComponentSnapshotCreatedByPACPushEvent(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsContextValidForSnapshot(scenarioContextName string, snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsGroupSnapshot(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsOverrideSnapshot(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsScenarioApplicableToSnapshotsContext(scenario *v1beta2.IntegrationTestScenario, ...) bool
- func IsSnapshotCreatedByPACPushEvent(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotCreatedBySamePACEvent(snapshot1, snapshot2 *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotError(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotIntegrationStatusMarkedAsFinished(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotMarkedAsAddedToGlobalCandidateList(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotMarkedAsAutoReleased(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotMarkedAsFailed(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotMarkedAsInvalid(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotMarkedAsPassed(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotNotStarted(snapshot *applicationapiv1alpha1.Snapshot) bool
- func IsSnapshotStatusConditionSet(snapshot *applicationapiv1alpha1.Snapshot, conditionType string, ...) bool
- func IsSnapshotValid(snapshot *applicationapiv1alpha1.Snapshot) bool
- func MarkSnapshotAsAddedToGlobalCandidateList(ctx context.Context, adapterClient client.Client, ...) error
- func MarkSnapshotAsAutoReleased(ctx context.Context, adapterClient client.Client, ...) error
- func MarkSnapshotAsFailed(ctx context.Context, adapterClient client.Client, ...) error
- func MarkSnapshotAsInvalid(ctx context.Context, adapterClient client.Client, ...) error
- func MarkSnapshotAsPassed(ctx context.Context, adapterClient client.Client, ...) error
- func MarkSnapshotIntegrationStatusAsFinished(ctx context.Context, adapterClient client.Client, ...) error
- func MarkSnapshotIntegrationStatusAsInProgress(ctx context.Context, adapterClient client.Client, ...) error
- func NewSnapshot(application *applicationapiv1alpha1.Application, ...) *applicationapiv1alpha1.Snapshot
- func NewSnapshotIntegrationTestStatusesFromSnapshot(s *applicationapiv1alpha1.Snapshot) (*intgteststat.SnapshotIntegrationTestStatuses, error)
- func NotifyComponentSnapshotsInGroupSnapshot(ctx context.Context, cl client.Client, ...) error
- func PrepareSnapshot(ctx context.Context, adapterClient client.Client, ...) (*applicationapiv1alpha1.Snapshot, error)
- func PrepareToRegisterIntegrationPipelineRunStarted(snapshot *applicationapiv1alpha1.Snapshot)
- func RemoveIntegrationTestRerunLabel(ctx context.Context, adapterClient client.Client, ...) error
- func ResetSnapshotStatusConditions(ctx context.Context, adapterClient client.Client, ...) error
- func SetAnnotationAndLabelForGroupSnapshot(groupSnapshot *applicationapiv1alpha1.Snapshot, ...) (*applicationapiv1alpha1.Snapshot, error)
- func SetOwnerReference(ctx context.Context, adapterClient client.Client, ...) (*applicationapiv1alpha1.Snapshot, error)
- func SetSnapshotIntegrationStatusAsError(snapshot *applicationapiv1alpha1.Snapshot, message string)
- func SetSnapshotIntegrationStatusAsInvalid(snapshot *applicationapiv1alpha1.Snapshot, message string)
- func SnapshotIntegrationTestRerunTriggerPredicate() predicate.Predicate
- func SnapshotTestAnnotationChangePredicate() predicate.Predicate
- func SortSnapshots(snapshots []applicationapiv1alpha1.Snapshot) []applicationapiv1alpha1.Snapshot
- func ValidateImageDigest(imageUrl string) error
- func WriteIntegrationTestStatusesIntoSnapshot(ctx context.Context, s *applicationapiv1alpha1.Snapshot, ...) error
- type ComponentSnapshotInfo
Constants ¶
const ( // PipelinesAsCodePrefix contains the prefix applied to labels and annotations copied from Pipelines as Code resources. PipelinesAsCodePrefix = "pac.test.appstudio.openshift.io" // TestLabelPrefix contains the prefix applied to labels and annotations related to testing. TestLabelPrefix = "test.appstudio.openshift.io" // CustomLabelPrefix contains the prefix applied to custom user-defined labels and annotations. CustomLabelPrefix = "custom.appstudio.openshift.io" // SnapshotTypeLabel contains the type of the Snapshot. SnapshotTypeLabel = "test.appstudio.openshift.io/type" // SnapshotIntegrationTestRun contains name of test we want to trigger run SnapshotIntegrationTestRun = "test.appstudio.openshift.io/run" // AppstudioLabelPrefix contains application, component, build-pipelinerun etc. AppstudioLabelPrefix = "appstudio.openshift.io" // SnapshotLabel contains the name of the Snapshot within appstudio SnapshotLabel = "appstudio.openshift.io/snapshot" // SnapshotTestScenarioLabel contains the name of the Snapshot test scenario. SnapshotTestScenarioLabel = "test.appstudio.openshift.io/scenario" // SnapshotTestScenarioLabel contains json data with test results of the particular snapshot SnapshotTestsStatusAnnotation = "test.appstudio.openshift.io/status" // (Deprecated) SnapshotPRLastUpdate contains timestamp of last time PR was updated SnapshotPRLastUpdate = "test.appstudio.openshift.io/pr-last-update" // SnapshotGitSourceRepoURLAnnotation contains URL of the git source repository (usually needed for forks) SnapshotGitSourceRepoURLAnnotation = "test.appstudio.openshift.io/source-repo-url" // PipelineAsCodeGitProviderAnnotation contains the git provider attached via PaC (e.g., github, gitlab) PipelineAsCodeGitSourceURLAnnotation = PipelinesAsCodePrefix + "/source-repo-url" // SnapshotStatusReportAnnotation contains metadata of tests related to status reporting to git provider SnapshotStatusReportAnnotation = "test.appstudio.openshift.io/git-reporter-status" // PRGroupAnnotation contains the pr group name PRGroupAnnotation = "test.appstudio.openshift.io/pr-group" // PRGroupHashLabel contains the pr group name in sha format PRGroupHashLabel = "test.appstudio.openshift.io/pr-group-sha" // PRGroupCreationAnnotation contains the info of groupsnapshot creation PRGroupCreationAnnotation = "test.appstudio.openshift.io/create-groupsnapshot-status" // BuildPipelineRunStartTime contains the start time of build pipelineRun BuildPipelineRunStartTime = "test.appstudio.openshift.io/pipelinerunstarttime" // BuildPipelineRunPrefix contains the build pipeline run related labels and annotations BuildPipelineRunPrefix = "build.appstudio" // BuildPipelineRunFinishTimeLabel contains the build PipelineRun finish time of the Snapshot. BuildPipelineRunFinishTimeLabel = "test.appstudio.openshift.io/pipelinerunfinishtime" // GroupSnapshotInfoAnnotation contains the component snapshot info included in group snapshot GroupSnapshotInfoAnnotation = "test.appstudio.openshift.io/group-test-info" // BuildPipelineRunNameLabel contains the build PipelineRun name BuildPipelineRunNameLabel = AppstudioLabelPrefix + "/build-pipelinerun" // ApplicationNameLabel contains the name of the application ApplicationNameLabel = AppstudioLabelPrefix + "/application" // SnapshotComponentType is the type of Snapshot which was created for a single component build. SnapshotComponentType = "component" // SnapshotOverrideType is the type of Snapshot which was created for override Global Candidate List. SnapshotOverrideType = "override" // SnapshotGroupType is the type of Snapshot which was created for pull request groups. SnapshotGroupType = "group" // PipelineAsCodeEventTypeLabel is the type of event which triggered the pipelinerun in build service PipelineAsCodeEventTypeLabel = PipelinesAsCodePrefix + "/event-type" // PipelineAsCodeGitProviderLabel is the git provider which triggered the pipelinerun in build service. PipelineAsCodeGitProviderLabel = PipelinesAsCodePrefix + "/git-provider" // PipelineAsCodeGitProviderAnnotation is the git provider which triggered the pipelinerun in build service. PipelineAsCodeGitProviderAnnotation = PipelinesAsCodePrefix + "/git-provider" // PipelineAsCodeSHALabel is the commit which triggered the pipelinerun in build service. PipelineAsCodeSHALabel = PipelinesAsCodePrefix + "/sha" // PipelineAsCodeURLOrgLabel is the organization for the git repo which triggered the pipelinerun in build service. PipelineAsCodeURLOrgLabel = PipelinesAsCodePrefix + "/url-org" // PipelineAsCodeURLRepositoryLabel is the git repository which triggered the pipelinerun in build service. PipelineAsCodeURLRepositoryLabel = PipelinesAsCodePrefix + "/url-repository" // PipelineAsCodeRepoURLAnnotation is the URL to the git repository which triggered the pipelinerun in build service. PipelineAsCodeRepoURLAnnotation = PipelinesAsCodePrefix + "/repo-url" // PipelineAsCodeTargetBranchAnnotation is the SHA of the git revision which triggered the pipelinerun in build service. PipelineAsCodeTargetBranchAnnotation = PipelinesAsCodePrefix + "/branch" // PipelineAsCodeInstallationIDAnnotation is the GitHub App installation ID for the git repo which triggered the pipelinerun in build service. PipelineAsCodeInstallationIDAnnotation = PipelinesAsCodePrefix + "/installation-id" // PipelineAsCodePullRequestAnnotation is the git repository's pull request identifier PipelineAsCodePullRequestAnnotation = PipelinesAsCodePrefix + "/pull-request" // PipelineAsCodeSourceProjectIDAnnotation is the source project ID for gitlab PipelineAsCodeSourceProjectIDAnnotation = PipelinesAsCodePrefix + "/source-project-id" // PipelineAsCodeTargetProjectIDAnnotation is the target project ID for gitlab PipelineAsCodeTargetProjectIDAnnotation = PipelinesAsCodePrefix + "/target-project-id" // PipelineAsCodeRepoUrlAnnotation is the target project Repo Url PipelineAsCodeRepoUrlAnnotation = PipelinesAsCodePrefix + "/repo-url" // PipelineAsCodeSHAAnnotation is the commit which triggered the pipelinerun in build service. PipelineAsCodeSHAAnnotation = PipelinesAsCodePrefix + "/sha" // PipelineAsCodePushType is the type of push event which triggered the pipelinerun in build service PipelineAsCodePushType = "push" // PipelineAsCodeGLPushType is the type of gitlab push event which triggered the pipelinerun in build service PipelineAsCodeGLPushType = "Push" // PipelineAsCodePullRequestType is the type of pull_request event which triggered the pipelinerun in build service PipelineAsCodePullRequestType = "pull_request" // PipelineAsCodeMergeRequestType is the type of merge request event which triggered the pipelinerun in build service PipelineAsCodeMergeRequestType = "merge request" // PipelineAsCodeGitHubProviderType is the git provider type for a GitHub event which triggered the pipelinerun in build service. PipelineAsCodeGitHubProviderType = "github" // PipelineAsCodeGitHubProviderType is the git provider type for a GitHub event which triggered the pipelinerun in build service. PipelineAsCodeGitLabProviderType = "gitlab" //AppStudioTestSucceededCondition is the condition for marking if the AppStudio Tests succeeded for the Snapshot. AppStudioTestSucceededCondition = "AppStudioTestSucceeded" //LegacyTestSucceededCondition is the condition for marking if the AppStudio Tests succeeded for the Snapshot. LegacyTestSucceededCondition = "HACBSStudioTestSucceeded" // AppStudioIntegrationStatusCondition is the condition for marking the AppStudio integration status of the Snapshot. AppStudioIntegrationStatusCondition = "AppStudioIntegrationStatus" // LegacyIntegrationStatusCondition is the condition for marking the AppStudio integration status of the Snapshot. LegacyIntegrationStatusCondition = "HACBSIntegrationStatus" // SnapshotAutoReleasedCondition is the condition for marking if Snapshot was auto-released released with AppStudio. SnapshotAutoReleasedCondition = "AutoReleased" // SnapshotAddedToGlobalCandidateListCondition is the condition for marking if Snapshot's component was added to // the global candidate list. SnapshotAddedToGlobalCandidateListCondition = "AddedToGlobalCandidateList" // AppStudioTestSucceededConditionSatisfied is the reason that's set when the AppStudio tests succeed. AppStudioTestSucceededConditionSatisfied = "Passed" // AppStudioTestSucceededConditionFailed is the reason that's set when the AppStudio tests fail. AppStudioTestSucceededConditionFailed = "Failed" // AppStudioIntegrationStatusInvalid is the reason that's set when the AppStudio integration gets into an invalid state. AppStudioIntegrationStatusInvalid = "Invalid" // AppStudioIntegrationStatusErrorOccured is the reason that's set when the AppStudio integration gets into an error state. AppStudioIntegrationStatusErrorOccured = "ErrorOccured" //AppStudioIntegrationStatusInProgress is the reason that's set when the AppStudio tests gets into an in progress state. AppStudioIntegrationStatusInProgress = "InProgress" //AppStudioIntegrationStatusFinished is the reason that's set when the AppStudio tests finish. AppStudioIntegrationStatusFinished = "Finished" // the statuses needed to report to GiHub when creating check run or commit status, see doc // https://docs.github.com/en/rest/guides/using-the-rest-api-to-interact-with-checks?apiVersion=2022-11-28 // https://docs.github.com/en/free-pro-team@latest/rest/checks/runs?apiVersion=2022-11-28#create-a-check-run //IntegrationTestStatusPendingGithub is the status reported to github when integration test is in a queue IntegrationTestStatusPendingGithub = "pending" //IntegrationTestStatusSuccessGithub is the status reported to github when integration test succeed IntegrationTestStatusSuccessGithub = "success" //IntegrationTestStatusFailureGithub is the status reported to github when integration test fail IntegrationTestStatusFailureGithub = "failure" //IntegrationTestStatusErrorGithub is the status reported to github when integration test experience error IntegrationTestStatusErrorGithub = "error" //IntegrationTestStatusInProgressGithub is the status reported to github when integration test is in progress IntegrationTestStatusInProgressGithub = "in_progress" //IntegrationTestStatusCancelledGithub is the status reported to github when integration test is cancelled IntegrationTestStatusCancelledGithub = "cancelled" )
Variables ¶
var ( // SnapshotComponentLabel contains the name of the updated Snapshot component - it should match the pipeline label. SnapshotComponentLabel = tekton.ComponentNameLabel )
Functions ¶
func AddIntegrationTestRerunLabel ¶
func AddIntegrationTestRerunLabel(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot, integrationTestScenarioName string) error
AddIntegrationTestRerunLabel adding re-run label to snapshot
func AnnotateSnapshot ¶
func AnnotateSnapshot(ctx context.Context, snapshot *applicationapiv1alpha1.Snapshot, key, value string, cl client.Client) error
AnnotateSnapshot sets annotation for a snapshot in defined context, return error if meeting it
func CanSnapshotBePromoted ¶
func CanSnapshotBePromoted(snapshot *applicationapiv1alpha1.Snapshot) (bool, []string)
CanSnapshotBePromoted checks if the Snapshot in question can be promoted for deployment and release.
func CompareSnapshots ¶
func CompareSnapshots(expectedSnapshot *applicationapiv1alpha1.Snapshot, foundSnapshot *applicationapiv1alpha1.Snapshot) bool
CompareSnapshots compares two Snapshots and returns boolean true if their images match exactly.
func CopySnapshotLabelsAndAnnotations ¶
func CopySnapshotLabelsAndAnnotations(application *applicationapiv1alpha1.Application, snapshot *applicationapiv1alpha1.Snapshot, componentName string, source *metav1.ObjectMeta, prefixes []string)
CopySnapshotLabelsAndAnnotations coppies labels and annotations from build pipelineRun or tested snapshot into regular snapshot
func FilterIntegrationTestScenariosWithContext ¶
func FilterIntegrationTestScenariosWithContext(scenarios *[]v1beta2.IntegrationTestScenario, snapshot *applicationapiv1alpha1.Snapshot) *[]v1beta2.IntegrationTestScenario
FilterIntegrationTestScenariosWithContext returns a filtered list of IntegrationTestScenario from the given list of IntegrationTestScenarios compared against the given Snapshot based on individual IntegrationTestScenario contexts
func FindMatchingSnapshot ¶
func FindMatchingSnapshot(application *applicationapiv1alpha1.Application, allSnapshots *[]applicationapiv1alpha1.Snapshot, expectedSnapshot *applicationapiv1alpha1.Snapshot) *applicationapiv1alpha1.Snapshot
FindMatchingSnapshot tries to finds the expected Snapshot with the same set of images.
func FindMatchingSnapshotComponent ¶
func FindMatchingSnapshotComponent(snapshot *applicationapiv1alpha1.Snapshot, component *applicationapiv1alpha1.Component) applicationapiv1alpha1.SnapshotComponent
FindMatchingSnapshotComponent find the snapshot component from the given snapshot according to the name of the given component name
func GetAppStudioTestsFinishedTime ¶
func GetAppStudioTestsFinishedTime(snapshot *applicationapiv1alpha1.Snapshot) (metav1.Time, bool)
GetAppStudioTestsFinishedTime finds the timestamp of tests succeeded condition
func GetComponentSourceFromComponent ¶
func GetComponentSourceFromComponent(component *applicationapiv1alpha1.Component) *applicationapiv1alpha1.ComponentSource
GetComponentSourceFromComponent gets the component source from the given Component as Revision and set Component.Status.LastBuiltCommit as Component.Source.GitSource.Revision if it is defined.
func GetIntegrationTestRunLabelValue ¶
GetIntegrationTestRunLabelValue returns value of the label responsible for re-running tests
func GetLatestUpdateTime ¶
func GetLatestUpdateTime(snapshot *applicationapiv1alpha1.Snapshot) (time.Time, error)
Deprecated
func GetPRGroupFromSnapshot ¶
func GetPRGroupFromSnapshot(snapshot *applicationapiv1alpha1.Snapshot) (string, string)
GetPRGroupFromSnapshot gets the value of label test.appstudio.openshift.io/pr-group-sha and annotation from component snapshot
func GetSourceRepoOwnerFromSnapshot ¶
func GetSourceRepoOwnerFromSnapshot(snapshot *applicationapiv1alpha1.Snapshot) string
func GetTestSucceededCondition ¶
func GetTestSucceededCondition(snapshot *applicationapiv1alpha1.Snapshot) (condition *metav1.Condition, ok bool)
GetTestSucceededCondition checks status of tests on the snapshot
func HasPRGroupProcessed ¶
func HasPRGroupProcessed(snapshot *applicationapiv1alpha1.Snapshot) bool
HasPRGroupProcessed checks if the pr group has been handled by snapshot adapter to avoid duplicate check, if yes, won't handle the snapshot again
func HasSnapshotRerunLabelChanged ¶
HasSnapshotRerunLabelChanged returns a boolean indicating whether the Snapshot label for re-running integration test has changed. If the objects passed to this function are not Snapshots, the function will return false.
func HasSnapshotTestAnnotationChanged ¶
HasSnapshotTestAnnotationChanged returns a boolean indicating whether the Snapshot annotation has changed. If the objects passed to this function are not Snapshots, the function will return false.
func HasSnapshotTestingChangedToFinished ¶
HasSnapshotTestingChangedToFinished returns a boolean indicating whether the Snapshot testing status has changed to finished. If the objects passed to this function are not Snapshots, the function will return false.
func HaveAppStudioTestsFinished ¶
func HaveAppStudioTestsFinished(snapshot *applicationapiv1alpha1.Snapshot) bool
HaveAppStudioTestsFinished checks if the AppStudio tests have finished by checking if the AppStudio Test Succeeded condition is set.
func HaveAppStudioTestsSucceeded ¶
func HaveAppStudioTestsSucceeded(snapshot *applicationapiv1alpha1.Snapshot) bool
HaveAppStudioTestsSucceeded checks if the AppStudio tests have finished by checking if the AppStudio Test Succeeded condition is set.
func HaveGitSource ¶
func HaveGitSource(snapshotComponent applicationapiv1alpha1.SnapshotComponent) bool
HaveGitSource checks if snapshotComponent contains non-empty source.git field and have both url and revision fields defined
func IntegrationSnapshotChangePredicate ¶
IntegrationSnapshotChangePredicate returns a predicate which filters out all objects except snapshot is deleted and requires HasSnapshotTestingChangedToFinished for update events.
func IsComponentSnapshot ¶
func IsComponentSnapshot(snapshot *applicationapiv1alpha1.Snapshot) bool
func IsComponentSnapshotCreatedByPACPushEvent ¶
func IsComponentSnapshotCreatedByPACPushEvent(snapshot *applicationapiv1alpha1.Snapshot) bool
func IsContextValidForSnapshot ¶
func IsContextValidForSnapshot(scenarioContextName string, snapshot *applicationapiv1alpha1.Snapshot) bool
IsContextValidForSnapshot checks the context and compares it against the Snapshot to determine if it applies
func IsGroupSnapshot ¶
func IsGroupSnapshot(snapshot *applicationapiv1alpha1.Snapshot) bool
IsGroupSnapshot returns true if snapshot label 'test.appstudio.openshift.io/type' is 'group'
func IsOverrideSnapshot ¶
func IsOverrideSnapshot(snapshot *applicationapiv1alpha1.Snapshot) bool
IsOverrideSnapshot returns true if snapshot label 'test.appstudio.openshift.io/type' is 'override'
func IsScenarioApplicableToSnapshotsContext ¶
func IsScenarioApplicableToSnapshotsContext(scenario *v1beta2.IntegrationTestScenario, snapshot *applicationapiv1alpha1.Snapshot) bool
IsScenarioApplicableToSnapshotsContext checks the contexts list for a given IntegrationTestScenario and compares it against the Snapshot to determine if the scenario applies to it
func IsSnapshotCreatedByPACPushEvent ¶
func IsSnapshotCreatedByPACPushEvent(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotCreatedByPACPushEvent checks if a snapshot has label PipelineAsCodeEventTypeLabel and with push value it the label doesn't exist for some manual snapshot
func IsSnapshotCreatedBySamePACEvent ¶
func IsSnapshotCreatedBySamePACEvent(snapshot1, snapshot2 *applicationapiv1alpha1.Snapshot) bool
IsSnapshotCreatedBySamePACEvent checks if the two snapshot are created by the same PAC event or they don't have event type
func IsSnapshotError ¶
func IsSnapshotError(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotError if the AppStudio Integration Status condition is in ErrorOcurred status.
func IsSnapshotIntegrationStatusMarkedAsFinished ¶
func IsSnapshotIntegrationStatusMarkedAsFinished(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotIntegrationStatusMarkedAsFinished returns true if snapshot is marked as finished
func IsSnapshotMarkedAsAddedToGlobalCandidateList ¶
func IsSnapshotMarkedAsAddedToGlobalCandidateList(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotMarkedAsAddedToGlobalCandidateList returns true if snapshot's component is marked as added to global candidate list
func IsSnapshotMarkedAsAutoReleased ¶
func IsSnapshotMarkedAsAutoReleased(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotMarkedAsAutoReleased returns true if snapshot is marked as deployed to root environments
func IsSnapshotMarkedAsFailed ¶
func IsSnapshotMarkedAsFailed(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotMarkedAsFailed returns true if snapshot is marked as failed
func IsSnapshotMarkedAsInvalid ¶
func IsSnapshotMarkedAsInvalid(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotMarkedAsInvalid returns true if snapshot is marked as failed
func IsSnapshotMarkedAsPassed ¶
func IsSnapshotMarkedAsPassed(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotMarkedAsPassed returns true if snapshot is marked as passed
func IsSnapshotNotStarted ¶
func IsSnapshotNotStarted(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotNotStarted checks if the AppStudio Integration Status condition is not in progress status.
func IsSnapshotStatusConditionSet ¶
func IsSnapshotStatusConditionSet(snapshot *applicationapiv1alpha1.Snapshot, conditionType string, conditionStatus metav1.ConditionStatus, reason string) bool
IsSnapshotStatusConditionSet checks if the condition with the conditionType in the status of Snapshot has been marked as the conditionStatus and reason.
func IsSnapshotValid ¶
func IsSnapshotValid(snapshot *applicationapiv1alpha1.Snapshot) bool
IsSnapshotValid checks if the AppStudio Integration Status condition is not invalid.
func MarkSnapshotAsAddedToGlobalCandidateList ¶
func MarkSnapshotAsAddedToGlobalCandidateList(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot, message string) error
MarkSnapshotAsAddedToGlobalCandidateList updates the SnapshotAddedToGlobalCandidateListCondition for the Snapshot to true with reason 'Added'. If the patch command fails, an error will be returned.
func MarkSnapshotAsAutoReleased ¶
func MarkSnapshotAsAutoReleased(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot, message string) error
MarkSnapshotAsAutoReleased updates the SnapshotAutoReleasedCondition for the Snapshot to 'AutoReleased'. If the patch command fails, an error will be returned.
func MarkSnapshotAsFailed ¶
func MarkSnapshotAsFailed(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot, message string) error
MarkSnapshotAsFailed updates the AppStudio Test succeeded condition for the Snapshot to failed. If the patch command fails, an error will be returned.
func MarkSnapshotAsInvalid ¶
func MarkSnapshotAsInvalid(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot, message string) error
MarkSnapshotAsInvalid updates the AppStudio integration status condition for the Snapshot to invalid. If the patch command fails, an error will be returned.
func MarkSnapshotAsPassed ¶
func MarkSnapshotAsPassed(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot, message string) error
MarkSnapshotAsPassed updates the AppStudio Test succeeded condition for the Snapshot to passed. If the patch command fails, an error will be returned.
func MarkSnapshotIntegrationStatusAsFinished ¶
func MarkSnapshotIntegrationStatusAsFinished(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot, message string) error
MarkSnapshotIntegrationStatusAsFinished sets the AppStudio integration status condition for the Snapshot to Finished.
func MarkSnapshotIntegrationStatusAsInProgress ¶
func MarkSnapshotIntegrationStatusAsInProgress(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot, message string) error
MarkSnapshotIntegrationStatusAsInProgress sets the AppStudio integration status condition for the Snapshot to In Progress.
func NewSnapshot ¶
func NewSnapshot(application *applicationapiv1alpha1.Application, snapshotComponents *[]applicationapiv1alpha1.SnapshotComponent) *applicationapiv1alpha1.Snapshot
NewSnapshot creates a new snapshot based on the supplied application and components
func NewSnapshotIntegrationTestStatusesFromSnapshot ¶
func NewSnapshotIntegrationTestStatusesFromSnapshot(s *applicationapiv1alpha1.Snapshot) (*intgteststat.SnapshotIntegrationTestStatuses, error)
NewSnapshotIntegrationTestStatusesFromSnapshot creates new SnapshotTestStatus struct from snapshot annotation
func NotifyComponentSnapshotsInGroupSnapshot ¶
func NotifyComponentSnapshotsInGroupSnapshot(ctx context.Context, cl client.Client, componentSnapshotInfos []ComponentSnapshotInfo, msg string) error
NotifyComponentSnapshotsInGroupSnapshot annotate the msg to the given component snapshots in componentSnapshotInfos
func PrepareSnapshot ¶
func PrepareSnapshot(ctx context.Context, adapterClient client.Client, application *applicationapiv1alpha1.Application, applicationComponents *[]applicationapiv1alpha1.Component, component *applicationapiv1alpha1.Component, newContainerImage string, newComponentSource *applicationapiv1alpha1.ComponentSource) (*applicationapiv1alpha1.Snapshot, error)
PrepareSnapshot prepares the Snapshot for a given application, components and the updated component (if any). In case the Snapshot can't be created, an error will be returned.
func PrepareToRegisterIntegrationPipelineRunStarted ¶
func PrepareToRegisterIntegrationPipelineRunStarted(snapshot *applicationapiv1alpha1.Snapshot)
PrepareToRegisterIntegrationPipelineRunStarted is to do preparation before calling RegisterPipelineRunStarted Don't use this function for PLR re-runs
func RemoveIntegrationTestRerunLabel ¶
func RemoveIntegrationTestRerunLabel(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot) error
RemoveIntegrationTestRerunLabel removes re-run label from snapshot
func SetAnnotationAndLabelForGroupSnapshot ¶
func SetAnnotationAndLabelForGroupSnapshot(groupSnapshot *applicationapiv1alpha1.Snapshot, componentSnapshot *applicationapiv1alpha1.Snapshot, componentSnapshotInfos []ComponentSnapshotInfo) (*applicationapiv1alpha1.Snapshot, error)
func SetOwnerReference ¶
func SetOwnerReference(ctx context.Context, adapterClient client.Client, snapshot *applicationapiv1alpha1.Snapshot, owner *applicationapiv1alpha1.Application) (*applicationapiv1alpha1.Snapshot, error)
func SetSnapshotIntegrationStatusAsError ¶
func SetSnapshotIntegrationStatusAsError(snapshot *applicationapiv1alpha1.Snapshot, message string)
SetSnapshotIntegrationStatusAsError sets the AppStudio integration status condition for the Snapshot to error.
func SetSnapshotIntegrationStatusAsInvalid ¶
func SetSnapshotIntegrationStatusAsInvalid(snapshot *applicationapiv1alpha1.Snapshot, message string)
SetSnapshotIntegrationStatusAsInvalid sets the AppStudio integration status condition for the Snapshot to invalid.
func SnapshotIntegrationTestRerunTriggerPredicate ¶
SnapshotIntegrationTestRerunTriggerPredicate returns a predicate which filters out all objects except when label for rerunning an integration test is added.
func SnapshotTestAnnotationChangePredicate ¶
SnapshotTestAnnotationChangePredicate returns a predicate which filters out all objects except when Snapshot annotation "test.appstudio.openshift.io/status" is changed for update events.
func SortSnapshots ¶
func SortSnapshots(snapshots []applicationapiv1alpha1.Snapshot) []applicationapiv1alpha1.Snapshot
SortSnapshots sorts the snapshots according to the snapshot annotation BuildPipelineRunStartTime
func ValidateImageDigest ¶
ValidateImageDigest checks if image url contains valid digest, return error if check fails
func WriteIntegrationTestStatusesIntoSnapshot ¶
func WriteIntegrationTestStatusesIntoSnapshot(ctx context.Context, s *applicationapiv1alpha1.Snapshot, sts *intgteststat.SnapshotIntegrationTestStatuses, c client.Client) error
WriteIntegrationTestStatusesIntoSnapshot writes data to snapshot by updating CR Data are written only when new changes are detected
Types ¶
type ComponentSnapshotInfo ¶
type ComponentSnapshotInfo struct { // Namespace Namespace string `json:"namespace"` // Component name Component string `json:"component"` // The build PLR name building the container image triggered by pull request BuildPipelineRun string `json:"buildPipelineRun"` // The built component snapshot from build PLR Snapshot string `json:"snapshot"` // The repo url for each component RepoUrl string `json:"repoUrl"` // Pull/Merge request number for updated component PullRequestNumber string `json:"pullRequestNumber"` }
ComponentSnapshotInfo contains data about the component snapshots' info in group snapshot
func UnmarshalJSON ¶
func UnmarshalJSON(b []byte) ([]*ComponentSnapshotInfo, error)
UnmarshalJSON load data from JSON