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

[DROOLS-7608] EAP 7.4.15 VFS changes make drools PMML tests fail #25

Closed
wants to merge 1 commit into from

Conversation

tkobayas
Copy link

  • WIP : ugly reflection
  • lots of logging

Thank you for submitting this pull request

NOTE!: kiegroup/drools is maintained only for old branches e.g. 7.x, 7.67.x, 7.67.x-blue.
If you are submitting a PR for main branch, please use apache/incubator-kie-drools instead.

Ports
This is a PR for 7.x

JIRA:
https://issues.redhat.com/browse/DROOLS-7608

How to replicate CI configuration locally?

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 to handle cross repository builds and be sure that we always use latest version of the code for each repository.

build-chain tool 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 details to get more information about it.

How to retest this PR or trigger a specific build:
  • for pull request checks
    Please add comment: Jenkins retest this

  • for a specific pull request check
    Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] tests

  • for a full downstream build

    • for jenkins job: please add comment: Jenkins run fdb
    • for github actions job: add the label run_fdb
  • a compile downstream build please add comment: Jenkins run cdb

  • a full production downstream build please add comment: Jenkins execute product fdb

  • an upstream build please add comment: Jenkins run upstream

  • for quarkus branch checks
    Run checks against Quarkus current used branch
    Please add comment: Jenkins run quarkus-branch

  • for a quarkus branch specific check
    Run checks against Quarkus current used branch
    Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-branch

  • for quarkus main checks
    Run checks against Quarkus main branch
    Please add comment: Jenkins run quarkus-main

  • for a specific quarkus main check
    Run checks against Quarkus main branch
    Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-main

  • for quarkus lts checks
    Run checks against Quarkus lts branch
    Please add comment: Jenkins run quarkus-lts

  • for a specific quarkus lts check
    Run checks against Quarkus lts branch
    Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] quarkus-lts

  • for native checks
    Run native checks
    Please add comment: Jenkins run native

  • for a specific native check
    Run native checks
    Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native

  • for native lts checks
    Run native checks against quarkus lts branch
    Please add comment: Jenkins run native-lts

  • for a specific native lts check
    Run native checks against quarkus lts branch
    Please add comment: Jenkins (re)run [drools|kogito-runtimes|kogito-apps|kogito-examples] native-lts

How to backport a pull request to a different branch?

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.

@tkobayas
Copy link
Author

Jenkins run fdb

Comment on lines +515 to +535
if (!Files.exists(Paths.get(path))) {
log.info("path : " + path + " --- does not exist");
log.info("fallback for EAP 7.14.5");
try {
Method m3 = Class.forName("org.jboss.vfs.VFS").getDeclaredMethod("getMount", Class.forName("org.jboss.vfs.VirtualFile"));
m3.setAccessible(true);
Method m4 = Class.forName("org.jboss.vfs.VFS$Mount").getDeclaredMethod("getFileSystem");
m4.setAccessible(true);
Method m5 = Class.forName("org.jboss.vfs.spi.FileSystem").getMethod("getMountSource");

Object virtualFile = m2.invoke(null, url.toURI());
Object mount = m3.invoke(null, virtualFile);
Object fileSystem = m4.invoke(mount);
log.info("fileSystem : " + fileSystem);
File mountSource = (File) m5.invoke(fileSystem);
log.info("mountSource : " + mountSource);
path = mountSource.getPath();
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
Copy link
Author

Choose a reason for hiding this comment

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

This is the main part of the (temporary) fix. I was not able to find public methods to get the physical file (e.g. kie-server-integ-tests-drools/target/cargo/configurations/wildfly23x/tmp/vfs/temp/tempc483d0975993750a/content-c8ee66a0826ffc48/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar). So used setAccessible(true) for package-private methods.

Comment on lines +481 to +484
Object virtualFile = m2.invoke(null, url.toURI());
log.info("virtualFile=" + virtualFile);
File f = (File)m.invoke( m2.invoke(null, url.toURI()) );
log.info("f=" + f);
Copy link
Author

Choose a reason for hiding this comment

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

You can confirm that VirtualFile.getPhysicalFile returns file path under deployment directory. (e.g. target/cargo/configurations/wildfly23x/tmp/vfs/deployment/deploymente0f78ed559baff33/kie-pmml-7.75.0-SNAPSHOT.jar-9458e4090f0fae31/contents/META-INF/kmodule.xml)

Actually, the kmodule.xml is created on the file path as a cache file. But what we want here is the kie-pmml-7.75.0-SNAPSHOT.jar which is under temp directory.

@tkobayas
Copy link
Author

  • build drools-compiler with this PR
  • cd droolsjbpm-integration/kie-server-parent/kie-server-parent/kie-server-wars/kie-server
  • mvn clean install
  • cd droolsjbpm-integration/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools
  • mvn clean install -Peap7 -Deap7.download.url="path/to/jboss-eap-7.4.15.zip" -Dit.test=ApplyScorecardMultiModuleIntegrationTest*
19:05:37.785 [main] INFO  o.k.i.pmml.PMMLImplementationsUtil - Using LEGACY implementation
19:05:37.786 [main] INFO  o.k.i.pmml.PMMLImplementationsUtil - Using LEGACY implementation
[INFO] [talledLocalContainer] 19:06:28,456 INFO  [org.drools.compiler.kie.builder.impl.InternalKieModuleProvider] (default task-2) Creating KieModule for artifact org.kie.server.testing:scorecard_mm:1.0.0.Final
[INFO] [talledLocalContainer] 19:06:28,463 INFO  [org.drools.modelcompiler.CanonicalKieModuleProvider] (default task-2) No executable model found for artifact org.kie.server.testing:scorecard_mm:1.0.0.Final. Falling back to resources parsing.
[INFO] [talledLocalContainer] 19:07:05,953 INFO  [org.drools.compiler.kie.builder.impl.KieContainerImpl] (default task-2) Start creation of KieBase: kieBase1
[INFO] [talledLocalContainer] 19:07:06,699 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) Found kmodule: vfs:/content/kie-server-services.war/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar/META-INF/kmodule.xml
[INFO] [talledLocalContainer] 19:07:06,699 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) fixURLFromKProjectPath: url=/content/kie-server-services.war/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar/META-INF/kmodule.xml
[INFO] [talledLocalContainer] 19:07:06,700 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) getPathForVFS: m=public java.io.File org.jboss.vfs.VirtualFile.getPhysicalFile() throws java.io.IOException m2=public static org.jboss.vfs.VirtualFile org.jboss.vfs.VFS.getChild(java.net.URI)
[INFO] [talledLocalContainer] 19:07:06,700 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) virtualFile="/content/kie-server-services.war/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar/META-INF/kmodule.xml"
[INFO] [talledLocalContainer] 19:07:06,700 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) f=/home/tkobayas/usr/work/DROOLS-7608-pmml/droolsjbpm-integration/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/target/cargo/configurations/wildfly23x/tmp/vfs/deployment/deploymentc2cb1aea1f8ada4/kie-pmml-7.75.0-SNAPSHOT.jar-913473f65843f535/contents/META-INF/kmodule.xml
[INFO] [talledLocalContainer] 19:07:06,700 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2)   isInJar=true kModulePos=77 urlString=vfs:/content/kie-server-services.war/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar/META-INF/kmodule.xml path=/home/tkobayas/usr/work/DROOLS-7608-pmml/droolsjbpm-integration/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/target/cargo/configurations/wildfly23x/tmp/vfs/deployment/deploymentc2cb1aea1f8ada4/kie-pmml-7.75.0-SNAPSHOT.jar-913473f65843f535/contents/META-INF/kmodule.xml
[INFO] [talledLocalContainer] 19:07:06,700 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) path : /home/tkobayas/usr/work/DROOLS-7608-pmml/droolsjbpm-integration/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/target/cargo/configurations/wildfly23x/tmp/vfs/deployment/deploymentc2cb1aea1f8ada4/kie-pmml-7.75.0-SNAPSHOT.jar-913473f65843f535/content --- does not exist
[INFO] [talledLocalContainer] 19:07:06,701 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) fallback for EAP 7.14.5
[INFO] [talledLocalContainer] 19:07:06,701 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) fileSystem : org.jboss.vfs.spi.JavaZipFileSystem@46b81a6c
[INFO] [talledLocalContainer] 19:07:06,701 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) mountSource : /home/tkobayas/usr/work/DROOLS-7608-pmml/droolsjbpm-integration/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/target/cargo/configurations/wildfly23x/tmp/vfs/temp/temp6ed035657a5c4c47/content-2f44c939331bc3c6/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar
[INFO] [talledLocalContainer] 19:07:06,701 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) Virtual file physical path = /home/tkobayas/usr/work/DROOLS-7608-pmml/droolsjbpm-integration/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/target/cargo/configurations/wildfly23x/tmp/vfs/temp/temp6ed035657a5c4c47/content-2f44c939331bc3c6/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar
[INFO] [talledLocalContainer] 19:07:06,701 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) fetchKModule url=vfs:/content/kie-server-services.war/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar/META-INF/kmodule.xml fixedURL=/home/tkobayas/usr/work/DROOLS-7608-pmml/droolsjbpm-integration/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/target/cargo/configurations/wildfly23x/tmp/vfs/temp/temp6ed035657a5c4c47/content-2f44c939331bc3c6/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar
[INFO] [talledLocalContainer] 19:07:06,706 INFO  [org.drools.compiler.kie.builder.impl.ClasspathKieProject] (default task-2) getPomPropertiesFromZipFile : rootPath = /home/tkobayas/usr/work/DROOLS-7608-pmml/droolsjbpm-integration/kie-server-parent/kie-server-tests/kie-server-integ-tests-drools/target/cargo/configurations/wildfly23x/tmp/vfs/temp/temp6ed035657a5c4c47/content-2f44c939331bc3c6/WEB-INF/lib/kie-pmml-7.75.0-SNAPSHOT.jar
[INFO] [talledLocalContainer] 19:07:06,707 INFO  [org.drools.compiler.kie.builder.impl.InternalKieModuleProvider] (default task-2) Creating KieModule for artifact org.drools:kie-pmml:7.75.0-SNAPSHOT
[INFO] [talledLocalContainer] 19:07:06,720 INFO  [org.drools.modelcompiler.CanonicalKieModuleProvider] (default task-2) No executable model found for artifact org.drools:kie-pmml:7.75.0-SNAPSHOT. Falling back to resources parsing.
[INFO] [talledLocalContainer] 19:07:06,819 INFO  [org.drools.compiler.kie.builder.impl.KieContainerImpl] (default task-2) Start creation of KieBase: KiePMML-Scorecard
[INFO] [talledLocalContainer] 19:07:18,876 INFO  [org.drools.compiler.kie.builder.impl.KieContainerImpl] (default task-2) End creation of KieBase: KiePMML-Scorecard
...

@rgdoliveira
Copy link
Member

Jenkins run fdb

@tkobayas
Copy link
Author

replaced by #26

@tkobayas tkobayas closed this Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants