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(KONFLUX-3187): adding test selection logic for repo infra-deploy… #1323

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

kasemAlem
Copy link
Contributor

@kasemAlem kasemAlem commented Aug 8, 2024

  • Add Rules for the infra-deployments so changes in a specific component in infra-deployments runs it's suite
  • If changes are out of components it runs the default konflux-demo suite
  • Fixed the getChangedFiles to look into infra-deployments adding to the e2e-tests

1- Examples from local Run :
in the tmp/infra-deployments created a new branch , edited README of components/integration , added committed
ran the DryRun , so we expect that the LabelFilter have both "integration-service" and "konflux-demo":

exec: git "-C" "/home/kasemalem/integration-project/e2e-tests/tmp/infra-deployments" "diff" "--name-status" "main..HEAD"
I0815 15:47:48.094713  520112 utils.go:474] The following files, components/integration/README.md, were changed!
I0815 15:47:48.094747  520112 types.go:72] Loading the catalog for, infra-deployments, from category, tests
I0815 15:47:48.094759  520112 types.go:144] The following rules have matched Infra-deployments PR Components File Diff Execution.

exec: ginkgo "--seed=1723726067" "--timeout=1h30m0s" "--grace-period=30s" "--output-interceptor-mode=none" "--label-filter=,integration-service,konflux-demo" "--junit-report=e2e-report.xml" "--p" "--output-dir=." "./cmd" "--"

2- Example of local Run :

Changing only the README.md file in Infra-deployments folder so we expect that only the konflux-demo run

exec: git "-C" "/home/kasemalem/integration-project/e2e-tests/tmp/infra-deployments" "diff" "--name-status" "main..HEAD"
I0815 16:01:32.736127  526636 utils.go:474] The following files, README.md, were changed!
I0815 16:01:32.736182  526636 types.go:72] Loading the catalog for, infra-deployments, from category, tests
I0815 16:01:32.736198  526636 types.go:144] The following rules have matched Infra Deployments Default Test Execution.
I0815 16:01:32.736203  526636 types.go:169] Will apply rules
exec: ginkgo "--seed=1723726891" "--timeout=1h30m0s" "--grace-period=30s" "--output-interceptor-mode=none" "--label-filter=konflux-demo" "--junit-report=e2e-report.xml" "--p" "--output-dir=." "./cmd" "--"

3- Example when no file was changed:

exec: git "-C" "/home/kasemalem/integration-project/e2e-tests/tmp/infra-deployments" "diff" "--name-status" "main..HEAD"
I0815 16:16:29.763682  534150 utils.go:461] Found no changed files.
I0815 16:16:29.763749  534150 types.go:72] Loading the catalog for, infra-deployments, from category, tests
I0815 16:16:29.763766  534150 types.go:144] The following rules have matched .
I0815 16:16:29.763772  534150 types.go:169] Will apply rules

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

KONFLUX-3187

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added meaningful description with JIRA/GitHub issue key(if applicable), for example HASSuiteDescribe("STONE-123456789 devfile source")
  • I have updated labels (if needed)

Copy link

openshift-ci bot commented Aug 8, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Contributor

@Dannyb48 Dannyb48 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the only thing missing to be able to test this is the change in the magefile so that we can test/use against infra-deployments, right? Similar to this one

if openshiftJobSpec.Refs.Repo == "release-service-catalog" {

}

// Rule Catalog for the infra-deployments repo running specicfc suites
var InfraDeploymentsTestFilesOnlyRule = rulesengine.Rule{Name: "E2E PR Test File Diff Execution",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the name and description here


// ExecuteInfraDeploymentsDefaultTestAction excutes all the e2e-tests and component suites
func ExecuteInfraDeploymentsDefaultTestAction(rctx *rulesengine.RuleCtx) error {
rctx.LabelFilter = "konflux-demo,release-service,jvm-build-service,image-controller,integration-service,ec,build-templates,multi-platform,build-service"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we only want to run the konflux-demo in this scenario?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right,
re checked the related chart
fixed, just set the konflux-demo one .

// Rule Catalog for the infra-deployments repo running specicfc suites
var InfraDeploymentsTestFilesOnlyRule = 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.Any{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All/Any combination to capture the use case if a PR changes multiple files in their respective directory? I don't think you need the All here.

})}}

// CheckNoComponentsFilesChanged checks if in repo infra-deployments changed files other than components
func CheckNoComponentsFilesChanged(rctx *rulesengine.RuleCtx) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two different patterns being used for the default rule and the diff files rule. Neither is right or wrong. This comment is more of a consistency of following the same pattern for both rules set. So this one is more of a nitpick. Since you've already written out the rules for each directory, you may want to convert the default rule into a RuleChain as well and us a None conditional check around all the rules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point ,
if I went to implement the default rule based on the RuleChain you mentioned,
would it it be like the suggested below ?

var InfraDeploymetsDefaultRuleChain = 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{&InfraDeploymentsTestFilesOnlyRule},
	Actions:     []rulesengine.Action{rulesengine.ActionFunc(ExecuteInfraDeploymentsDefaultTestAction)},
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kasemAlem I was thinking something like the below. That is what I have in the example from the e2e-test repo

                rulesengine.None{
                        rulesengine.ConditionFunc(CheckPkgFilesChanged),
                        rulesengine.ConditionFunc(CheckMageFilesChanged),
                        rulesengine.ConditionFunc(CheckCmdFilesChanged),
                        rulesengine.ConditionFunc(CheckNoFilesChanged),
                        rulesengine.ConditionFunc(CheckTektonFilesChanged),
                },

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it,
I've replaced it to use the current rules with None ,
also tested

@kasemAlem kasemAlem force-pushed the KONFLUX-3187 branch 3 times, most recently from 3b8f5a9 to 728e38a Compare August 12, 2024 13:50
@kasemAlem
Copy link
Contributor Author

I think the only thing missing to be able to test this is the change in the magefile so that we can test/use against infra-deployments, right? Similar to this one

if openshiftJobSpec.Refs.Repo == "release-service-catalog" {

agree,
I had this part , but for some reason after a rebase it was removed
I've added it back

@kasemAlem kasemAlem requested a review from Dannyb48 August 13, 2024 08:45
@github-actions github-actions bot added > 60 min and removed 1-5 min labels Aug 13, 2024
@kasemAlem kasemAlem marked this pull request as ready for review August 13, 2024 09:06
@openshift-ci openshift-ci bot requested review from dirgim and psturc August 13, 2024 09:06
@github-actions github-actions bot added 1-5 min and removed > 60 min labels Aug 13, 2024
Comment on lines 363 to 369
err = engine.MageEngine.RunRules(rctx, "tests", "infra-deployments")

if err != nil {
return err
}

return nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
err = engine.MageEngine.RunRules(rctx, "tests", "infra-deployments")
if err != nil {
return err
}
return nil
return engine.MageEngine.RunRules(rctx, "tests", "infra-deployments")

rctx.JobName = jobName
rctx.JobType = jobType

files, err := getChangedFiles()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this won't work. We need to get list of changed files from within the infra-deployments directory, but this function lists files from the current (e2e-tests) directory.

I'd suggest to update the getChangedFiles func to accept the parameter for the location of the directory it should run git diff against.
@Dannyb48 wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree,
it didn't work on the infra-deployments , so I've fixed the function
to get the repo and to check the absolute path of infra-deployments
tested and working fine , see examples in description of PR

Comment on lines 56 to 65
return len(rctx.DiffFiles.FilterByDirGlob("components/integration/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/base/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/base/external-secrets/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/development/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/production/base/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/production/stone-prod-p01/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/production/stone-prod-p02/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/rh-certs/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/staging/base/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/staging/stone-stage-p01/*")) != 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think listing all subdirectories not ideal. If someone adds a new dir in one of the listed directories, the filter won't longer be valid.

It sucks that the "path/filepath" pkg doesn't support the double star (/**/*) expression to include all subdirectories. But there's relatively easy workaround.

Let's import the doublestart package and update this line

if matched, _ := filepath.Match(filter, file.Name); !matched {

with

		if matched, _ := doublestar.PathMatch(filter, file.Name); !matched {

which is a method that implements the support for double star

If we do this, then the condition can look like:

Suggested change
return len(rctx.DiffFiles.FilterByDirGlob("components/integration/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/base/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/base/external-secrets/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/development/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/production/base/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/production/stone-prod-p01/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/production/stone-prod-p02/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/rh-certs/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/staging/base/*")) != 0 ||
len(rctx.DiffFiles.FilterByDirGlob("components/integration/staging/stone-stage-p01/*")) != 0
return len(rctx.DiffFiles.FilterByDirGlob("components/integration/**/*")) != 0

wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I really like this! I've found the current standard implementation of filepath.match very limiting. If we implement this we can also clean up the logic in e2e-repo in a separate PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree ,
I've tried the below implementation and tested it locally , on several scenarios
and seems working fine :

var InfraDeploymentsBuildServiceTestFileChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Build service component File Change Rule",
	Description: "Map build service tests files when Build service component files are changed in the infra-deployments PR",
	Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) bool {
		return len(rctx.DiffFiles.FilterByDirGlob("components/build-service/**/*.yaml")) != 0 ||
			len(rctx.DiffFiles.FilterByDirGlob("components/build-service/**/*.go")) != 0
	}),
	Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error {
		AddLabelToLabelFilter(rctx, "build-service")
		return nil
	})}}

this one does not require importing import the doublestart package

but I'm fine with both methods , wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I really like this! I've found the current standard implementation of filepath.match very limiting. If we implement this we can also clean up the logic in e2e-repo in a separate PR

Awesome,
will start implementing with the double star

Copy link
Member

@psturc psturc Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be very surprised if this works with the standard library method, because they still have open issue about it here.

Could you try changing some deeply nested file, e.g. components/build-service/base/build-pipeline-config/build-pipeline-config.yaml and paste the log here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the implementation , tested locally several scenarios
working as expected

Copy link
Contributor Author

@kasemAlem kasemAlem Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be very surprised if this works with the standard library method, because they still have open issue about it golang/go#11862.

Could you try changing some deeply nested file, e.g. components/build-service/base/build-pipeline-config/build-pipeline-config.yaml and paste the log here?

also tested with files README , OWNERS .. 
➜  infra-deployments git:(test-infra) vim components/build-service/base/build-pipeline-config/build-pipeline-config.yaml
➜  infra-deployments git:(test-infra) ✗ git status
On branch test-infra
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   components/build-service/base/build-pipeline-config/build-pipeline-config.yaml

no changes added to commit (use "git add" and/or "git commit -a")
➜  infra-deployments git:(test-infra) ✗ git add components/build-service/base/build-pipeline-config/build-pipeline-config.yaml 
➜  infra-deployments git:(test-infra) ✗ git commit -m "dasa"
[test-infra f20e20c0] dasa
 1 file changed, 1 insertion(+)
➜  e2e-tests git:(KONFLUX-3187) ✗ ./mage -v local:runInfraDeploymentsRuleDemo
Running target: Local:RunInfraDeploymentsRuleDemo
exec: git "-C" "/home/kasemalem/integration-project/e2e-tests/tmp/infra-deployments" "diff" "--name-status" "upstream/main"
I0820 19:43:55.217851   24459 utils.go:473] The following files, components/build-service/base/build-pipeline-config/build-pipeline-config.yaml, were changed!
I0820 19:43:55.217902   24459 types.go:72] Loading the catalog for, infra-deployments, from category, tests
I0820 19:43:55.217918   24459 types.go:144] The following rules have matched Infra-deployments PR Components File Diff Execution.
I0820 19:43:55.217922   24459 types.go:157] DryRun has been enabled will apply them in dry run mode
exec: ginkgo "--seed=1724172235" "--dry-run" "--timeout=1h30m0s" "--grace-period=30s" "--output-interceptor-mode=none" "--label-filter=build-service,konflux" "--p" "--output-dir=." "./cmd" "--"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we implement this we can also clean up the logic in e2e-repo in a separate PR

@Dannyb48 @psturc I've created a task for implementing double star for the e2e-repo KONFLUX-4115

@@ -247,7 +247,7 @@ func (Local) CleanupPrivateRepos() error {
repoNamePrefixes := []string{"build-e2e", "konflux", "multi-platform", "jvm-build-service"}
quayOrgToken := os.Getenv("DEFAULT_QUAY_ORG_TOKEN")
if quayOrgToken == "" {
return fmt.Errorf("%s", quayTokenNotFoundError)
return fmt.Errorf(quayTokenNotFoundError)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking out these changes and rebasing should resolve this issue.

git pull --rebase <remote-name> main

@kasemAlem kasemAlem force-pushed the KONFLUX-3187 branch 3 times, most recently from 9a12a63 to fd821b5 Compare August 20, 2024 16:35
@kasemAlem kasemAlem requested a review from psturc August 20, 2024 16:38
Copy link
Member

@psturc psturc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one question for Sushanta, so let's wait for him

otherwise lgtm

/approve

Description: "Map build-templates tests files when Build-templates component files are changed in the infra-deployments PR",
Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) bool {

return len(rctx.DiffFiles.FilterByDirGlob("components/build-templates/base/**/*")) != 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be "components/build-templates/**/*"?

...or when I think about it, it would maybe make more sense to trigger build-templates tests when the pipeline configmap is updated instead

@tisutisu wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psturc yes you are right. build-definitions changes are promoted through this ConfigMap, it would be good to run build-templates labelled tests when build-pipeline-config.yaml file is updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then for build templates Rule the condition should be like this

Suggested change
return len(rctx.DiffFiles.FilterByDirGlob("components/build-templates/base/**/*")) != 0
return len(rctx.DiffFiles.FilterByDirGlob("components/build-service/base/**/*")) != 0

if any changes was made in components/build-templates trigger any specific suite or the default konflux is fine?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So according to what Sushanta mentioned above, I think we should trigger "build-templates" test, when the related config map is updated, i.e.

return len(rctx.DiffFiles.FilterByDirGlob("components/build-service/base/build-pipeline-config/*")) != 0

And since this would cover the build-templates test scenario, I think we don't need another rule for components/build-templates and its subdirectories, i.e. the default test suite (konflux) should be run.

@tisutisu please correct me if I'm wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@psturc I am okay with this change we should trigger "build-templates" test, when the related config map is updated and don't need another rule for components/build-templates and its subdirectories, i.e. the default test suite (konflux) should be run

Copy link
Contributor Author

@kasemAlem kasemAlem Aug 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,
based on that ,
we should exclude this change from the components/build-service Rule , right ?

 return len(rctx.DiffFiles.FilterByDirGlob("components/build-service/**/*")) != 0 &&
		   len(rctx.DiffFiles.FilterByDirGlob("components/build-service/base/build-pipeline-config/*")) == 0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

components/build-service rule will be there.. but needs to be modified..

  • when this file components/build-service/base/build-pipeline-config/build-pipeline-config.yaml changed, run build-templates labeled tests
  • when changes in other sub-directories inside components/build-service except that build-pipeline-config.yaml, we can run build-service labeled tests

}),
rulesengine.ActionFunc(ExecuteTestAction)}}

var InfraDeploymentsIntegrationTestFileChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Integration component File Change Rule",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the late notice.. will it be good change the naming of the rules for infra-deployment repo .. for readability improvement.. rename InfraDeploymentsIntegrationTestFileChangeRule to something like InfraDeploymentsIntegrationComponentChangeRule

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this,
@psturc wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me

Copy link
Member

@psturc psturc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

just last annoying comment from me!
if we agree on addressing that case in some other PR, feel free to /unhold

/hold

@tisutisu @Dannyb48

Comment on lines +123 to +125
return len(rctx.DiffFiles.FilterByDirGlob("components/build-service/**/*")) != 0 &&
len(rctx.DiffFiles.FilterByDirGlob("components/build-service/base/build-pipeline-config/*")) == 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't cover the case when someone would update

  • components/build-service/base/build-pipeline-config/*
  • and some other files under components/build-service/**/*

but I think that's so rare kind of update that we can address it later if we agree on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this scenario, we would expect that the labels be the three : build-service, build-templates, konflux
am I correct ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ran locally :

infra-deployments git:(test-infra) vim components/build-service/base/build-pipeline-config/build-pipeline-config.yaml 
➜  infra-deployments git:(test-infra) ✗ vim components/build-service/development/kustomization.yaml 
➜  infra-deployments git:(test-infra) ✗ git status
On branch test-infra
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   components/build-service/base/build-pipeline-config/build-pipeline-config.yaml
	modified:   components/build-service/development/kustomization.yaml

no changes added to commit (use "git add" and/or "git commit -a")
➜  infra-deployments git:(test-infra) ✗ git add components/build-service/base/build-pipeline-config/build-pipeline-config.yaml components/build-service/development/kustomization.yaml
➜  infra-deployments git:(test-infra) ✗ git commit -m "dd"
[test-infra 654ae9bd] dd
 2 files changed, 2 insertions(+)

Result:

➜  e2e-tests git:(KONFLUX-3187) ./mage -v local:runInfraDeploymentsRuleDemo                                                                                                   
Running target: Local:RunInfraDeploymentsRuleDemo
exec: git "-C" "/home/kasemalem/integration-project/e2e-tests/tmp/infra-deployments" "diff" "--name-status" "upstream/main"
I0821 17:08:36.789232  823676 utils.go:473] The following files, components/build-service/base/build-pipeline-config/build-pipeline-config.yaml, components/build-service/development/kustomization.yaml, were changed!
I0821 17:08:36.789289  823676 types.go:72] Loading the catalog for, infra-deployments, from category, tests
I0821 17:08:36.789313  823676 types.go:144] The following rules have matched Infra-deployments PR Components File Diff Execution.
I0821 17:08:36.789319  823676 types.go:157] DryRun has been enabled will apply them in dry run mode
exec: ginkgo "--seed=1724249316" "--dry-run" "--timeout=1h30m0s" "--grace-period=30s" "--output-interceptor-mode=none" "--label-filter=build-templates,konflux" "--p" "--output-dir=." "./cmd" "--"

 added a tests selection logic for the infra-deploymnents repo

Signed-off-by: Kasem Alem <[email protected]>

chore: Upgrade testing infrastructure secrets (konflux-ci#1314)

* Upgrade testing infrastructure secrets

* Fix to main branch and remove fake values

---------

Co-authored-by: redhat-appstudio-qe-bot <[email protected]>

Revert "chore: Upgrade testing infrastructure secrets (konflux-ci#1314)"

This reverts commit b6d9fa1.

Reapply "chore: Upgrade testing infrastructure secrets (konflux-ci#1314)"

This reverts commit a60c13d.

Reapply "chore: Upgrade testing infrastructure secrets (konflux-ci#1314)"

This reverts commit 9b9c6fc.
Copy link
Member

@psturc psturc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Comment on lines +132 to +142
var InfraDeploymentsBuildServiceTemplatesComponentChangeRule = rulesengine.Rule{Name: "Infra-deployments PR Build service component and templates File Change Rule",
Description: "Map build service tests files when Build service component and templates files are changed in the infra-deployments PR",
Condition: rulesengine.ConditionFunc(func(rctx *rulesengine.RuleCtx) bool {

return len(rctx.DiffFiles.FilterByDirGlob("components/build-service/**/*")) != 0 &&
len(rctx.DiffFiles.FilterByDirGlob("components/build-service/base/build-pipeline-config/*")) != 0
}),
Actions: []rulesengine.Action{rulesengine.ActionFunc(func(rctx *rulesengine.RuleCtx) error {
AddLabelToLabelFilter(rctx, "build-service")
return nil
})}}
Copy link
Member

@psturc psturc Aug 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unnecessary rule and will lead to applying build-service label even when only files under components/build-service/base/build-pipeline-config/* are changed.

But IMO this is a behavior we can live with for a while until we fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @psturc ,
I've tested it locally and you are right ,
please find the fix #1347

@openshift-ci openshift-ci bot added the lgtm label Aug 21, 2024
Copy link

openshift-ci bot commented Aug 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: psturc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@psturc
Copy link
Member

psturc commented Aug 21, 2024

/unhold

@openshift-merge-bot openshift-merge-bot bot merged commit 208b965 into konflux-ci:main Aug 21, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants