Skip to content

Commit

Permalink
Merge branch 'main' into fix155 and fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
fsb4000 committed Jan 26, 2022
2 parents 42c6d69 + fcd5cf5 commit 5706ab2
Show file tree
Hide file tree
Showing 116 changed files with 1,152 additions and 889 deletions.
23 changes: 18 additions & 5 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# https://releases.llvm.org/12.0.0/tools/clang/docs/ClangFormatStyleOptions.html
# https://releases.llvm.org/13.0.0/tools/clang/docs/ClangFormatStyleOptions.html

---
# Language: Cpp
Expand All @@ -10,6 +10,8 @@ BasedOnStyle: LLVM
AccessModifierOffset: -4
# AlignAfterOpenBracket: Align
AlignAfterOpenBracket: DontAlign
# AlignArrayOfStructures: None
# TRANSITION, LLVM-51935 (try using AlignArrayOfStructures after this crash is fixed)
# AlignConsecutiveMacros: None
AlignConsecutiveMacros: Consecutive
# AlignConsecutiveAssignments: None
Expand Down Expand Up @@ -84,15 +86,16 @@ ColumnLimit: 120
DeriveLineEnding: false
# DerivePointerAlignment: false
# DisableFormat: false
# EmptyLineAfterAccessModifier: Never
# EmptyLineBeforeAccessModifier: LogicalBlock
# ExperimentalAutoDetectBinPacking: false
# FixNamespaceComments: true
# ForEachMacros:
# - foreach
# - Q_FOREACH
# - BOOST_FOREACH
# StatementAttributeLikeMacros:
# - Q_EMIT
# IfMacros:
# - KJ_IF_MAYBE
# IncludeBlocks: Preserve
IncludeBlocks: Regroup
# IncludeCategories:
Expand Down Expand Up @@ -125,6 +128,7 @@ IncludeCategories:
Priority: 2
# IncludeIsMainRegex: '(Test)?$'
# IncludeIsMainSourceRegex: ''
# IndentAccessModifiers: false
# IndentCaseLabels: false
# IndentCaseBlocks: false
IndentCaseBlocks: true
Expand All @@ -141,6 +145,7 @@ IndentWrappedFunctionNames: true
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
# KeepEmptyLinesAtTheStartOfBlocks: true
# LambdaBodyIndentation: Signature
# NOTE: MacroBlockBegin/MacroBlockEnd don't work with _CATCH_ALL.
# MacroBlockBegin: ''
# MacroBlockEnd: ''
Expand All @@ -164,8 +169,11 @@ NamespaceIndentation: All
# PenaltyIndentedWhitespace: 0
# PointerAlignment: Right
PointerAlignment: Left
# PPIndentWidth: -1
# ReferenceAlignment: Pointer
# ReflowComments: true
# SortIncludes: true
# ShortNamespaceLines: 1
# SortIncludes: CaseSensitive
# SortJavaStaticImport: Before
# SortUsingDeclarations: true
# SpaceAfterCStyleCast: false
Expand All @@ -183,15 +191,20 @@ SpaceAfterCStyleCast: true
# SpaceInEmptyBlock: false
# SpaceInEmptyParentheses: false
# SpacesBeforeTrailingComments: 1
# SpacesInAngles: false
# SpacesInAngles: Never
# SpacesInConditionalStatement: false
# SpacesInContainerLiterals: true
# SpacesInCStyleCastParentheses: false
# SpacesInLineCommentPrefix:
# Minimum: 1
# Maximum: -1
# SpacesInParentheses: false
# SpacesInSquareBrackets: false
# SpaceBeforeSquareBrackets: false
# BitFieldColonSpacing: Both
# Standard: Latest
# StatementAttributeLikeMacros:
# - Q_EMIT
# StatementMacros:
# - Q_UNUSED
# - QT_REQUIRE_VERSION
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-status-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ">=16.0.0"
node-version: ">=17.3.1"
- name: Install Packages
run: |
npm ci
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With The Visual Studio IDE

1. Install Visual Studio 2022 17.1 Preview 1 or later.
1. Install Visual Studio 2022 17.1 Preview 4 or later.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
This will ensure that you're using supported versions of CMake and Ninja.
* Otherwise, install [CMake][] 3.21 or later, and [Ninja][] 1.10.2 or later.
Expand All @@ -155,7 +155,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem

# How To Build With A Native Tools Command Prompt

1. Install Visual Studio 2022 17.1 Preview 1 or later.
1. Install Visual Studio 2022 17.1 Preview 4 or later.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
This will ensure that you're using supported versions of CMake and Ninja.
* Otherwise, install [CMake][] 3.21 or later, and [Ninja][] 1.10.2 or later.
Expand Down
123 changes: 68 additions & 55 deletions azure-devops/create-vmss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,18 @@ $ErrorActionPreference = 'Stop'
$Env:SuppressAzurePowerShellBreakingChangeWarnings = 'true'

$Location = 'westus2'
$Prefix = 'StlBuild-' + (Get-Date -Format 'yyyy-MM-dd')
$VMSize = 'Standard_D32as_v4'
$Prefix = 'StlBuild-' + (Get-Date -Format 'yyyy-MM-dd-THHmm')
$VMSize = 'Standard_D32ads_v5'
$ProtoVMName = 'PROTOTYPE'
$LiveVMPrefix = 'BUILD'
$ImagePublisher = 'MicrosoftWindowsDesktop'
$ImageOffer = 'windows-11'
$ImageSku = 'win11-21h2-ent'
$ImagePublisher = 'MicrosoftWindowsServer'
$ImageOffer = 'WindowsServer'
$ImageSku = '2022-datacenter-g2'

$ProgressActivity = 'Creating Scale Set'
$TotalProgress = 14
$CurrentProgress = 1

<#
.SYNOPSIS
Returns whether there's a name collision in the resource group.
.DESCRIPTION
Find-ResourceGroupNameCollision takes a list of resources, and checks if $Test
collides names with any of the resources.
.PARAMETER Test
The name to test.
.PARAMETER Resources
The list of resources.
#>
function Find-ResourceGroupNameCollision {
[CmdletBinding()]
Param([string]$Test, $Resources)

foreach ($resource in $Resources) {
if ($resource.ResourceGroupName -eq $Test) {
return $true
}
}

return $false
}

<#
.SYNOPSIS
Attempts to find a name that does not collide with any resources in the resource group.
Expand All @@ -76,10 +49,10 @@ function Find-ResourceGroupName {
[CmdletBinding()]
Param([string] $Prefix)

$resources = Get-AzResourceGroup
$existingNames = (Get-AzResourceGroup).ResourceGroupName
$result = $Prefix
$suffix = 0
while (Find-ResourceGroupNameCollision -Test $result -Resources $resources) {
while ($result -in $existingNames) {
$suffix++
$result = "$Prefix-$suffix"
}
Expand All @@ -103,7 +76,7 @@ function New-Password {

# This 64-character alphabet generates 6 bits of entropy per character.
# The power-of-2 alphabet size allows us to select a character by masking a random Byte with bitwise-AND.
$alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"
$alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-'
$mask = 63
if ($alphabet.Length -ne 64) {
throw 'Bad alphabet length'
Expand Down Expand Up @@ -158,7 +131,7 @@ function Wait-Shutdown {
}
}

Write-Host "... not stopped yet, sleeping for 10 seconds"
Write-Host '... not stopped yet, sleeping for 10 seconds'
Start-Sleep -Seconds 10
}
}
Expand All @@ -170,7 +143,8 @@ Write-Progress `
-Status 'Setting the subscription context' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)

Set-AzContext -SubscriptionName CPP_STL_GitHub
Set-AzContext -SubscriptionName CPP_STL_GitHub | Out-Null
az account set --subscription CPP_STL_GitHub

####################################################################################################
Write-Progress `
Expand All @@ -180,9 +154,9 @@ Write-Progress `

$ResourceGroupName = Find-ResourceGroupName $Prefix
$AdminPW = New-Password
New-AzResourceGroup -Name $ResourceGroupName -Location $Location
New-AzResourceGroup -Name $ResourceGroupName -Location $Location | Out-Null
$AdminPWSecure = ConvertTo-SecureString $AdminPW -AsPlainText -Force
$Credential = New-Object System.Management.Automation.PSCredential ("AdminUser", $AdminPWSecure)
$Credential = New-Object System.Management.Automation.PSCredential ('AdminUser', $AdminPWSecure)

####################################################################################################
Write-Progress `
Expand All @@ -196,19 +170,31 @@ $allowHttp = New-AzNetworkSecurityRuleConfig `
-Access Allow `
-Protocol Tcp `
-Direction Outbound `
-Priority 1008 `
-Priority 1000 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange @(80, 443)

$allowQuic = New-AzNetworkSecurityRuleConfig `
-Name AllowQUIC `
-Description 'Allow QUIC' `
-Access Allow `
-Protocol Udp `
-Direction Outbound `
-Priority 1010 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange 443

$allowDns = New-AzNetworkSecurityRuleConfig `
-Name AllowDNS `
-Description 'Allow DNS' `
-Access Allow `
-Protocol * `
-Direction Outbound `
-Priority 1009 `
-Priority 1020 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
Expand All @@ -220,7 +206,7 @@ $denyEverythingElse = New-AzNetworkSecurityRuleConfig `
-Access Deny `
-Protocol * `
-Direction Outbound `
-Priority 1010 `
-Priority 2000 `
-SourceAddressPrefix * `
-SourcePortRange * `
-DestinationAddressPrefix * `
Expand All @@ -231,25 +217,26 @@ $NetworkSecurityGroup = New-AzNetworkSecurityGroup `
-Name $NetworkSecurityGroupName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-SecurityRules @($allowHttp, $allowDns, $denyEverythingElse)
-SecurityRules @($allowHttp, $allowQuic, $allowDns, $denyEverythingElse)

$SubnetName = $ResourceGroupName + '-Subnet'
$Subnet = New-AzVirtualNetworkSubnetConfig `
-Name $SubnetName `
-AddressPrefix "10.0.0.0/16" `
-AddressPrefix '10.0.0.0/16' `
-NetworkSecurityGroup $NetworkSecurityGroup

$VirtualNetworkName = $ResourceGroupName + '-Network'
$VirtualNetwork = New-AzVirtualNetwork `
-Name $VirtualNetworkName `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-AddressPrefix "10.0.0.0/16" `
-AddressPrefix '10.0.0.0/16' `
-Subnet $Subnet

####################################################################################################
Write-Progress `
-Activity 'Creating prototype VM' `
-Activity $ProgressActivity `
-Status 'Creating prototype VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)

$NicName = $ResourceGroupName + '-NIC'
Expand Down Expand Up @@ -279,7 +266,7 @@ $VM = Set-AzVMBootDiagnostic -VM $VM -Disable
New-AzVm `
-ResourceGroupName $ResourceGroupName `
-Location $Location `
-VM $VM
-VM $VM | Out-Null

####################################################################################################
Write-Progress `
Expand All @@ -302,7 +289,7 @@ Write-Progress `
-Status 'Restarting VM' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)

Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
Restart-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName | Out-Null

####################################################################################################
Write-Progress `
Expand All @@ -324,7 +311,7 @@ Invoke-AzVMRunCommand `
-ResourceGroupName $ResourceGroupName `
-VMName $ProtoVMName `
-CommandId 'RunPowerShellScript' `
-ScriptPath "$PSScriptRoot\sysprep.ps1"
-ScriptPath "$PSScriptRoot\sysprep.ps1" | Out-Null

####################################################################################################
Write-Progress `
Expand All @@ -343,12 +330,12 @@ Write-Progress `
Stop-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName `
-Force
-Force | Out-Null

Set-AzVM `
-ResourceGroupName $ResourceGroupName `
-Name $ProtoVMName `
-Generalized
-Generalized | Out-Null

$VM = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $ProtoVMName
$PrototypeOSDiskName = $VM.StorageProfile.OsDisk.Name
Expand All @@ -361,8 +348,11 @@ Write-Progress `
-Status 'Deleting unused VM and disk' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)

Remove-AzVM -Id $VM.ID -Force
Remove-AzDisk -ResourceGroupName $ResourceGroupName -DiskName $PrototypeOSDiskName -Force
Remove-AzVM -Id $VM.ID -Force | Out-Null
Remove-AzDisk `
-ResourceGroupName $ResourceGroupName `
-DiskName $PrototypeOSDiskName `
-Force | Out-Null

####################################################################################################
Write-Progress `
Expand Down Expand Up @@ -405,7 +395,7 @@ $Vmss = Set-AzVmssStorageProfile `
-OsDiskCaching ReadWrite `
-ImageReferenceId $Image.Id

New-AzVmss `
$Vmss = New-AzVmss `
-ResourceGroupName $ResourceGroupName `
-Name $VmssName `
-VirtualMachineScaleSet $Vmss
Expand All @@ -416,11 +406,34 @@ Write-Progress `
-Status 'Enabling VMSS diagnostic logs' `
-PercentComplete (100 / $TotalProgress * $CurrentProgress++)

$StorageAccountName = 'stlvmssdiaglogssa'

$ExpirationDate = (Get-Date -AsUTC).AddYears(1).ToString('yyyy-MM-ddTHH:mmZ')

$StorageAccountSASToken = $(az storage account generate-sas `
--account-name $StorageAccountName `
--expiry $ExpirationDate `
--permissions acuw `
--resource-types co `
--services bt `
--https-only `
--output tsv `
2> $null)

$DiagnosticsDefaultConfig = $(az vmss diagnostics get-default-config --is-windows-os 2> $null). `
Replace('__DIAGNOSTIC_STORAGE_ACCOUNT__', $StorageAccountName). `
Replace('__VM_OR_VMSS_RESOURCE_ID__', $Vmss.Id)

Out-File -FilePath "$PSScriptRoot\vmss-config.json" -InputObject $DiagnosticsDefaultConfig

$DiagnosticsProtectedSettings = "{'storageAccountName': '$StorageAccountName', "
$DiagnosticsProtectedSettings += "'storageAccountSasToken': '?$StorageAccountSASToken'}"

az vmss diagnostics set `
--resource-group $ResourceGroupName `
--vmss-name $VmssName `
--settings "$PSScriptRoot\vmss-config.json" `
--protected-settings "$PSScriptRoot\vmss-protected.json" `
--protected-settings "$DiagnosticsProtectedSettings" `
--output none

####################################################################################################
Expand Down
Loading

0 comments on commit 5706ab2

Please sign in to comment.