Skip to content

Commit

Permalink
Add script for CIFeatureFlags and add schedule (#11297)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryzngard authored Jan 14, 2025
1 parent fd1901a commit 9e2feb9
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
14 changes: 14 additions & 0 deletions azure-pipelines-conditional-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ schedules:
- main
always: true # run the pipeline even if there are no code changes

- cron: '0 */24 * * *'
displayName: FeatureFlags - ForceRuntimeCodeGeneration
branches:
include:
- main
always: true # run the pipeline even if there are no code changes

- cron: '0 */24 * * *'
displayName: FeatureFlags - ForceRuntimeCodeGeneration,UseRazorCohostServer
branches:
include:
- main
always: true # run the pipeline even if there are no code changes

stages:
- stage: build
displayName: Build
Expand Down
6 changes: 5 additions & 1 deletion eng/pipelines/test-integration-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ steps:
-set
-enable
-flag "$(FeatureFlag)"
displayName: Set Feature Flags
displayName: Set Feature Flags From Variable
condition: and(succeeded(), ne(variables['FeatureFlag'], ''))

- powershell: eng\scripts\CIFeatureFlags.ps1
displayName: CI Feature Flags
condition: and(succeeded(), startswith(variables['Build.CronSchedule.DisplayName'], 'FeatureFlags -'))

- powershell: New-ItemProperty
-Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem"
-Name "LongPathsEnabled"
Expand Down
38 changes: 38 additions & 0 deletions eng/scripts/CIFeatureFlags.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[CmdletBinding(PositionalBinding = $false)]
param(
[string]$flags = ''
)

if ($flags -eq '') {
# Reads flags from the build name if not provided
# Example: FeatureFlags - ForceRuntimeCodeGeneration,UseRazorCohostServer
$flags = $env:Build_CronSchedule_DisplayName).Substring(0, 'FeatureFlags -'.Length)
}

# Matches src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/WellKnownFeatureFlagNames.cs
$knownFlags = @{
ShowAllCSharpCodeActions = "Razor.LSP.ShowAllCSharpCodeActions";
IncludeProjectKeyInGeneratedFilePath = "Razor.LSP.IncludeProjectKeyInGeneratedFilePath";
UsePreciseSemanticTokenRanges = "Razor.LSP.UsePreciseSemanticTokenRanges";
UseRazorCohostServer = "Razor.LSP.UseRazorCohostServer";
DisableRazorLanguageServer = "Razor.LSP.DisableRazorLanguageServer";
ForceRuntimeCodeGeneration = "Razor.LSP.ForceRuntimeCodeGeneration";
UseRoslynTokenizer = "Razor.LSP.UseRoslynTokenizer";
}

Write-Host "Setting flags from $flags"

foreach ($flag in $flags.Split(',')) {
Write-Host "Searching for '$flag'"

$match = $knownFlags.Keys | ?{ $_ -ieq $flag } | select -first 1

if ($match -ne $NULL) {
$value = $knownFlags[$match]
Write-Host "$match -> $value"
Write-Host "Setting $value"
& "./featureFlag.ps1 -set -enable -flag $value"
}
}

Write-Host "Done setting flags"

0 comments on commit 9e2feb9

Please sign in to comment.