You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tkobayas (via GitHub)" <gi...@apache.org> on 2023/11/28 07:58:42 UTC

[PR] [DROOLS-7578] Evaluate Impact analysis for ansible integration rules [incubator-kie-drools]

tkobayas opened a new pull request, #5594:
URL: https://github.com/apache/incubator-kie-drools/pull/5594

   - Introduced DeleteSpecificFactAction for retract_fact
   
   **JIRA**: 
   https://issues.redhat.com/browse/DROOLS-7578
   
   **referenced Pull Requests**: 
   * TBD
   
   <details>
   <summary>
   How to replicate CI configuration locally?
   </summary>
   
   Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use [build-chain tool](https://github.com/kiegroup/github-action-build-chain) to handle cross repository builds and be sure that we always use latest version of the code for each repository.
    
   [build-chain tool](https://github.com/kiegroup/github-action-build-chain) is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See [local execution](https://github.com/kiegroup/github-action-build-chain#local-execution) details to get more information about it.
   </details>
   
   <details>
   <summary>
   How to retest this PR or trigger a specific build:
   </summary>
   
   - for <b>pull request checks</b>  
     Please add comment: <b>Jenkins retest this</b>
   
   - for a <b>specific pull request check</b>  
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] tests</b>
   
   - for a <b>full downstream build</b> 
     - for <b>jenkins</b> job: please add comment: <b>Jenkins run fdb</b>
     - for <b>github actions</b> job: add the label `run_fdb`
   
   - <b>a compile downstream build</b> please  add comment: <b>Jenkins run cdb</b>
   
   - <b>an upstream build</b> please add comment: <b>Jenkins run upstream</b>
   
   - for <b>quarkus branch checks</b>  
     Run checks against Quarkus current used branch  
     Please add comment: <b>Jenkins run quarkus-branch</b>
   
   - for a <b>quarkus branch specific check</b>  
     Run checks against Quarkus current used branch  
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-branch</b>
   
   - for <b>quarkus main checks</b>  
     Run checks against Quarkus main branch  
     Please add comment: <b>Jenkins run quarkus-main</b>
   
   - for a <b>specific quarkus main check</b>  
     Run checks against Quarkus main branch  
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-main</b>
   
   - for <b>quarkus lts checks</b>  
     Run checks against Quarkus lts branch  
     Please add comment: <b>Jenkins run quarkus-lts</b>
   
   - for a <b>specific quarkus lts check</b>  
     Run checks against Quarkus lts branch  
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-lts</b>
   
   - for <b>native checks</b>  
     Run native checks  
     Please add comment: <b>Jenkins run native</b>
   
   - for a <b>specific native check</b>  
     Run native checks 
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native</b>
   
    - for <b>native lts checks</b>  
     Run native checks against quarkus lts branch
     Please add comment: <b>Jenkins run native-lts</b>
   
   - for a <b>specific native lts check</b>  
     Run native checks against quarkus lts branch
     Please add comment: <b>Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native-lts</b>
   </details>
   
   <details>
   <summary>
   How to backport a pull request to a different branch?
   </summary>
   
   In order to automatically create a **backporting pull request** please add one or more labels having the following format `backport-<branch-name>`, where `<branch-name>` is the name of the branch where the pull request must be backported to (e.g., `backport-7.67.x` to backport the original PR to the `7.67.x` branch).
   
   > **NOTE**: **backporting** is an action aiming to move a change (usually a commit) from a branch (usually the main one) to another one, which is generally referring to a still maintained release branch. Keeping it simple: it is about to move a specific change or a set of them from one branch to another.
   
   Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
   
   If something goes wrong, the author will be notified and at this point a manual backporting is needed.
   
   > **NOTE**: this automated backporting is triggered whenever a pull request on `main` branch is labeled or closed, but both conditions must be satisfied to get the new PR created.
   </details>
   
   <!-- TODO to uncomment if activating the quarkus-3 rewrite PR job -->
   <!-- <details>
   <summary>
   Quarkus-3 PR check is failing ... what to do ?
   </summary>
   The Quarkus 3 check is applying patches from the `.ci/environments/quarkus-3/patches`.
   
   The first patch, called `0001_before_sh.patch`, is generated from Openrewrite `.ci/environments/quarkus-3/quarkus3.yml` recipe. The patch is created to speed up the check. But it may be that some changes in the PR broke this patch.  
   No panic, there is an easy way to regenerate it. You just need to comment on the PR:
   ```
   jenkins rewrite quarkus-3
   ```
   and it should, after some minutes (~20/30min) apply a commit on the PR with the patch regenerated.
   
   Other patches were generated manually. If any of it fails, you will need to manually update it... and push your changes.
   </details> -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DROOLS-7578] Evaluate Impact analysis for ansible integration rules [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #5594:
URL: https://github.com/apache/incubator-kie-drools/pull/5594#issuecomment-1844771512

   @mariofusco Please merge this, thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DROOLS-7578] Evaluate Impact analysis for ansible integration rules [incubator-kie-drools]

Posted by "mariofusco (via GitHub)" <gi...@apache.org>.
mariofusco merged PR #5594:
URL: https://github.com/apache/incubator-kie-drools/pull/5594


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DROOLS-7578] Evaluate Impact analysis for ansible integration rules [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #5594:
URL: https://github.com/apache/incubator-kie-drools/pull/5594#issuecomment-1837944817

   In order to implement ansible-rulebook visualization, I added `DeleteSpecificFactAction` which means a fact with specified property values (ansible-rulebook `retract_fact` can do that).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DROOLS-7578] Evaluate Impact analysis for ansible integration rules [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #5594:
URL: https://github.com/apache/incubator-kie-drools/pull/5594#issuecomment-1838025447

   @mariofusco @pibizza Please review, thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DROOLS-7578] Evaluate Impact analysis for ansible integration rules [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on code in PR #5594:
URL: https://github.com/apache/incubator-kie-drools/pull/5594#discussion_r1413728633


##########
drools-impact-analysis/drools-impact-analysis-itests/src/test/java/org/drools/impact/analysis/integrationtests/DeleteSpecificFactActionTest.java:
##########
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.drools.impact.analysis.integrationtests;
+
+import java.util.List;
+
+import org.drools.impact.analysis.graph.Graph;
+import org.drools.impact.analysis.graph.ModelToGraphConverter;
+import org.drools.impact.analysis.graph.ReactivityType;
+import org.drools.impact.analysis.integrationtests.domain.Address;
+import org.drools.impact.analysis.integrationtests.domain.Person;
+import org.drools.impact.analysis.model.AnalysisModel;
+import org.drools.impact.analysis.model.right.ConsequenceAction;
+import org.drools.impact.analysis.model.right.DeleteSpecificFactAction;
+import org.drools.impact.analysis.model.right.SpecificProperty;
+import org.drools.impact.analysis.parser.ModelBuilder;
+import org.junit.Test;
+
+/**
+ * This test is to verify that DeleteSpecificFactAction can be handled correctly.
+ * DeleteSpecificFactAction cannot be created by ModelBuilder from DRL, so we programmatically add it to the model.
+ */
+public class DeleteSpecificFactActionTest extends AbstractGraphTest {
+
+    @Test
+    public void insertDeleteSpecific() {
+        String str =
+                "package mypkg;\n" +
+                        "import " + Person.class.getCanonicalName() + ";" +
+                        "import " + Address.class.getCanonicalName() + ";" +
+                        "rule R1 when\n" +
+                        "  $p : Person(name == \"John\")\n" +
+                        "then\n" +
+                        "  Address address = new Address();" +
+                        "  address.setStreet(\"ABC\");" +
+                        "  insert(address);" +
+                        "end\n" +
+                        "rule R2 when\n" +
+                        "  $p : Person(name == \"Paul\")\n" +
+                        "then\n" +
+                        // Here, delete a fact with street == "ABC" (ansible-rulebook can do it)
+                        "end\n" +
+                        "rule R3 when\n" +
+                        "  $a : Address(street == \"ABC\")\n" +
+                        "then\n" +
+                        "end\n";
+
+        AnalysisModel analysisModel = new ModelBuilder().build(str);
+
+        // Tweak analysisModel because DeleteSpecificFactAction cannot be created by ModelBuilder
+        List<ConsequenceAction> actions = analysisModel.getPackages().get(0).getRules().get(1).getRhs().getActions();
+        DeleteSpecificFactAction deleteSpecificFactAction = new DeleteSpecificFactAction(Address.class);
+        deleteSpecificFactAction.addSpecificProperty(new SpecificProperty("street", "ABC"));
+        actions.add(deleteSpecificFactAction);

Review Comment:
   Sorry that this test case is tricky, because it's only available in ansible-rulebook.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org


Re: [PR] [DROOLS-7578] Evaluate Impact analysis for ansible integration rules [incubator-kie-drools]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on PR #5594:
URL: https://github.com/apache/incubator-kie-drools/pull/5594#issuecomment-1837948089

   GHA Ansible Integration : Cross-repository build doesn't work because `drools` and `drools-ansible-rulebook-integration` have different upstream repos. Ignore.
   
   Jenkins : Not related to this PR
   ```
   ls: cannot access '/var/run/docker.sock': No such file or directory
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org