diff --git a/eng/common/pipelines/templates/steps/devops-variables-clear.yml b/eng/common/pipelines/templates/steps/devops-variables-clear.yml new file mode 100644 index 000000000000..67f33dab0146 --- /dev/null +++ b/eng/common/pipelines/templates/steps/devops-variables-clear.yml @@ -0,0 +1,20 @@ +parameters: +- name: Variables + type: object + default: [] +- name: ContinueOnError + type: boolean + default: false + +steps: + - pwsh: | + $rawVariables = @" + ${{ convertToJson(parameters.Variables) }} + "@ + $variables = ConvertFrom-Json $rawVariables -AsHashtable + foreach ($key in $variables.Keys) { + Write-Host "Clearing: $key" + Write-Host "##vso[task.setvariable variable=$key]" + } + continueOnError: ${{ parameters.ContinueOnError }} + displayName: Clear DevOps Variables \ No newline at end of file diff --git a/eng/common/pipelines/templates/steps/devops-variables-set.yml b/eng/common/pipelines/templates/steps/devops-variables-set.yml new file mode 100644 index 000000000000..f31641eae0b5 --- /dev/null +++ b/eng/common/pipelines/templates/steps/devops-variables-set.yml @@ -0,0 +1,21 @@ +parameters: + - name: Variables + type: object + default: [] + - name: ContinueOnError + type: boolean + default: false + +steps: + - pwsh: | + $rawVariables = @" + ${{ convertToJson(parameters.Variables) }} + "@ + $variables = ConvertFrom-Json $rawVariables -AsHashtable + foreach ($key in $variables.Keys) { + $value = $variables[$key] + Write-Host "Setting: $key = $value" + Write-Host "##vso[task.setvariable variable=$key]$value" + } + continueOnError: ${{ parameters.ContinueOnError }} + displayName: Set DevOps Variables \ No newline at end of file