Skip to content

Commit

Permalink
worker和agent支持java17和java8同步运行 TencentBlueKing#10586
Browse files Browse the repository at this point in the history
  • Loading branch information
tangruotian committed Sep 6, 2024
1 parent 282c613 commit f30fc7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/agent/agent/src/cmd/upgrader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ func main() {
}
}()

logs.Infof("version: %s", config.AgentVersion)

if ok := systemutil.CheckProcess(upgraderProcess); !ok {
logs.Warn("get process lock failed, exit")
return
Expand Down
13 changes: 9 additions & 4 deletions src/agent/agent/src/third_components/jdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ func trimJdk17VersionList(versionOutputString string) []string {
}

const (
macosJdkBinPath = "/Contents/Home/bin/java"
noMacosJdkBinPath = "/bin/java"
macosJdkBinPath = "/Contents/Home/bin/java"
linuxJdkBinPath = "/bin/java"
winJdkBinPath = "/bin/java.exe"
)

// GetJava 获取本地java路径,区分版本
Expand All @@ -245,14 +246,18 @@ func (j *JdkVersionType) GetJava() string {
case jdk8:
if systemutil.IsMacos() {
return config.GAgentConfig.JdkDirPath + macosJdkBinPath
} else if systemutil.IsWindows() {
return config.GAgentConfig.JdkDirPath + winJdkBinPath
} else {
return config.GAgentConfig.JdkDirPath + noMacosJdkBinPath
return config.GAgentConfig.JdkDirPath + linuxJdkBinPath
}
default:
if systemutil.IsMacos() {
return config.GAgentConfig.Jdk17DirPath + macosJdkBinPath
} else if systemutil.IsWindows() {
return config.GAgentConfig.Jdk17DirPath + winJdkBinPath
} else {
return config.GAgentConfig.Jdk17DirPath + noMacosJdkBinPath
return config.GAgentConfig.Jdk17DirPath + linuxJdkBinPath
}
}
}
Expand Down

0 comments on commit f30fc7e

Please sign in to comment.