-
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.
True Version Override in Proxy Tooling (#5613)
In the event that I actually break folks with a proxy version upgrade in `target_version.txt`, I want to be certain that our templates have true override that we can easily set when calling our template. Even if they set it so that it doesn't start the proxy, they can invoke the `test-proxy-tool` yaml with `runProxy` set to false, so it still overrides the version but doesn't actually run it for them. Then if their tooling looks at `target_version.txt` that will be properly overwritten. Before this change, _our_ tooling would boot up the proper proxy override version, but not update the actual file at rest in the repo. Any dependent tooling would therefor be looking for the wrong version of the proxy. This PR is in reaction to a situation that came up with @billwert and @samvaity . They don't honor the `target_version.txt` yet, but if they _did_, before this PR an override wouldn't have worked for them. I'd like to avoid that when we eventually really need this to work. `eng/common` changes won't be created until after release week, no reason to rock the boat.
- Loading branch information
Showing
3 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
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,25 @@ | ||
<# | ||
.SYNOPSIS | ||
Replaces target test-proxy version present in target_version.txt. | ||
.PARAMETER TargetVersion | ||
The replacement version. Used in its entirety, so don't exclude parts of the version definition. | ||
#> | ||
[cmdletbinding(SupportsShouldProcess=$True)] | ||
param( | ||
[Parameter(mandatory=$true)] [string] $TargetVersion | ||
) | ||
|
||
$versionFile = Join-Path $PSScriptRoot "target_version.txt" | ||
$existingVersionText = Get-Content -Raw -Path $versionFile | ||
$existingVersion = $existingVersionText.Trim() | ||
|
||
if ($PSCmdLet.ShouldProcess($versionFile)){ | ||
Write-Host "Replacing version `"$existingVersion`" with version `"$TargetVersion`" in $versionFile." | ||
Set-Content -Path $versionFile -Value "$TargetVersion`n" | ||
} | ||
else { | ||
Write-Host "Would replace version `"$existingVersion`" with version `"$TargetVersion`" in $versionFile." | ||
} | ||
|
||
|
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
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