I am working on a pipeline running on a Windows Self Hosted agent. I use a script in Stage1 that initialize a variable, I use the variable in a condition on Stage2 and Stage3.
If variable is true, Stage2 is ran, this stage as an environment with an approval. If variable is false, Stage3 stage is ran.
In any case, Stage4 is ran. This now works well but if Stage2 is ran, Stage5 is always skipped !
I don't understand why as the only dependency of Stage5 is 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'
If variable is false, Stage3 is ran and then, Stage4 and Stage5 !!!
Oh! The environment on Stage5 also has an approval, can this be the issue ? A limit on the number of approvals ?
Thanks and regards, Claude