You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

automation-script.ps1 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. Param(
  2. [Parameter(Mandatory = $true)]
  3. [string]
  4. $PropertyNames,
  5. [Parameter()]
  6. [string]
  7. $EdgeRCFile,
  8. [Parameter()]
  9. [string]
  10. $Section
  11. )
  12. $CommonParams = @{
  13. EdgeRCFile = $EdgeRCFile
  14. Section = $Section
  15. }
  16. $PropertyNamesArray = $PropertyNames -split ','
  17. $StrictHeaderParsing = '{
  18. "name": "strictHeaderParsing",
  19. "options": {
  20. "validMode": false,
  21. "strictMode": false
  22. }
  23. }' | ConvertFrom-Json
  24. foreach ($PropertyName in $PropertyNamesArray) {
  25. $Property = Get-Property -PropertyName $PropertyName.Trim() @CommonParams
  26. # Latest version of property is active
  27. if ($Property.latestVersion -eq $Property.stagingVersion -or $Property.latestVersion -eq $Property.productionVersion) {
  28. Write-Host -ForegroundColor Yellow "$PropertyName`: Creating new version of property"
  29. $NewVersionResult = New-PropertyVersion -PropertyName $PropertyName -CreateFromVersion latest @CommonParams
  30. }
  31. $Rules = Get-PropertyRuleTree -PropertyName $PropertyName -PropertyVersion latest @CommonParams
  32. $Rules.rules.behaviors += $StrictHeaderParsing
  33. Write-Host -ForegroundColor Yellow "$PropertyName`: Pushing new rules"
  34. $Rules | Set-PropertyRuleTree -PropertyName $PropertyName -PropertyVersion latest -VersionNotes 'Updating behaviour by pwsh' @CommonParams
  35. Write-Host -ForegroundColor Yellow "$PropertyName`: Activating to staging"
  36. $ActivationResult = Activate-Property -PropertyName $PropertyName -PropertyVersion latest -Network Staging @CommonParams
  37. }