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

Add script for CIFeatureFlags and add schedule #11297

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
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 * * *'
Copy link
Contributor

Choose a reason for hiding this comment

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

The cron constraints on hour look to be '0–23' (wikipedia), so I think the */24 is the equivalent of '0' for the hour position.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

*/24 is run a job every 24 hours, but we could specify the time here instead.

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This triggers on the actual pipeline imply that these will be ignored.
image

I suspect we need to add another cron job here for the "regular" run, and then merge this, and then turn off that override setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah interesting. It already has an existing trigger so I assumed it was used.

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"