### _Why are the changes needed?_ - add ut to check generated Ranger policy file in #4585 - manually activated `genpolicy` profile in CI builds, as the property based activation not auto-triggered as expectedly with property `ranger.version=2.4.0` set in project parent pom - Support regenerated policy file within the same test suite, by running `KYUUBI_UPDATE=1 build/mvn clean test -pl :kyuubi-spark-authz_2.12 -Dtest=none -DwildcardSuites=org.apache.kyuubi.plugin.spark.authz.gen.PolicyJsonFileGenerator -Pgenpolicy` ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request Closes #4677 from bowenliang123/authz-check-policy-gen. Closes #4677 a372bdfd4 [liangbowen] remove unnecessary profile used in style workflow 7562c88f2 [liangbowen] include in spotless 37b674223 [liangbowen] update policy id 724ec5e28 [liangbowen] replace counter by using zipWithIndex d322980e7 [liangbowen] extract KRangerPolicyResource object to simplify resource assembly 42c37606a [liangbowen] nit 18a8f4c51 [liangbowen] add usage comments 4ee254d6d [liangbowen] fix issue name in docs d3cb08d21 [liangbowen] improve file reading 37e4c9c9f [Bowen Liang] Merge branch 'master' into authz-check-policy-gen 6366c50e4 [liangbowen] rename profile to `gen-policy` and remove activation rule by property setting 892faf5ef [liangbowen] update clue 266baa71a [liangbowen] update cb94e8014 [liangbowen] update de1f36531 [liangbowen] cleanup e88c75d46 [liangbowen] check policy file gen Lead-authored-by: liangbowen <liangbowen@gf.com.cn> Co-authored-by: Bowen Liang <bowenliang@apache.org> Signed-off-by: liangbowen <liangbowen@gf.com.cn>
6.0 KiB
Building Kyuubi Spark AuthZ Plugin
Build with Apache Maven
Kyuubi Spark AuthZ Plugin is built using Apache Maven.
To build it, cd to the root direct of kyuubi project and run:
build/mvn clean package -pl :kyuubi-spark-authz_2.12 -DskipTests
After a while, if everything goes well, you will get the plugin finally in two parts:
- The main plugin jar, which is under
./extensions/spark/kyuubi-spark-authz/target/kyuubi-spark-authz_${scala.binary.version}-${project.version}.jar - The least transitive dependencies needed, which are under
./extensions/spark/kyuubi-spark-authz/target/scala-${scala.binary.version}/jars
Build against Different Apache Spark Versions
The maven option spark.version is used for specifying Spark version to compile with and generate corresponding transitive dependencies.
By default, it is always built with the latest spark.version defined in kyuubi project main pom file.
Sometimes, it may be incompatible with other Spark distributions, then you may need to build the plugin on your own targeting the Spark version you use.
For example,
build/mvn clean package -pl :kyuubi-spark-authz_2.12 -DskipTests -Dspark.version=3.0.2
The available spark.versions are shown in the following table.
| Spark Version | Supported | Remark |
|---|---|---|
| master | √ | - |
| 3.3.x | √ | - |
| 3.2.x | √ | - |
| 3.1.x | √ | - |
| 3.0.x | √ | - |
| 2.4.x and earlier | × | PR 2367 is used to track how we work with older releases with scala 2.11 |
Currently, Spark released with Scala 2.12 are supported.
Build against Different Apache Ranger Versions
The maven option ranger.version is used for specifying Ranger version to compile with and generate corresponding transitive dependencies.
By default, it is always built with the latest ranger.version defined in kyuubi project main pom file.
Sometimes, it may be incompatible with other Ranger Admins, then you may need to build the plugin on your own targeting the Ranger Admin version you connect with.
build/mvn clean package -pl :kyuubi-spark-authz_2.12 -DskipTests -Dranger.version=0.7.0
The available ranger.versions are shown in the following table.
| Ranger Version | Supported | Remark |
|---|---|---|
| 2.4.x | √ | - |
| 2.3.x | √ | - |
| 2.2.x | √ | - |
| 2.1.x | √ | - |
| 2.0.x | √ | - |
| 1.2.x | √ | - |
| 1.1.x | √ | - |
| 1.0.x | √ | - |
| 0.7.x | √ | - |
| 0.6.x | X | KYUUBI-4672 reported unresolved failures. |
Currently, all ranger releases are supported.
Test with ScalaTest Maven plugin
If you omit -DskipTests option in the command above, you will also get all unit tests run.
build/mvn clean package -pl :kyuubi-spark-authz_2.12
If any bug occurs and you want to debug the plugin yourself, you can configure -DdebugForkedProcess=true and -DdebuggerPort=5005(optional).
build/mvn clean package -pl :kyuubi-spark-authz_2.12 -DdebugForkedProcess=true
The tests will suspend at startup and wait for a remote debugger to attach to the configured port.
We will appreciate if you can share the bug or the fix to the Kyuubi community.