mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-21 08:13:34 +00:00
feat(hive): migrate agent to native Go
This commit is contained in:
@@ -51,6 +51,7 @@ function fileContainsCommonDependency(path, moduleExists, readModuleFile) {
|
||||
const nativeDriverDirectories = {
|
||||
cassandra: "cassandra-go",
|
||||
duckdb: "duckdb",
|
||||
hive: "hive-go",
|
||||
oracle: "oracle-go",
|
||||
kingbase: "kingbase-go",
|
||||
iotdb: "iotdb",
|
||||
@@ -59,7 +60,14 @@ const nativeDriverDirectories = {
|
||||
rabbitmq: "rabbitmq",
|
||||
tdengine: "tdengine",
|
||||
};
|
||||
const nativeDriverModules = new Set(["cassandra", "duckdb", "oracle", "xugu", "kingbase", "iotdb", "neo4j", "vastbase", "rabbitmq", "tdengine"]);
|
||||
const nativeDriverModules = new Set(["cassandra", "duckdb", "hive", "oracle", "xugu", "kingbase", "iotdb", "neo4j", "vastbase", "rabbitmq", "tdengine"]);
|
||||
const nativeDriverSharedPaths = {
|
||||
hive: [
|
||||
"agents/go-common/go-gssapi",
|
||||
"agents/go-common/gohive",
|
||||
"agents/go-common/gosasl",
|
||||
],
|
||||
};
|
||||
|
||||
function resolveAgentModule(moduleName, { legacyStandaloneModules, moduleExists, readModuleFile }) {
|
||||
let checkDir = null;
|
||||
@@ -82,6 +90,7 @@ function resolveAgentModule(moduleName, { legacyStandaloneModules, moduleExists,
|
||||
return {
|
||||
checkDir,
|
||||
modulePath,
|
||||
sharedPaths: nativeDriverSharedPaths[moduleName] ?? [],
|
||||
javaBuild: hasBuildGradle,
|
||||
nativeBuild: nativeDriverModules.has(moduleName),
|
||||
commonDependent: hasBuildGradle && (explicitlyDependsOnCommon || !legacyStandaloneModules.has(moduleName)),
|
||||
@@ -137,7 +146,8 @@ export function evaluateAgentVersionBump({
|
||||
}
|
||||
|
||||
for (const { moduleName, module } of resolvedModules) {
|
||||
const moduleChanged = pathChanged(changedFiles, module.modulePath);
|
||||
const moduleChanged = [module.modulePath, ...module.sharedPaths]
|
||||
.some((path) => pathChanged(changedFiles, path));
|
||||
// Only modules that package agents/common need installer-visible updates
|
||||
// for shared Java runtime changes; native and standalone agents do not.
|
||||
const commonAffectsModule = commonChanged && module.commonDependent;
|
||||
|
||||
@@ -83,6 +83,26 @@ test("bumps Cassandra from its native Go source directory", () => {
|
||||
assert.deepEqual(result.nativeModules, ["cassandra"]);
|
||||
});
|
||||
|
||||
test("bumps Hive from native and shared Kerberos source directories", () => {
|
||||
for (const changedFile of [
|
||||
"agents/drivers/hive-go/main.go",
|
||||
"agents/go-common/gohive/driver.go",
|
||||
"agents/go-common/gosasl/gssapi.go",
|
||||
"agents/go-common/go-gssapi/krb5/krb5.go",
|
||||
]) {
|
||||
const result = evaluateAgentVersionBump({
|
||||
versions: { hive: "0.1.43" },
|
||||
changedFiles: [changedFile],
|
||||
moduleExists: (path) => path === "agents/drivers/hive-go",
|
||||
readModuleFile: () => "",
|
||||
});
|
||||
|
||||
assert.equal(result.versions.hive, "0.1.44");
|
||||
assert.deepEqual(result.javaModules, []);
|
||||
assert.deepEqual(result.nativeModules, ["hive"]);
|
||||
}
|
||||
});
|
||||
|
||||
test("bumps Neo4j from its native Go source directory", () => {
|
||||
const result = evaluateAgentVersionBump({
|
||||
versions: { neo4j: "0.1.39" },
|
||||
|
||||
Reference in New Issue
Block a user