Documentation ¶
Index ¶
- Variables
- func AddLabelToLabelFilter(rctx *rulesengine.RuleCtx, label string)
- func CheckCmdFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
- func CheckMageFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
- func CheckNoFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
- func CheckPkgFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
- func CheckReleasePipelinesTestsChanged(rctx *rulesengine.RuleCtx) (bool, error)
- func CheckTektonFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
- func ExecuteAllTestsExceptUpgradeTestSuite(rctx *rulesengine.RuleCtx) error
- func ExecuteDefaultTestAction(rctx *rulesengine.RuleCtx) error
- func ExecuteInfraDeploymentsDefaultTestAction(rctx *rulesengine.RuleCtx) error
- func ExecuteReleaseCatalogAction(rctx *rulesengine.RuleCtx) error
- func ExecuteReleaseCatalogPairedAction(rctx *rulesengine.RuleCtx) error
- func ExecuteTestAction(rctx *rulesengine.RuleCtx) error
- func GetPairedCommitSha(repoForPairing string, rctx *rulesengine.RuleCtx) string
- func GitCheckoutRemoteBranch(remoteName, branchName string) error
- func HandleErrorWithAlert(err error, errLevel slack.ErrorSeverityLevel) error
- func InstallKonflux() error
- func IsLoadTestJob(rctx *rulesengine.RuleCtx) (bool, error)
- func IsMultiPlatformConfigRequired(rctx *rulesengine.RuleCtx) (bool, error)
- func IsPRPairingRequired(repoForPairing string, remoteName string, branchName string) bool
- func IsPeriodicJob(rctx *rulesengine.RuleCtx) (bool, error)
- func IsPrelightChecked(rctx *rulesengine.RuleCtx) (bool, error)
- func IsRehearseJob(rctx *rulesengine.RuleCtx) (bool, error)
- func IsSprayProxyHostSet(rctx *rulesengine.RuleCtx) (bool, error)
- func IsSprayProxyRequired(rctx *rulesengine.RuleCtx) (bool, error)
- func IsSprayProxyTokenSet(rctx *rulesengine.RuleCtx) (bool, error)
- func SetEnvVarsForComponentImageDeployment(rctx *rulesengine.RuleCtx) error
- func SetupMultiPlatformTests() error
Constants ¶
This section is empty.
Variables ¶
View Source
var BootstrapClusterRuleChain = rulesengine.Rule{Name: "BoostrapCluster RuleChain", Description: "Rule Chain that installs Konflux in preview mode and when required, registers it with a SprayProxy and sets up MP tests", Condition: rulesengine.All{&InstallKonfluxRule, &RegisterKonfluxToSprayProxyRule, &SetupMultiPlatformTestsRule}, }
View Source
var BootstrapClusterWithSprayProxyRuleChain = rulesengine.Rule{Name: "BoostrapCluster with SprayProxy RuleChain", Description: "Rule Chain that installs Konflux in preview mode and registers it with SprayProxy", Condition: rulesengine.All{&InstallKonfluxRule, &RegisterKonfluxToSprayProxyRule}, }
View Source
var BuildNonTestFileChangeRule = rulesengine.Rule{Name: "E2E PR Build Test Helper Files Change Rule", Description: "Map build tests files when const.go or source_build.go file is changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("tests/build/const.go")) != 0 || len(rctx.DiffFiles.FilterByDirGlob("tests/build/source_build.go")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { for _, file := range rctx.DiffFiles.FilterByDirGlob("tests/build/*.go") { if strings.Contains(file.Name, "source_build.go") || strings.Contains(file.Name, "const.go") || strings.Contains(file.Name, "scenarios.go") { continue } rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, file.Name) } return nil })}}
View Source
var BuildServiceCICatalog = rulesengine.RuleCatalog{BuildServiceCIRule}
View Source
var BuildServiceCIRule = rulesengine.Rule{Name: "build-service repo CI Workflow Rule", Description: "Execute the full workflow for e2e-tests repo in CI", Condition: rulesengine.All{ &BuildServiceRepoSetDefaultSettingsRule, rulesengine.Any{&InfraDeploymentsPRPairingRule, rulesengine.None{&InfraDeploymentsPRPairingRule}}, &PreflightInstallGinkgoRule, &BootstrapClusterWithSprayProxyRuleChain, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteTestAction)}, }
View Source
var BuildServiceRepoSetDefaultSettingsRule = rulesengine.Rule{Name: "General Required Settings for build-service repository jobs", Description: "Set SprayProxy settings to true for build-service jobs before bootstrap", Condition: rulesengine.Any{ IsBuildServiceRepoPR, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { rctx.RequiresSprayProxyRegistering = true klog.Info("require sprayproxy registering is set to TRUE") rctx.LabelFilter = "build-service" klog.Info("setting 'build-service' test label") if rctx.DryRun { klog.Info("setting up env vars for deploying component image") return nil } rctx.ComponentEnvVarPrefix = "BUILD_SERVICE" if os.Getenv("KONFLUX_CI") == "true" { rctx.ComponentImageTag = fmt.Sprintf("on-pr-%s", rctx.PrCommitSha) } else { rctx.ComponentImageTag = "redhat-appstudio-build-service-image" } return SetEnvVarsForComponentImageDeployment(rctx) })}, }
View Source
var BuildTemplateScenarioFileChangeRule = rulesengine.Rule{Name: "E2E PR Build Template Scenario File Changed Rule", Description: "Map build tests files when build template scenario file is changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirString("tests/build/build_templates_scenario.go")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { foundInDiff := false for _, file := range rctx.DiffFiles.FilterByDirString("tests/build/build_templates.go") { rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, file.Name) foundInDiff = true } if !foundInDiff { rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, "tests/build/build_templates.go") } return nil })}}
View Source
var BuildTestFileChangeOnlyRule = rulesengine.Rule{Name: "E2E PR Build Test File Change Only Rule", Description: "Map build tests files when build test file are only changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirString("tests/build/build_templates_scenario.go")) == 0 && len(rctx.DiffFiles.FilterByDirString("tests/build/const.go")) == 0 && len(rctx.DiffFiles.FilterByDirString("tests/build/source_build.go")) == 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { for _, file := range rctx.DiffFiles.FilterByDirGlob("tests/build/*.go") { rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, file.Name) } return nil })}}
View Source
var DemoCatalog = rulesengine.RuleCatalog{LocalE2EDemoRuleChain}
View Source
var E2ECIChainCatalog = rulesengine.RuleCatalog{E2ERepoCIRuleChain}
View Source
var E2ERepoCIRuleChain = rulesengine.Rule{Name: "E2E Repo CI Workflow Rule Chain", Description: "Execute the full workflow for e2e-tests repo in CI", Condition: rulesengine.All{ &E2ERepoSetDefaultSettingsRule, rulesengine.Any{&InfraDeploymentsPRPairingRule, rulesengine.None{&InfraDeploymentsPRPairingRule}}, &PreflightInstallGinkgoRule, &BootstrapClusterRuleChain, rulesengine.Any{&NonTestFilesRule, &NonTestFilesRuleWithReleasePipelines, &TestFilesOnlyRule}}, }
View Source
var E2ERepoSetDefaultSettingsRule = rulesengine.Rule{Name: "General Required Settings for E2E Repo Jobs", Description: "Set multiplatform and SprayProxy settings to true for e2e-tests jobs before bootstrap", Condition: rulesengine.Any{ IsE2ETestsRepoPR, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { var err error rctx.RequiresMultiPlatformTests = true rctx.RequiresSprayProxyRegistering = true klog.Info("multi-platform tests and require sprayproxy registering are set to TRUE") rctx.DiffFiles, err = utils.GetChangedFiles(rctx.RepoName) return err })}, }
View Source
var E2ETestRulesCatalog = rulesengine.RuleCatalog{NonTestFilesRule, NonTestFilesRuleWithReleasePipelines, TestFilesOnlyRule}
View Source
var EcTestFileChangeRule = rulesengine.Rule{Name: "E2E PR EC Test File Change Rule", Description: "Map EC tests files when EC test files are changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("tests/enterprise-*/*.go")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { for _, file := range rctx.DiffFiles.FilterByDirGlob("tests/enterprise-*/*.go") { rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, file.Name) } return nil })}}
View Source
var ImageControllerCICatalog = rulesengine.RuleCatalog{ImageControllerCIRule}
View Source
var ImageControllerCIRule = rulesengine.Rule{Name: "image-controller repo CI Workflow Rule", Description: "Execute the full workflow for e2e-tests repo in CI", Condition: rulesengine.All{ &ImageControllerRepoSetDefaultSettingsRule, rulesengine.Any{&InfraDeploymentsPRPairingRule, rulesengine.None{&InfraDeploymentsPRPairingRule}}, &PreflightInstallGinkgoRule, &BootstrapClusterWithSprayProxyRuleChain, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteTestAction)}, }
View Source
var ImageControllerRepoSetDefaultSettingsRule = rulesengine.Rule{Name: "General Required Settings for image-controller repository jobs", Description: "Set SprayProxy settings to true for image-controller jobs before bootstrap", Condition: rulesengine.Any{ IsImageControllerRepoPR, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { rctx.RequiresSprayProxyRegistering = true klog.Info("require sprayproxy registering is set to TRUE") rctx.LabelFilter = "image-controller" klog.Info("setting 'image-controller' test label") if rctx.DryRun { klog.Info("setting up env vars for deploying component image") return nil } rctx.ComponentEnvVarPrefix = "IMAGE_CONTROLLER" if os.Getenv("KONFLUX_CI") == "true" { rctx.ComponentImageTag = fmt.Sprintf("on-pr-%s", rctx.PrCommitSha) } else { rctx.ComponentImageTag = "redhat-appstudio-image-controller-image" } return SetEnvVarsForComponentImageDeployment(rctx) })}, }
View Source
var InfraDeploymentsBuildServiceComponentChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Build Service component File Change Rule (excluding build-pipeline-config)", Description: "Map build service tests files when files in build-service are changed except build-pipeline-config.yaml", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("components/build-service/**/*")) > len(rctx.DiffFiles.FilterByDirGlob("components/build-service/base/build-pipeline-config/*")), nil }), Actions: []rulesengine.Action{ rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { AddLabelToLabelFilter(rctx, "build-service") return nil }), }, }
View Source
var InfraDeploymentsBuildTemplatesComponentChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Build-templates component File Change Rule", Description: "Map build-templates tests files when build-pipeline-config.yaml is changed", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("components/build-service/base/build-pipeline-config/build-pipeline-config.yaml")) != 0, nil }), Actions: []rulesengine.Action{ rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { AddLabelToLabelFilter(rctx, "build-templates") return nil }), }, }
View Source
var InfraDeploymentsComponentsRule = rulesengine.Rule{Name: "Infra-deployments PR Components File Diff Execution", Description: "Runs specific tests of changed component by infra-deployments PR.", Condition: rulesengine.Any{ &InfraDeploymentsIntegrationComponentChangeRule, &InfraDeploymentsImageControllerComponentChangeRule, &InfraDeploymentsMultiPlatformComponentChangeRule, &InfraDeploymentsBuildTemplatesComponentChangeRule, &InfraDeploymentsBuildServiceComponentChangeRule, &InfraDeploymentsReleaseServiceComponentChangeRule, &InfraDeploymentsEnterpriseControllerComponentChangeRule, &InfraDeploymentsJVMComponentChangeRule}, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { AddLabelToLabelFilter(rctx, "konflux") return nil }), rulesengine.ActionFunc(ExecuteTestAction)}}
InfraDeploymentsComponentsRule defines rules of test suites running of each changed component
View Source
var InfraDeploymentsDefaultRule = rulesengine.Rule{Name: "Infra Deployments Default Test Execution", Description: "Run the Konflux-demo suite tests when an Infra-deployments PR includes changes to files outside of the specified components.", Condition: rulesengine.None{ &InfraDeploymentsIntegrationComponentChangeRule, &InfraDeploymentsImageControllerComponentChangeRule, &InfraDeploymentsMultiPlatformComponentChangeRule, &InfraDeploymentsBuildTemplatesComponentChangeRule, &InfraDeploymentsBuildServiceComponentChangeRule, &InfraDeploymentsReleaseServiceComponentChangeRule, &InfraDeploymentsEnterpriseControllerComponentChangeRule, &InfraDeploymentsJVMComponentChangeRule, rulesengine.ConditionFunc(CheckNoFilesChanged)}, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteInfraDeploymentsDefaultTestAction)}}
Default Rule of repo infra-deployments running konflux-demo suite.
View Source
var InfraDeploymentsEnterpriseControllerComponentChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Enterprise Controller component File Change Rule", Description: "Map Enterprise Controller tests files when EC component files are changed in the infra-deployments PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("components/enterprise-contract/**/*")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { AddLabelToLabelFilter(rctx, "ec") return nil })}}
View Source
var InfraDeploymentsImageControllerComponentChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Image Controller component File Change Rule", Description: "Map image-controller tests files when Image Controller component files are changed in the infra-deployments PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("components/image-controller/**/*")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { AddLabelToLabelFilter(rctx, "image-controller") return nil })}}
View Source
var InfraDeploymentsIntegrationComponentChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Integration component File Change Rule", Description: "Map Integration tests files when Integration component files are changed in the infra-deployments PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("components/integration/**/*")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { AddLabelToLabelFilter(rctx, "integration-service") return nil })}}
View Source
var InfraDeploymentsJVMComponentChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Jvm-build-service component File Change Rule", Description: "Map jvm-build-service tests files when Jvm-build-service component files are changed in the infra-deployments PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("components/jvm-build-service/**/*")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { AddLabelToLabelFilter(rctx, "jvm-build-service") return nil })}}
View Source
var InfraDeploymentsMultiPlatformComponentChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Multi Controller component File Change Rule", Description: "Map multi platform tests files when Multi Controller component files are changed in the infra-deployments PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("components/multi-platform-controller/**/*")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { AddLabelToLabelFilter(rctx, "multi-platform") return nil })}}
View Source
var InfraDeploymentsPRPairingRule = rulesengine.Rule{Name: "Set Required Settings for E2E Repo PR Paired Job", Description: "Set up required infra-deployments variables for e2e-tests repo PR paired job before bootstrap ", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { if rctx.DryRun { if true { klog.Infof("Found infra deployments branch %s for author %s", rctx.PrBranchName, rctx.PrRemoteName) return true, nil } else { return false, fmt.Errorf("cannot determine infra-deployments Github branches for author %s: none. will stick with the redhat-appstudio/infra-deployments main branch for running tests", rctx.PrRemoteName) } } return IsPRPairingRequired("infra-deployments", rctx.PrRemoteName, rctx.PrBranchName), nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { if rctx.DryRun { klog.Infof("Set INFRA_DEPLOYMENTS_ORG: %s", rctx.PrRemoteName) klog.Infof("Set INFRA_DEPLOYMENTS_BRANCH: %s", rctx.PrBranchName) return nil } klog.Infof("pairing with infra-deployments org %q and branch %q", rctx.PrRemoteName, rctx.PrBranchName) os.Setenv("INFRA_DEPLOYMENTS_ORG", rctx.PrRemoteName) os.Setenv("INFRA_DEPLOYMENTS_BRANCH", rctx.PrBranchName) return nil })}, }
View Source
var InfraDeploymentsReleaseServiceComponentChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Release service component File Change Rule", Description: "Map release service tests files when Release service component files are changed in the infra-deployments PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("components/release/**/*")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { AddLabelToLabelFilter(rctx, "release-service") return nil })}}
View Source
var InfraDeploymentsRulesCatalog = rulesengine.RuleCatalog{InfraDeploymentsDefaultRule, InfraDeploymentsComponentsRule}
View Source
var InstallKonfluxRule = rulesengine.Rule{Name: "Install Konflux", Description: "Install Konflux in preview mode on a cluster.", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return os.Getenv("SKIP_BOOTSTRAP") != "true", nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { if rctx.DryRun { klog.Info("Installing Konflux in Preview mode.") klog.Info("Konflux Installation Complete.") return nil } return retry(InstallKonflux, 2, 10*time.Second) }), }, }
View Source
var IntegrationServiceCICatalog = rulesengine.RuleCatalog{IntegrationServiceCIRule}
View Source
var IntegrationServiceCIRule = rulesengine.Rule{Name: "Integration-service repo CI Workflow Rule", Description: "Execute the full workflow for e2e-tests repo in CI", Condition: rulesengine.All{ &IntegrationServiceRepoSetDefaultSettingsRule, rulesengine.Any{&InfraDeploymentsPRPairingRule, rulesengine.None{&InfraDeploymentsPRPairingRule}}, &PreflightInstallGinkgoRule, &BootstrapClusterWithSprayProxyRuleChain, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteTestAction)}, }
View Source
var IntegrationServiceRepoSetDefaultSettingsRule = rulesengine.Rule{Name: "General Required Settings for integration-service repository jobs", Description: "Set SprayProxy settings to true for integration-service jobs before bootstrap", Condition: rulesengine.Any{ IsIntegrationServiceRepoPR, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { rctx.RequiresSprayProxyRegistering = true klog.Info("require sprayproxy registering is set to TRUE") rctx.LabelFilter = "integration-service" klog.Info("setting 'integration-service' test label") if rctx.DryRun { klog.Info("setting up env vars for deploying component image") return nil } rctx.ComponentEnvVarPrefix = "INTEGRATION_SERVICE" if os.Getenv("KONFLUX_CI") == "true" { rctx.ComponentImageTag = fmt.Sprintf("on-pr-%s", rctx.PrCommitSha) } else { rctx.ComponentImageTag = "redhat-appstudio-integration-service-image" } return SetEnvVarsForComponentImageDeployment(rctx) })}, }
View Source
var IntegrationTestsConstFileChangeRule = rulesengine.Rule{Name: "E2E PR Integration TestFile Change Rule", Description: "Map all integration tests files when integration const files are changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("tests/integration-*/const.go")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { matched, err := filepath.Glob("tests/integration-*/*.go") if err != nil { return err } for _, matched := range matched { if strings.Contains(matched, "const.go") { continue } rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, matched) } return nil })}}
View Source
var IntegrationTestsFileChangeRule = rulesengine.Rule{Name: "E2E PR Integration TestFile Change Rule", Description: "Map integration tests files when integration test files are changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("tests/integration-*/*.go")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { for _, file := range rctx.DiffFiles.FilterByDirGlob("tests/integration-*/*.go") { if strings.Contains(file.Name, "const.go") { continue } rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, file.Name) } return nil })}}
View Source
var IsBuildServiceRepoPR = rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { klog.Info("checking if repository is build-service") return rctx.RepoName == "build-service", nil })
View Source
var IsE2ETestsRepoPR = rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { klog.Info("checking if repository is e2e-tests") return rctx.RepoName == "e2e-tests", nil })
View Source
var IsImageControllerRepoPR = rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { klog.Info("checking if repository is image-controller") return rctx.RepoName == "image-controller", nil })
View Source
var IsIntegrationServiceRepoPR = rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { klog.Info("checking if repository is integration-service") return rctx.RepoName == "integration-service", nil })
View Source
var IsReleaseServiceCatalogRepoPR = rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { klog.Info("checking if repository is release-service-catalog") return rctx.RepoName == "release-service-catalog", nil })
View Source
var IsReleaseServiceRepoPR = rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { klog.Info("checking if repository is release-service") return rctx.RepoName == "release-service", nil })
View Source
var KonfluxDemoConfigsFileOnlyChangeRule = rulesengine.Rule{Name: "E2E PR Konflux-Demo Config File Change Only Rule", Description: "Map demo tests files when konflux-demo config.go|type.go test files are changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("tests/*-demo/*.go")) == 0 && len(rctx.DiffFiles.FilterByDirGlob("tests/*-demo/*/*")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { matched, err := filepath.Glob("tests/*-demo/*-demo.go") if err != nil { return err } for _, matched := range matched { rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, matched) } return nil })}}
View Source
var KonfluxDemoTestFileChangedRule = rulesengine.Rule{Name: "E2E PR Konflux-Demo Test File Diff Map", Description: "Map demo tests files when konflux-demo test files are changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("tests/*-demo/*.go")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { for _, file := range rctx.DiffFiles.FilterByDirGlob("tests/*-demo/*-demo.go") { rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, file.Name) } return nil })}}
View Source
var LocalE2EDemoRuleChain = rulesengine.Rule{Name: "Local Install and Test Run of e2e-repo", Description: "Install Konflux to a cluster and run tests based on file changes within the e2e-repo when executed from local system.", Condition: rulesengine.All{&preflight_check_rule, rulesengine.Any{&NonTestFilesRule, &TestFilesOnlyRule}}, }
View Source
var NonTestFilesRule = rulesengine.Rule{Name: "E2E Default PR Test Exectuion", Description: "Runs all suites when any non test files are modified in the e2e-repo PR", Condition: rulesengine.All{ rulesengine.Any{ rulesengine.ConditionFunc(CheckPkgFilesChanged), rulesengine.ConditionFunc(CheckMageFilesChanged), rulesengine.ConditionFunc(CheckCmdFilesChanged), rulesengine.ConditionFunc(CheckNoFilesChanged), rulesengine.ConditionFunc(CheckTektonFilesChanged), }, rulesengine.None{rulesengine.ConditionFunc(CheckReleasePipelinesTestsChanged)}, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteDefaultTestAction)}, }
View Source
var NonTestFilesRuleWithReleasePipelines = rulesengine.Rule{Name: "E2E PR Test Execution including release-pipelines test suite", Description: "Runs all test suites including release-pipelines test suite which is usually excluded on PRs", Condition: rulesengine.All{ rulesengine.Any{ rulesengine.ConditionFunc(CheckPkgFilesChanged), rulesengine.ConditionFunc(CheckMageFilesChanged), rulesengine.ConditionFunc(CheckCmdFilesChanged), rulesengine.ConditionFunc(CheckTektonFilesChanged), }, rulesengine.ConditionFunc(CheckReleasePipelinesTestsChanged), }, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteAllTestsExceptUpgradeTestSuite)}, }
View Source
var PreflightInstallGinkgoRule = rulesengine.Rule{Name: "Preflight Check", Description: "Check the envroniment has all the minimal pre-req variables/tools installed and install ginkgo.", Condition: rulesengine.ConditionFunc(IsPrelightChecked), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { if rctx.DryRun { klog.Info("Installing Ginkgo Test Runner") klog.Info("Running command: go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo") klog.Info("Ginkgo Installation Complete.") return nil } return sh.RunV("go", "install", "-mod=mod", "github.com/onsi/ginkgo/v2/ginkgo") }), }, }
View Source
var PrepareBranchRule = rulesengine.Rule{Name: "Prepare E2E branch for CI", Description: "Checkout the e2e-tests repo for CI when the PR is paired with e2e-tests repo", Condition: rulesengine.All{rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { if rctx.DryRun { if true { klog.Infof("Found e2e-tests branch %s for author %s", rctx.PrBranchName, rctx.PrRemoteName) return true, nil } } return IsPRPairingRequired("e2e-tests", rctx.PrRemoteName, rctx.PrBranchName), nil }), rulesengine.None{rulesengine.ConditionFunc(IsPeriodicJob), rulesengine.ConditionFunc(IsRehearseJob)}}, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { if rctx.DryRun { for _, arg := range [][]string{ {"remote", "add", rctx.PrRemoteName, fmt.Sprintf("https://github.com/%s/e2e-tests.git", rctx.PrRemoteName)}, {"fetch", rctx.PrRemoteName}, {"checkout", rctx.PrCommitSha}, {"pull", "--rebase", "upstream", "main"}, } { klog.Infof("git %s", arg) } return nil } return GitCheckoutRemoteBranch(rctx.PrRemoteName, rctx.PrBranchName) })}}
View Source
var RegisterKonfluxToSprayProxyRule = rulesengine.Rule{Name: "Register SprayProxy", Description: "Register Konflux with a SprayProxy.", Condition: rulesengine.Any{ rulesengine.ConditionFunc(IsSprayProxyRequired), }, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { if rctx.DryRun { klog.Info("Registering Konflux to SprayProxy.") klog.Info("Registration Complete.") return nil } err := registerPacServer() if err != nil { os.Setenv(constants.SKIP_PAC_TESTS_ENV, "true") if alertErr := HandleErrorWithAlert(fmt.Errorf("failed to register SprayProxy: %+v", err), slack.ErrorSeverityLevelError); alertErr != nil { return alertErr } } return nil }), }, }
View Source
var ReleaseServiceCICatalog = rulesengine.RuleCatalog{ReleaseServiceCIRule}
View Source
var ReleaseServiceCIRule = rulesengine.Rule{Name: "Release-service repo CI Workflow Rule", Description: "Execute the full workflow for release-service repo in CI", Condition: rulesengine.All{ &ReleaseServiceRepoSetDefaultSettingsRule, rulesengine.Any{&InfraDeploymentsPRPairingRule, rulesengine.None{&InfraDeploymentsPRPairingRule}}, &PreflightInstallGinkgoRule, &InstallKonfluxRule, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteTestAction)}, }
View Source
var ReleaseServiceCatalogCICatalog = rulesengine.RuleCatalog{ReleaseServiceCatalogCIPairedRule, ReleaseServiceCatalogCIRule}
View Source
var ReleaseServiceCatalogCIPairedRule = rulesengine.Rule{Name: "Release-service-catalog repo CI Workflow Paired Rule", Description: "Execute the Paired workflow for release-service-catalog repo in CI", Condition: rulesengine.All{ rulesengine.ConditionFunc(isPaired), rulesengine.None{ rulesengine.ConditionFunc(isRehearse), }, &ReleaseServiceCatalogRepoSetDefaultSettingsRule, rulesengine.Any{&InfraDeploymentsPRPairingRule, rulesengine.None{&InfraDeploymentsPRPairingRule}}, &PreflightInstallGinkgoRule, &InstallKonfluxRule, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteReleaseCatalogPairedAction)}, }
View Source
var ReleaseServiceCatalogCIRule = rulesengine.Rule{Name: "Release-service-catalog repo CI Workflow Rule", Description: "Execute the full workflow for release-service-catalog repo in CI", Condition: rulesengine.All{ rulesengine.Any{ rulesengine.None{rulesengine.ConditionFunc(isPaired)}, rulesengine.ConditionFunc(isRehearse), }, &ReleaseServiceCatalogRepoSetDefaultSettingsRule, rulesengine.Any{&InfraDeploymentsPRPairingRule, rulesengine.None{&InfraDeploymentsPRPairingRule}}, &PreflightInstallGinkgoRule, &InstallKonfluxRule, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteReleaseCatalogAction)}, }
View Source
var ReleaseServiceCatalogRepoSetDefaultSettingsRule = rulesengine.Rule{Name: "General Required Settings for release-service-catalog repository jobs", Description: "relese-service-catalog jobs default rule", Condition: rulesengine.Any{ IsReleaseServiceCatalogRepoPR, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { rctx.LabelFilter = "release-service-catalog" klog.Info("setting 'release-service-catalog' test label") if rctx.DryRun { klog.Info("setting up env vars for deploying component image") return nil } rctx.ComponentEnvVarPrefix = "RELEASE_SERVICE" os.Setenv(fmt.Sprintf("%s_CATALOG_URL", rctx.ComponentEnvVarPrefix), fmt.Sprintf("https://github.com/%s/%s", rctx.PrRemoteName, rctx.RepoName)) os.Setenv(fmt.Sprintf("%s_CATALOG_REVISION", rctx.ComponentEnvVarPrefix), rctx.PrCommitSha) if rctx.IsPaired && !strings.Contains(rctx.JobName, "rehearse") { os.Setenv(fmt.Sprintf("%s_IMAGE_REPO", rctx.ComponentEnvVarPrefix), "quay.io/redhat-user-workloads/rhtap-release-2-tenant/release-service/release-service") pairedSha := GetPairedCommitSha("release-service", rctx) if pairedSha != "" { os.Setenv(fmt.Sprintf("%s_IMAGE_TAG", rctx.ComponentEnvVarPrefix), fmt.Sprintf("on-pr-%s", pairedSha)) } os.Setenv(fmt.Sprintf("%s_PR_OWNER", rctx.ComponentEnvVarPrefix), rctx.PrRemoteName) os.Setenv(fmt.Sprintf("%s_PR_SHA", rctx.ComponentEnvVarPrefix), pairedSha) } return nil })}, }
View Source
var ReleaseServiceRepoSetDefaultSettingsRule = rulesengine.Rule{Name: "General Required Settings for release-service repository jobs", Description: "relese-service jobs default rule", Condition: rulesengine.Any{ IsReleaseServiceRepoPR, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { rctx.LabelFilter = "release-service" klog.Info("setting 'release-service' test label") if rctx.DryRun { klog.Info("setting up env vars for deploying component image") return nil } rctx.ComponentEnvVarPrefix = "RELEASE_SERVICE" if os.Getenv("KONFLUX_CI") == "true" { rctx.ComponentImageTag = fmt.Sprintf("on-pr-%s", rctx.PrCommitSha) } else { rctx.ComponentImageTag = "redhat-appstudio-release-service-image" } os.Setenv(fmt.Sprintf("%s_CATALOG_REVISION", rctx.ComponentEnvVarPrefix), "development") return SetEnvVarsForComponentImageDeployment(rctx) })}, }
View Source
var ReleaseTestHelperFilesChangeOnlyRule = rulesengine.Rule{Name: "E2E PR Release Test Helper File CHange Rule", Description: "Map release tests files when only the release helper go files in root of release directory are changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("tests/release/*.go")) != 0 && len(rctx.DiffFiles.FilterByDirGlob("tests/release/*/*.go")) == 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { matched, err := filepath.Glob("tests/release/*/*.go") if err != nil { return err } for _, matched := range matched { rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, matched) } return nil })}}
View Source
var ReleaseTestTestFilesChangeRule = rulesengine.Rule{Name: "E2E PR Release Test File Change Rule", Description: "Map release test files if they are changed in the e2e-repo PR", Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) { return len(rctx.DiffFiles.FilterByDirGlob("tests/release/*/*.go")) != 0, nil }), Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { for _, file := range rctx.DiffFiles.FilterByDirGlob("tests/release/*/*.go") { rctx.FocusFiles = dedupeAppendFiles(rctx.FocusFiles, file.Name) } return nil })}}
View Source
var SetupMultiPlatformTestsRule = rulesengine.Rule{Name: "Setup multi-platform tests", Description: "Configure tekton tasks for multi-platform tests", Condition: rulesengine.Any{ rulesengine.ConditionFunc(IsMultiPlatformConfigRequired), }, Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error { if rctx.DryRun { klog.Info("Setting up multi platform tests.") klog.Info("Multi platform tests configured.") return nil } return SetupMultiPlatformTests() }), }, }
View Source
var TestFilesOnlyRule = rulesengine.Rule{Name: "E2E PR Test File Diff Execution", Description: "Runs specific tests when test files are the only changes in the e2e-repo PR", Condition: rulesengine.All{ rulesengine.None{ rulesengine.ConditionFunc(CheckPkgFilesChanged), rulesengine.ConditionFunc(CheckMageFilesChanged), rulesengine.ConditionFunc(CheckCmdFilesChanged), rulesengine.ConditionFunc(CheckNoFilesChanged), rulesengine.ConditionFunc(CheckTektonFilesChanged), }, rulesengine.Any{ &BuildTestFileChangeOnlyRule, &BuildTemplateScenarioFileChangeRule, &BuildNonTestFileChangeRule, &KonfluxDemoConfigsFileOnlyChangeRule, &KonfluxDemoTestFileChangedRule, &ReleaseTestHelperFilesChangeOnlyRule, &ReleaseTestTestFilesChangeRule, &IntegrationTestsConstFileChangeRule, &IntegrationTestsFileChangeRule, &EcTestFileChangeRule, }, }, Actions: []rulesengine.Action{rulesengine.ActionFunc(ExecuteTestAction)}}
Functions ¶
func AddLabelToLabelFilter ¶
func AddLabelToLabelFilter(rctx *rulesengine.RuleCtx, label string)
AddLabelToLabelFilter ensures the given label is added to the LabelFilter of rctx
func CheckCmdFilesChanged ¶
func CheckCmdFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
func CheckMageFilesChanged ¶
func CheckMageFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
func CheckNoFilesChanged ¶
func CheckNoFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
func CheckPkgFilesChanged ¶
func CheckPkgFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
func CheckReleasePipelinesTestsChanged ¶
func CheckReleasePipelinesTestsChanged(rctx *rulesengine.RuleCtx) (bool, error)
func CheckTektonFilesChanged ¶
func CheckTektonFilesChanged(rctx *rulesengine.RuleCtx) (bool, error)
func ExecuteAllTestsExceptUpgradeTestSuite ¶
func ExecuteAllTestsExceptUpgradeTestSuite(rctx *rulesengine.RuleCtx) error
func ExecuteDefaultTestAction ¶
func ExecuteDefaultTestAction(rctx *rulesengine.RuleCtx) error
func ExecuteInfraDeploymentsDefaultTestAction ¶
func ExecuteInfraDeploymentsDefaultTestAction(rctx *rulesengine.RuleCtx) error
ExecuteInfraDeploymentsDefaultTestAction excutes all the e2e-tests and component suites
func ExecuteReleaseCatalogAction ¶
func ExecuteReleaseCatalogAction(rctx *rulesengine.RuleCtx) error
func ExecuteReleaseCatalogPairedAction ¶
func ExecuteReleaseCatalogPairedAction(rctx *rulesengine.RuleCtx) error
func ExecuteTestAction ¶
func ExecuteTestAction(rctx *rulesengine.RuleCtx) error
func GetPairedCommitSha ¶
func GetPairedCommitSha(repoForPairing string, rctx *rulesengine.RuleCtx) string
func GitCheckoutRemoteBranch ¶
func HandleErrorWithAlert ¶
func HandleErrorWithAlert(err error, errLevel slack.ErrorSeverityLevel) error
func InstallKonflux ¶
func InstallKonflux() error
func IsLoadTestJob ¶
func IsLoadTestJob(rctx *rulesengine.RuleCtx) (bool, error)
func IsMultiPlatformConfigRequired ¶
func IsMultiPlatformConfigRequired(rctx *rulesengine.RuleCtx) (bool, error)
func IsPRPairingRequired ¶
func IsPeriodicJob ¶
func IsPeriodicJob(rctx *rulesengine.RuleCtx) (bool, error)
func IsPrelightChecked ¶
func IsPrelightChecked(rctx *rulesengine.RuleCtx) (bool, error)
func IsRehearseJob ¶
func IsRehearseJob(rctx *rulesengine.RuleCtx) (bool, error)
func IsSprayProxyHostSet ¶
func IsSprayProxyHostSet(rctx *rulesengine.RuleCtx) (bool, error)
func IsSprayProxyRequired ¶
func IsSprayProxyRequired(rctx *rulesengine.RuleCtx) (bool, error)
func IsSprayProxyTokenSet ¶
func IsSprayProxyTokenSet(rctx *rulesengine.RuleCtx) (bool, error)
func SetEnvVarsForComponentImageDeployment ¶
func SetEnvVarsForComponentImageDeployment(rctx *rulesengine.RuleCtx) error
func SetupMultiPlatformTests ¶
func SetupMultiPlatformTests() error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.