Azure 管道,最后一个阶段被跳过,我不明白为什么!审批有限制还是有时间限制?
Azure pipeline, last stage is skipped and I don't understand why ! Is there a limit on approvals or a limited time?
我正在 Windows 自托管代理上的管道 运行 上工作。
我在 Stage1 中使用初始化变量的脚本,我在 Stage2 和 Stage3 的条件中使用该变量。
如果变量为真,Stage2是运行,这个阶段作为一个有审批的环境。
如果变量为假,Stage3阶段为运行.
无论如何,Stage4 是运行。
这现在运行良好,但如果 Stage2 是 运行,Stage5 总是被跳过!
我不明白为什么 Stage5 的唯一依赖项是 Stage4!
stages:
- stage: Build
jobs:
- job: CompareFiles
dependsOn: Build_Project
steps:
- checkout: none
- task: PowerShell@2
name: compareFiles
inputs:
targetType: filePath
filePath: '***\compareFileContent.ps1'
- stage: ContinueWithApproval
dependsOn: Build
condition: eq( dependencies.Build.outputs['CompareFiles.compareFiles.filesAreEqual'], 'true' )
jobs:
- deployment: Continue
environment: 'EnvironmentWithApproval'
strategy:
runOnce:
deploy:
steps:
- task: CmdLine@2
inputs:
script: '***'
- stage: ContinueWithoutApproval
dependsOn: Build
condition: eq( dependencies.Build.outputs['CompareFiles.compareFiles.filesAreEqual'], 'false' )
jobs:
- deployment: Continue
environment: 'EnvironmentWithoutApproval'
strategy:
runOnce:
deploy:
steps:
- task: CmdLine@2
inputs:
script: '***'
- stage: DeployStaging
dependsOn:
- ContinueWithApproval
- ContinueWithoutApproval
condition: or(eq( dependencies.ContinueWithApproval.result, 'Succeeded' ), eq( dependencies.ContinueWithoutApproval.result, 'Succeeded' ))
jobs:
- deployment: Deploy_To_Staging
environment: 'Name ST'
strategy:
runOnce:
deploy:
steps:
- task: PowerShell@2
inputs:
targetType: filePath
filePath: '***.ps1'
- stage: DeployPreProd
dependsOn:
- DeployStaging
jobs:
- deployment: Deploy_To_Preprod
environment: 'Name PP'
strategy:
runOnce:
deploy:
steps:
- task: PowerShell@2
inputs:
targetType: filePath
filePath: '***.ps1'
如果变量为假,Stage3 为 运行 然后是 Stage4 和 Stage5 !!!
哦! Stage5上的环境也有审批,请问是这个问题吗?批准数量限制 ?
感谢和问候,
克劳德
批准是关于环境的,所以这应该不是问题。
尝试移除
dependsOn:
- DeployStaging
从你的第 5 阶段开始。默认行为是依赖于前一阶段。我想知道,因为提供了 dependsOn w/o 一个条件,所以它不会跳过,因为还没有提供条件。
或者可以添加
succeeded()
我正在 Windows 自托管代理上的管道 运行 上工作。 我在 Stage1 中使用初始化变量的脚本,我在 Stage2 和 Stage3 的条件中使用该变量。
如果变量为真,Stage2是运行,这个阶段作为一个有审批的环境。 如果变量为假,Stage3阶段为运行.
无论如何,Stage4 是运行。 这现在运行良好,但如果 Stage2 是 运行,Stage5 总是被跳过!
我不明白为什么 Stage5 的唯一依赖项是 Stage4!
stages:
- stage: Build
jobs:
- job: CompareFiles
dependsOn: Build_Project
steps:
- checkout: none
- task: PowerShell@2
name: compareFiles
inputs:
targetType: filePath
filePath: '***\compareFileContent.ps1'
- stage: ContinueWithApproval
dependsOn: Build
condition: eq( dependencies.Build.outputs['CompareFiles.compareFiles.filesAreEqual'], 'true' )
jobs:
- deployment: Continue
environment: 'EnvironmentWithApproval'
strategy:
runOnce:
deploy:
steps:
- task: CmdLine@2
inputs:
script: '***'
- stage: ContinueWithoutApproval
dependsOn: Build
condition: eq( dependencies.Build.outputs['CompareFiles.compareFiles.filesAreEqual'], 'false' )
jobs:
- deployment: Continue
environment: 'EnvironmentWithoutApproval'
strategy:
runOnce:
deploy:
steps:
- task: CmdLine@2
inputs:
script: '***'
- stage: DeployStaging
dependsOn:
- ContinueWithApproval
- ContinueWithoutApproval
condition: or(eq( dependencies.ContinueWithApproval.result, 'Succeeded' ), eq( dependencies.ContinueWithoutApproval.result, 'Succeeded' ))
jobs:
- deployment: Deploy_To_Staging
environment: 'Name ST'
strategy:
runOnce:
deploy:
steps:
- task: PowerShell@2
inputs:
targetType: filePath
filePath: '***.ps1'
- stage: DeployPreProd
dependsOn:
- DeployStaging
jobs:
- deployment: Deploy_To_Preprod
environment: 'Name PP'
strategy:
runOnce:
deploy:
steps:
- task: PowerShell@2
inputs:
targetType: filePath
filePath: '***.ps1'
如果变量为假,Stage3 为 运行 然后是 Stage4 和 Stage5 !!!
哦! Stage5上的环境也有审批,请问是这个问题吗?批准数量限制 ?
感谢和问候, 克劳德
批准是关于环境的,所以这应该不是问题。
尝试移除
dependsOn:
- DeployStaging
从你的第 5 阶段开始。默认行为是依赖于前一阶段。我想知道,因为提供了 dependsOn w/o 一个条件,所以它不会跳过,因为还没有提供条件。
或者可以添加
succeeded()