feat:python插件支持编译运行的时使用独立虚拟环境执行#12656#12727
Open
yjieliang wants to merge 28 commits into
Open
Conversation
# Conflicts: # src/backend/ci/core/worker/worker-api-sdk/src/main/kotlin/com/tencent/devops/worker/common/api/atom/AtomArchiveResourceApi.kt # src/backend/ci/core/worker/worker-common/src/main/kotlin/com/tencent/devops/worker/common/api/atom/AtomArchiveSDKApi.kt
carlyin0801
reviewed
Jun 10, 2026
| @@ -72,3 +72,7 @@ const val LOG_FILE_LENGTH_LIMIT = 1073741824 // 1 GB = 1073741824 Byte | |||
| val PIPELINE_SCRIPT_ATOM_CODE = listOf("PipelineScriptDev", "PipelineScriptTest", "PipelineScript") | |||
|
|
|||
| const val BK_CI_ATOM_EXECUTE_ENV_PATH = "BK_CI_ATOM_EXECUTE_ENV_PATH" | |||
Collaborator
There was a problem hiding this comment.
重构把各实现里的 System.setProperty(BK_CI_ATOM_EXECUTE_ENV_PATH, ...) 全部删掉了(改成 return)。但内部AtomRunEnvPrepareTask 插件仍在用旧的读取方式: val atomExecutePath = System.getProperty(BK_CI_ATOM_EXECUTE_ENV_PATH)
| var convertTarget = if (!atomExecuteEnvPath.isNullOrBlank()) { | ||
| val fullPath = "$atomExecuteEnvPath${File.separator}$target" | ||
| // Windows路径含反斜杠,用双引号包裹防止被shell错误解析 | ||
| if (osType == OSType.WINDOWS) "\"$fullPath\"" else fullPath |
Collaborator
There was a problem hiding this comment.
target 通常是带参数的整条命令(如 python main.py),这里把"路径 + 空格 + 参数"整体拼成 fullPath 后再整体加引号,结果是 "C:...\Scripts\python main.py",Windows 会把它当成一个带空格的可执行文件名 → 执行失败。正确做法应只给可执行文件那一段加引号(就像同文件 handleAtomPreCmd 和 MarketAtomTask.replacePipWithAbsolutePath 里对 pip 的处理那样,引号只包路径、参数在引号外)。Linux 不受影响。触发条件是 Windows + 启用 venv + 命中白名单,影响面有限,但在该场景下是确定性失败。
| private val businessConfigService: BusinessConfigService | ||
| ) { | ||
| private val logger = LoggerFactory.getLogger(AtomWhitelistConfigService::class.java) | ||
| private val objectMapper = ObjectMapper() |
Collaborator
There was a problem hiding this comment.
复用 JsonUtil/共享 mapper
# Conflicts: # src/backend/ci/core/store/api-store/src/main/kotlin/com/tencent/devops/store/constant/StoreMessageCode.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.