I'm not sure if this is possible but I wanted to know if there is a way in an ADO pipeline to update a pipeline level variable from within a poweshell step within the script and have that value persist.
For example I have a pipeline variable called count which is set to 0, under certain circumstances I need to increment count by 1 and then persist that value in the pipeline variable so it increments for each build when the conditions are met. Is this possible as I've not been able to find any documentation about this. I have tried this with the counter variable but it doesn't fit my needs as it increments for each build.
Below is a very cut down version of what I have
trigger:
- develop
pool:
vmImage: 'windows-2019'
steps:
- task: PowerShell@2
displayName: 'SetVariable'
inputs:
targetType: 'inline'
script: |
$(count) = $(count) + 1

