Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RELEASE-1172): add a mage engine rule for release-service #1394

Merged
merged 19 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
998594d
fix: update_repo in release const.go
jinqi7 Aug 19, 2024
eb3b057
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Aug 21, 2024
ed42660
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Aug 21, 2024
a9d4291
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Aug 22, 2024
1239c89
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Aug 27, 2024
d6d8c59
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Aug 29, 2024
69b5b43
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Aug 29, 2024
eb108c4
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Aug 30, 2024
d7e37d5
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Aug 30, 2024
b9f3d2e
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Aug 30, 2024
b4aa070
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Sep 3, 2024
48589e9
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Sep 4, 2024
249df34
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Sep 4, 2024
9af681a
Merge branch 'main' of https://github.com/redhat-appstudio/e2e-tests
jinqi7 Sep 6, 2024
65373d0
Merge branch 'main' of https://github.com/konflux-ci/e2e-tests
jinqi7 Sep 9, 2024
b14d565
Merge branch 'main' of https://github.com/konflux-ci/e2e-tests
jinqi7 Sep 9, 2024
3f9844c
Merge branch 'main' of https://github.com/konflux-ci/e2e-tests
jinqi7 Sep 11, 2024
de036c7
Merge branch 'main' of https://github.com/konflux-ci/e2e-tests
jinqi7 Sep 18, 2024
0017208
feat(RELEASE-1172): add a mage engine rule for release-service
jinqi7 Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion magefiles/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func (ci CI) TestE2E() error {
}

// Eventually we'll introduce mage rules for all repositories, so this condition won't be needed anymore
if pr.RepoName == "e2e-tests" || pr.RepoName == "integration-service" {
if pr.RepoName == "e2e-tests" || pr.RepoName == "integration-service" || pr.RepoName == "release-service" {
return engine.MageEngine.RunRulesOfCategory("ci", rctx)
}

Expand Down
1 change: 1 addition & 0 deletions magefiles/rulesengine/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var MageEngine = rulesengine.RuleEngine{

"ci": {
"e2e-repo": repos.E2ECIChainCatalog,
"release-service": repos.ReleaseServiceCICatalog,
"integration-service": repos.IntegrationServiceCICatalog,
// TODO: to be implemented in a follow-up PR
//"infra-deployments": repos.InfraDeploymentsCIChainCatalog,
Expand Down
53 changes: 53 additions & 0 deletions magefiles/rulesengine/repos/release_service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package repos

import (
"fmt"
"os"

"github.com/konflux-ci/e2e-tests/magefiles/rulesengine"
"k8s.io/klog"
)

var ReleaseServiceCICatalog = rulesengine.RuleCatalog{ReleaseServiceCIRule}

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)},
}

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"
// TODO keep only "KONFLUX_CI" option once we migrate off openshift-ci
if os.Getenv("KONFLUX_CI") == "true" {
rctx.ComponentImageTag = fmt.Sprintf("on-pr-%s", rctx.PrCommitSha)
} else {
rctx.ComponentImageTag = "redhat-appstudio-release-service-image"
}
//This is env variable is specified for release service
os.Setenv(fmt.Sprintf("%s_CATALOG_REVISION", rctx.ComponentEnvVarPrefix), "development")
Dismissed Show dismissed Hide dismissed
return SetEnvVarsForComponentImageDeployment(rctx)
})},
}

var IsReleaseServiceRepoPR = rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) (bool, error) {
klog.Info("checking if repository is release-service")
return rctx.RepoName == "release-service", nil
})
Loading