I have the following parameter in a yaml build and it's set to 'yes' in VSTS variables tab.
parameters:
buildDebugPackage: '$(BuildDebugPackage)'
I would like to do the following
- ${{ if eq(parameters.buildDebugPackage, 'yes') }}:
- ${{ parameters.preBuildDebugProjects }}
- task: DotNetCoreCLI@2
displayName: Build Debug Projects
inputs:
projects: ${{ parameters.projects }}
arguments: '--no-restore -c Debug /p:Version=$(ASSEMBLY_VERSION);FileVersion=$(FILE_VERSION)'
- ${{ parameters.postBuildDebugProjects }}
But this does not work because the variable BuildDebugPackage is not expanded to the value 'yes'.
I have to instead do the following
- powershell: |
Write-Host "##vso[task.setvariable variable=BuildDebugPackage]$($env:BuildDebugPackage)"
displayName: Setup Environment Variables
env:
BuildDebugPackage: ${{ parameters.buildDebugPackage }}
ignoreLASTEXITCODE: false
errorActionPreference: Stop
failOnStderr: true
- ${{ parameters.preBuildDebugProjects }}
- task: DotNetCoreCLI@2
displayName: Build Debug Projects
condition: and(succeeded(), eq(variables[BuildDebugPackage], 'yes'))
inputs:
projects: ${{ parameters.projects }}
arguments: '--no-restore -c Debug /p:Version=$(ASSEMBLY_VERSION);FileVersion=$(FILE_VERSION)'
- ${{ parameters.postBuildDebugProjects }}
This is far inferior as I cannot even condition the pre and post steps. This also shows up on the UI as a skipped step instead of not showing up at all. I also have to convert the parameter to a variable in PowerShell as well. Please fix this bug or give a workaround. Thanks.
@vtbassmatt fyi - this is basically the process parameters for yaml feature on our backlog.
We have created a new repository for all YAML related issues, please move the current issue to there.
https://github.com/Microsoft/azure-pipelines-yaml
@vtbassmatt fyi - here is a request for process parameters
Most helpful comment
@vtbassmatt fyi - this is basically the process parameters for yaml feature on our backlog.