-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add devops variable setting/clearing to eng/common (#2068)
- Loading branch information
1 parent
e8a895e
commit af6266b
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
eng/common/pipelines/templates/steps/devops-variables-clear.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
21 changes: 21 additions & 0 deletions
21
eng/common/pipelines/templates/steps/devops-variables-set.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |