Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using Get-VstsTaskVariable to override application params #8003

Merged
merged 3 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tasks/ServiceFabricDeployV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 1,
"Minor": 7,
"Patch": 21
"Patch": 22
},
"demands": [
"Cmd"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/ServiceFabricDeployV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"version": {
"Major": 1,
"Minor": 7,
"Patch": 21
"Patch": 22
},
"demands": [
"Cmd"
Expand Down
4 changes: 2 additions & 2 deletions Tasks/ServiceFabricDeployV1/utilities.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ function Get-OverridenApplicationParameters
$applicationManifestXml = [Xml] (Get-Content -LiteralPath $ApplicationManifestPath)
foreach ($param in $applicationManifestXml.ApplicationManifest.Parameters.Parameter)
{
$paramName = $param.Name -replace "\.", '_' -replace " ", '_'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will there be compat issues because of changing the variable naming?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earlier we were doing this replacement because environment variables cannot have dot and space. so we do this and then find out. by using get-vststaskvariable, it will take care of transforming it to correct format before looking.

$paramValue = (Get-Item env:$paramName -ErrorAction Ignore).Value
$paramName = $param.Name
$paramValue = Get-VstsTaskVariable -Name $paramName -ErrorAction Ignore
if ($paramValue)
{
$overrideParameters.Add($paramName, $paramValue)
Expand Down