diff --git a/src/backend/ci/core/process/biz-engine/src/main/kotlin/com/tencent/devops/process/engine/control/command/container/impl/InitializeMatrixGroupStageCmd.kt b/src/backend/ci/core/process/biz-engine/src/main/kotlin/com/tencent/devops/process/engine/control/command/container/impl/InitializeMatrixGroupStageCmd.kt index b4864db50c4..7738a7bc889 100644 --- a/src/backend/ci/core/process/biz-engine/src/main/kotlin/com/tencent/devops/process/engine/control/command/container/impl/InitializeMatrixGroupStageCmd.kt +++ b/src/backend/ci/core/process/biz-engine/src/main/kotlin/com/tencent/devops/process/engine/control/command/container/impl/InitializeMatrixGroupStageCmd.kt @@ -31,6 +31,7 @@ import com.tencent.devops.common.api.constant.TEMPLATE_ACROSS_INFO_ID import com.tencent.devops.common.api.exception.DependNotFoundException import com.tencent.devops.common.api.exception.ExecuteException import com.tencent.devops.common.api.exception.InvalidParamException +import com.tencent.devops.common.api.util.JsonUtil.deepCopy import com.tencent.devops.common.log.utils.BuildLogPrinter import com.tencent.devops.common.pipeline.EnvReplacementParser import com.tencent.devops.common.pipeline.container.NormalContainer @@ -45,6 +46,7 @@ import com.tencent.devops.common.pipeline.pojo.element.agent.ManualReviewUserTas import com.tencent.devops.common.pipeline.pojo.element.matrix.MatrixStatusElement import com.tencent.devops.common.pipeline.pojo.element.quality.QualityGateInElement import com.tencent.devops.common.pipeline.pojo.element.quality.QualityGateOutElement +import com.tencent.devops.common.pipeline.type.DispatchType import com.tencent.devops.common.redis.RedisOperation import com.tencent.devops.process.engine.atom.parser.DispatchTypeParser import com.tencent.devops.process.engine.cfg.ModelContainerIdGenerator @@ -297,10 +299,11 @@ class InitializeMatrixGroupStageCmd( baseOS = customBaseOS ?: modelContainer.baseOS, vmNames = modelContainer.vmNames, dockerBuildVersion = modelContainer.dockerBuildVersion, - dispatchType = customDispatchType ?: modelContainer.dispatchType?.let { itd -> - itd.replaceVariable(allContext) // 只处理${{matrix.xxx}}, 其余在DispatchVMStartupTaskAtom处理 - itd - }, + dispatchType = customDispatchType + ?: modelContainer.dispatchType?.deepCopy()?.let { itd -> + itd.replaceVariable(allContext) // 只处理${{matrix.xxx}}, 其余在DispatchVMStartupTaskAtom处理 + itd + }, buildEnv = customBuildEnv ?: modelContainer.buildEnv, thirdPartyAgentId = modelContainer.thirdPartyAgentId?.let { self -> EnvReplacementParser.parse(self, allContext, asCodeEnabled, contextPair)