From 44391f07aa290fcbd174d449a0054ec5ba738aa3 Mon Sep 17 00:00:00 2001 From: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:58:06 -0800 Subject: [PATCH 1/5] Move Application Insights CDN staging from beta to next Route release candidates and beta-version artifacts to next, reject beta activation, and preserve production paths and legacy listing. Add offline routing regression coverage and migrate the live CDN monitor. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/ci.yml | 3 + .../Unit/src/applicationinsights.e2e.tests.ts | 4 +- AISKU/scripts/README.md | 18 +- AISKU/scripts/publishAzReleaseToCdn.ps1 | 6 +- AISKU/scripts/setAzActiveCdnVersion.ps1 | 10 +- README.md | 11 +- common/publish/Tests/CdnPublishing.tests.ps1 | 182 ++++++++++++++++++ .../scripts/publishAzReleaseToCdn.ps1 | 6 +- .../scripts/setAzActiveCdnVersion.ps1 | 10 +- .../scripts/publishAzReleaseToCdn.ps1 | 6 +- .../scripts/setAzActiveCdnVersion.ps1 | 10 +- .../scripts/publishAzReleaseToCdn.ps1 | 6 +- .../scripts/setAzActiveCdnVersion.ps1 | 10 +- .../scripts/publishAzReleaseToCdn.ps1 | 6 +- .../scripts/setAzActiveCdnVersion.ps1 | 10 +- tools/config/README.md | 9 +- .../config/scripts/publishAzReleaseToCdn.ps1 | 7 +- .../config/scripts/setAzActiveCdnVersion.ps1 | 14 +- 18 files changed, 257 insertions(+), 71 deletions(-) create mode 100644 common/publish/Tests/CdnPublishing.tests.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60148d84a..935380868 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,9 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Test CDN publishing and activation routing + shell: pwsh + run: .\common\publish\Tests\CdnPublishing.tests.ps1 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: diff --git a/AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts b/AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts index 3048c7b7c..263280f30 100644 --- a/AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts +++ b/AISKU/Tests/Unit/src/applicationinsights.e2e.tests.ts @@ -735,11 +735,11 @@ export class ApplicationInsightsTests extends AITestClass { useFakeFetch: false, fakeFetchAutoRespond: false, steps: [() => { - // Use beta endpoint to pre-test any changes before public V3 cdn + // Use next endpoint to pre-test any changes before public V3 cdn let random = utcNow(); // Under Cors Mode, Options request will be auto-triggered try { - fetch(`https://js.monitor.azure.com/beta/ai.3.gbl.min.js?${random}`, { + fetch(`https://js.monitor.azure.com/next/ai.3.gbl.min.js?${random}`, { method: "GET" }).then((res) => { this._ctx.res = res; diff --git a/AISKU/scripts/README.md b/AISKU/scripts/README.md index 8c0261c47..1d88a8d98 100644 --- a/AISKU/scripts/README.md +++ b/AISKU/scripts/README.md @@ -31,7 +31,15 @@ The Scripts and examples are included below, but as a summary they are ### ./publishAzReleaseToCdn.ps1 -This script has been created to automate the deployment of the CDN resources at the same time as publishing of the NPM packages. This script will publish the full version (v2.#.#) of the current build to all staging folders (beta, next and public) of the source storage account, it does NOT change the major (ai.2.min.js) or minor (ai.2.#.min.js) release versions +This script has been created to automate the deployment of the CDN resources at the same time as publishing of the NPM packages. This script will publish the full release version (v2.#.#) to next and public. Release candidates and beta prerelease versions are published only to next, retaining their version names and NPM tags. It does NOT change the major (ai.2.min.js) or minor (ai.2.#.min.js) release versions. + +The beta CDN channel is read-only legacy history: existing files and version listing remain available, but publishing and activation no longer write to beta. The dated example output below is retained as historical output. + +Offline publishing and activation regression tests can be run from the repository root with +`pwsh -NoProfile -File common\publish\Tests\CdnPublishing.tests.ps1`; they do not connect to Azure. + +Roll out these changes using freshly built release artifacts. Deployment pipelines execute the +publish and activation scripts bundled in those artifacts; reusing an older artifact can still write to beta. __Command line arguments__ @@ -42,7 +50,7 @@ __Command line arguments__ | sasToken | string | [Optional] For automated deployments, it is recommended that you pass in a pre-generated Shared Access Signature (SAS) Token to avoid the script attempting to login the user which could cause a blocking UI to be displayed. When supplied the script bypasses the automated scan / checks and will just used the identified storage account name from the `cdnStorePath` argument. If this value is not specified the script will ensure that the user is logged into azure (displaying a login UI), enumerate all of the subscription Id's for the user to find full location of the storage account identified by the `cdnStorePath` argument, once identified it will then Generate a new SAS token for the script (as long as the user has permissions) for the target subscription. | logPath | string | [Optional] Identifies the location where the automatic log file will be written. Defaults to :\Logs | overwrite | switch | By default the script will NOT overwrite any existing Blob with the same name in each container as it sets the CacheControl period to 1yr. As such this flag is provided primarily for testing and validation purposes, passing this switch will include the "-Force" switch for the Azure RM PowerShell functions to cause any existing blob to be overwritten. -| testOnly | switch | [Optional] By default the script will upload to the production containers (beta, next and scripts), for testing this switch will effectively cause the files to be uploaded to the "tst" container with and the normal container names will instead be prepended (simulating folders) to the name. ([tst] scripts/b/ai.2.min.js) +| testOnly | switch | [Optional] By default the script will upload to the next and scripts containers, for testing this switch will effectively cause the files to be uploaded to the "tst" container with and the normal container names will instead be prepended (simulating folders) to the name. ([tst] scripts/b/ai.2.min.js) | useConnectedAccount | switch | [Optional] By default the script will use the current logged in user to authenticate with Azure using SAS tokens, if you have disabled SAS token support for the storage account then you will need to use this switch and grant the user "Storage Blob Data Contributor" role. #### Example Usage and output @@ -107,7 +115,7 @@ PS D:\git\ApplicationInsights-JS\AISKU\scripts> .\publishAzReleaseToCdn.ps1 -cdn ### ./setAzActiveCdnVersion.ps1 -This script will set the active release for the specified release folder (beta, next, public) to the requested full version (2.x.x) number. By default it will set both the major (ai.2.min.js) and minor (ai.2.x.min.js) versions to the requested full version, you can optionally only update the minor version. +This script will set the active release for the specified release folder (next, public) to the requested full version (2.x.x) number. Release candidates and beta prerelease versions can only be activated in next; dev and nightly versions retain their corresponding folders. By default it will set both the major (ai.2.min.js) and minor (ai.2.x.min.js) versions to the requested full version, you can optionally only update the minor version. > :bulb: **Note** > @@ -117,13 +125,13 @@ __Command line arguments__ | Name | Type | Description |------|------|---------------- -| container | string | __[Required]__ Identifies the target container to update (beta, next, public) +| container | string | __[Required]__ Identifies the target container to update (next, public). Beta is no longer a writable CDN channel. | activeVersion | string | __[Required]__ Identifies the source full version number to copy and make the active released version fro the specified container. This MUST be the full version number in the form "a.b.c". The new active versions will be created (or overwritten) as the major version (ai.[a].min.js) and minor version (ai.[a].[b].min.js). | cdnStorePath | string | [Optional] Identifies the target Azure Storage account (by name) where the files will be uploaded to. As you may have access to multiple subscriptions, resource groups, and storage accounts (which can slow the automatic validation / identification process) you can optionally include the a partial subscription id and resource group name with the storage account name. So you can specify the target using any of the following 3 forms :-
- <Full storage account name>
- <partial or full subscription id>::<Full storage account name>
- <partial or full subscription id>::<Full resource group name>::<Full storage account name>
The subscription id is used to match against the collection of subscription id's that the user/runner has access to, it uses the PowerShell -like matching by wrapping the value in '*'
When a resource group name is supplied it will further limit the collection of storage accounts that are scanned / checked for the storage account name.
Example: `"65b2f83e::tstcdnstore"` | sasToken | string | [Optional] For automated deployments, it is recommended that you pass in a pre-generated Shared Access Signature (SAS) Token to avoid the script attempting to login the user which could cause a blocking UI to be displayed. When supplied the script bypasses the automated scan / checks and will just used the identified storage account name from the `cdnStorePath` argument. If this value is not specified the script will ensure that the user is logged into azure (displaying a login UI), enumerate all of the subscription Id's for the user to find full location of the storage account identified by the `cdnStorePath` argument, once identified it will then Generate a new SAS token for the script (as long as the user has permissions) for the target subscription. | logPath | string | [Optional] Identifies the location where the automatic log file will be written. Defaults to :\Logs | minorOnly | switch | By default the script will update both the major (ai.2.min.js) and minor (ai.2.#.min.js) available versions of the script. If this switch is set it will only update the minor version (ai.2.#.min.js) and the major version (ai.2.min.js) will be unaffected. -| testOnly | switch | [Optional] By default the script will update the production containers (beta, next and scripts), for testing this switch will effectively only update the "tst" container versions with and the normal container names will instead be prepended (simulating folders) to the name. ([tst] scripts/b/ai.2.min.js) +| testOnly | switch | [Optional] By default the script will update the next and scripts containers, for testing this switch will effectively only update the "tst" container versions with and the normal container names will instead be prepended (simulating folders) to the name. ([tst] scripts/b/ai.2.min.js) | useConnectedAccount | switch | [Optional] By default the script will use the current logged in user to authenticate with Azure using SAS tokens, if you have disabled SAS token support for the storage account then you will need to use this switch and grant the user "Storage Blob Data Contributor" role. #### Example Usage and output diff --git a/AISKU/scripts/publishAzReleaseToCdn.ps1 b/AISKU/scripts/publishAzReleaseToCdn.ps1 index 4367b754a..e9100ed18 100644 --- a/AISKU/scripts/publishAzReleaseToCdn.ps1 +++ b/AISKU/scripts/publishAzReleaseToCdn.ps1 @@ -127,15 +127,13 @@ Write-Log "--------------------------------------------------------------------- # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - PublishFiles $releaseFiles "beta" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "next" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "scripts/b" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc") { - PublishFiles $releaseFiles "beta" $cacheControl1Year $contentType $overwrite +elseif ($version.type -eq "rc" -or $version.type -eq "beta") { PublishFiles $releaseFiles "next" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "dev" -or $version.type -eq "beta") { +elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)" $cacheControl1Year $contentType $overwrite } diff --git a/AISKU/scripts/setAzActiveCdnVersion.ps1 b/AISKU/scripts/setAzActiveCdnVersion.ps1 index 97472c382..f657efc88 100644 --- a/AISKU/scripts/setAzActiveCdnVersion.ps1 +++ b/AISKU/scripts/setAzActiveCdnVersion.ps1 @@ -73,16 +73,16 @@ Function Validate-Params # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - if ("beta","next","public" -NotContains $container) { + if ("next","public" -NotContains $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc") { - if ("beta","next" -NotContains $container) { + elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "dev" -or $version.type -eq "beta") { + elseif ($version.type -eq "dev") { if ($version.type -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -138,7 +138,7 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec $storePath = "$container" if ($container -eq "public") { $storePath = "scripts/b" -} elseif ($container -ne "beta" -and $container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { +} elseif ($container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { $global:connectDetails.testOnly = $true $global:connectDetails.storeContainer = "tst" } diff --git a/README.md b/README.md index bfb87663d..e3f8d59cc 100644 --- a/README.md +++ b/README.md @@ -870,18 +870,19 @@ As with the normal release process the nightly builds also include major, minor, When a new release is deployed the following occurs as part of the release - NPM packages are created and published to [NpmJs](https://www.npmjs.com/package/@microsoft/applicationinsights-web) -- The new explicit versioned files (eg. `ai.2.7.2.js`; `ai.2.7.2.min.js`; `ai.2.7.2.gbl.min.js`; `ai.2.7.2.min.js.map`; etc) are uploaded to all cdn endpoints URL's (public, next and beta - details below) +- The new explicit versioned release files (eg. `ai.2.7.2.js`; `ai.2.7.2.min.js`; `ai.2.7.2.gbl.min.js`; `ai.2.7.2.min.js.map`; etc) are uploaded to the public and next CDN endpoints (details below). Release candidates and beta prerelease versions are uploaded only to next; their version names and NPM tags are unchanged. - We then go through a deployment process of "promoting" the new version to the "Major" (`ai.3.gbl.min.js`) and "Minor" (`ai.3.x.gbl.min.js`) release URL's to upgrade everyone to the newly released version based on the schedule listed below | Endpoint | Url | Schedule |----------|-------------|-------- -| Beta | https://js.monitor.azure.com/beta/ai.3.gbl.min.js | Same day as the NPM release -| Next | https://js.monitor.azure.com/next/ai.3.gbl.min.js | One additional work day after the `beta` URL promotion. -| Public | https://js.monitor.azure.com/scripts/b/ai.3.gbl.min.js | Another One additional work day after the `next` URL promotion, (so 2 work days after initial release) unless this falls on the last work day of the week (eg. Friday) in which case it will be delayed until the first work day of the next work week. +| Next | https://js.monitor.azure.com/next/ai.3.gbl.min.js | Initial promotion after the NPM release. +| Public | https://js.monitor.azure.com/scripts/b/ai.3.gbl.min.js | Promoted after next validation according to the release deployment plan; the production URL is unchanged. + +The beta CDN channel is no longer published or activated. Existing beta files remain available for legacy consumers and version listing. The milestones for each release should include both the deployment plan (as it's about to be released) or the final release times as with [v2.7.2](https://github.com/microsoft/ApplicationInsights-JS/milestone/58) -It is expected that most users will be using the `Public` URL, however, it is also recommended that if you have a test or canary environment that you should use either the `beta` or `next` URL's so that you would be alerted first before any production users are impacted. If any issues are detected with the `beta` or `next` URL's as a new release is being deployed please raise a new [Issue](https://github.com/microsoft/ApplicationInsights-JS/issues) as soon as this is confirmed. +It is expected that most users will be using the `Public` URL, however, it is also recommended that if you have a test or canary environment that you should use the `next` URL so that you would be alerted first before any production users are impacted. If any issues are detected with the `next` URL as a new release is being deployed please raise a new [Issue](https://github.com/microsoft/ApplicationInsights-JS/issues) as soon as this is confirmed. ## Release Notes diff --git a/common/publish/Tests/CdnPublishing.tests.ps1 b/common/publish/Tests/CdnPublishing.tests.ps1 new file mode 100644 index 000000000..0f10ea1ed --- /dev/null +++ b/common/publish/Tests/CdnPublishing.tests.ps1 @@ -0,0 +1,182 @@ +$ErrorActionPreference = "Stop" + +$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..\..")).Path +$packages = @( + @{ path = "AISKU"; suffix = ""; publicPath = "scripts/b"; count = 13 }, + @{ path = "extensions\applicationinsights-clickanalytics-js"; suffix = "/ext"; publicPath = "scripts/b/ext"; count = 13 }, + @{ path = "extensions\applicationinsights-debugplugin-js"; suffix = "/ext"; publicPath = "scripts/b/ext"; count = 13 }, + @{ path = "extensions\applicationinsights-perfmarkmeasure-js"; suffix = "/ext"; publicPath = "scripts/b/ext"; count = 13 }, + @{ path = "tools\chrome-debug-extension"; suffix = "/tools"; publicPath = "release/tools"; count = 2 }, + @{ path = "tools\config"; suffix = ""; publicPath = "scripts/b"; count = 1 } +) + +function Assert-Equal($expected, $actual, [string] $message) { + if ($expected -cne $actual) { + throw "$message -- expected [$expected], got [$actual]" + } +} + +function Read-Script([string] $path) { + $tokens = $null + $errors = $null + $ast = [System.Management.Automation.Language.Parser]::ParseFile($path, [ref] $tokens, [ref] $errors) + if ($errors.Count -ne 0) { + throw "PowerShell parse errors in ${path}: $errors" + } + return $ast +} + +$helper = Read-Script (Join-Path $repoRoot "common\publish\AzStorageHelper\AzStorageHelper.psm1") +$versionFunction = $helper.Find({ + param($node) + $node -is [System.Management.Automation.Language.FunctionDefinitionAst] -and $node.Name -eq "Get-VersionDetails" +}, $false) +. ([scriptblock]::Create($versionFunction.Extent.Text)) + +function Test-Publishing($package, [string] $versionString, [string[]] $expectedPaths) { + $path = Join-Path $repoRoot "$($package.path)\scripts\publishAzReleaseToCdn.ps1" + $ast = Read-Script $path + $version = Get-VersionDetails $versionString + $releaseFiles = @{ "ai.$versionString.js" = "release" } + $testFiles = @{ "ai_test.config.$versionString.cfg.json" = "test" } + $cacheControl1Year = "public, max-age=31536000, immutable, no-transform" + $contentType = "application/test" + $overwrite = $false + $global:connectDetails = @{ testOnly = $false; storeContainer = "cdn" } + $calls = [System.Collections.Generic.List[hashtable]]::new() + + function PublishFiles($files, $storePath, $cacheControl, $type, $replace) { + $calls.Add(@{ files = $files; path = $storePath }) + Assert-Equal $cacheControl1Year $cacheControl "Cache policy changed" + Assert-Equal $contentType $type "Content type changed" + Assert-Equal $overwrite $replace "Overwrite flag changed" + } + + # Execute only the real routing block, never Azure setup or authentication. + $routing = $ast.EndBlock.Statements | Where-Object { + $_ -is [System.Management.Automation.Language.IfStatementAst] -and + $_.Clauses[0].Item1.Extent.Text -eq '$version.type -eq "release"' + } + Assert-Equal 1 @($routing).Count "Expected one publishing routing block in $path" + . ([scriptblock]::Create($routing.Extent.Text)) + + Assert-Equal ($expectedPaths -join ",") (($calls | ForEach-Object { $_.path }) -join ",") "$path $versionString destinations" + $usesTestConfig = $package.path -eq "tools\config" -and + ($version.type -eq "beta" -or $version.type -eq "dev" -or $version.type -like "nightly*") + foreach ($call in $calls) { + $expectedFiles = $releaseFiles + if ($usesTestConfig) { + $expectedFiles = $testFiles + } + Assert-Equal $true ([object]::ReferenceEquals($expectedFiles, $call.files)) "$path $versionString file selection" + } + Assert-Equal ($version.type -eq "alpha") $global:connectDetails.testOnly "$path test storage isolation" +} + +function Test-Activation($package, [string] $versionString, [string] $container, [bool] $valid, [bool] $minorOnly = $false) { + $path = Join-Path $repoRoot "$($package.path)\scripts\setAzActiveCdnVersion.ps1" + $ast = Read-Script $path + $activeVersion = $versionString + $global:connectDetails = @{ testOnly = $false; storeContainer = "cdn" } + $calls = [System.Collections.Generic.List[hashtable]]::new() + + function Write-Log($message) {} + function Write-LogWarning($message) {} + function Write-LogFailure($message) { throw $message } + function Get-HasErrors { return $false } + + $validation = $ast.Find({ + param($node) + $node -is [System.Management.Automation.Language.FunctionDefinitionAst] -and $node.Name -eq "Validate-Params" + }, $false) + . ([scriptblock]::Create($validation.Extent.Text)) + $validationError = $null + try { + $version = Validate-Params + } catch { + $validationError = $_ + } + if (!$valid) { + if ($null -eq $validationError) { + throw "$path accepted invalid activation $versionString in $container" + } + return + } + if ($null -ne $validationError) { + throw $validationError + } + + $usesTestConfig = $package.path -eq "tools\config" -and + ($container -eq "dev" -or $container -eq "nightly" -or $version.type -eq "beta") + $selectedFiles = [System.Collections.Generic.List[hashtable]]::new() + for ($idx = 0; $idx -lt $package.count; $idx++) { + $selectedFiles.Add(@{ name = "file$idx" }) + } + function Get-VersionFiles($files, $storePath, $prefix, $requestedVersion) { + $expectedPath = "$container$($package.suffix)" + if ($container -eq "public") { + $expectedPath = $package.publicPath + } + Assert-Equal $expectedPath $storePath "Activation source path changed" + Assert-Equal $versionString $requestedVersion "Prerelease version name changed" + if ($package.path -ne "tools\config" -or ($prefix -eq "ai_test.config.") -eq $usesTestConfig) { + $files[$requestedVersion] = $selectedFiles + } + } + function SetActiveVersion($files, $storePath, $minor, $unversioned) { + Assert-Equal $true ([object]::ReferenceEquals($selectedFiles, $files)) "Wrong files activated" + Assert-Equal $minorOnly $minor "Minor-only flag changed" + Assert-Equal ($package.path -eq "tools\chrome-debug-extension") ([bool] $unversioned) "Unversioned alias behavior changed" + $calls.Add(@{ path = $storePath }) + } + + $source = $ast.Extent.Text + $start = $source.IndexOf('$files = New-Object') + if ($start -lt 0) { + throw "Missing activation file lookup in $path" + } + . ([scriptblock]::Create($source.Substring($start))) + Assert-Equal 1 $calls.Count "$path should activate once" + $expectedPath = "$container$($package.suffix)" + if ($container -eq "public") { + $expectedPath = $package.publicPath + } + Assert-Equal $expectedPath $calls[0].path "$path activation destination" +} + +foreach ($package in $packages) { + $suffix = $package.suffix + Test-Publishing $package "3.4.5" @("next$suffix", $package.publicPath) + Test-Publishing $package "3.4.5-rc.1" @("next$suffix") + Test-Publishing $package "3.4.5-beta.1" @("next$suffix") + Test-Publishing $package "3.4.5-beta.2+build7" @("next$suffix") + Test-Publishing $package "3.4.5-dev" @("dev$suffix") + Test-Publishing $package "3.4.5-nightly.1" @("nightly$suffix") + Test-Publishing $package "3.4.5-nightlybeta.1" @("nightly$suffix") + Test-Publishing $package "3.4.5-alpha.1" @("alpha$suffix") + + Test-Activation $package "3.4.5" "next" $true + Test-Activation $package "3.4.5" "public" $true + Test-Activation $package "3.4.5-rc.1" "next" $true + Test-Activation $package "3.4.5-beta.1" "next" $true + Test-Activation $package "3.4.5-beta.2+build7" "next" $true $true + Test-Activation $package "3.4.5-dev" "dev" $true + Test-Activation $package "3.4.5-nightly.1" "nightly" $true + Test-Activation $package "3.4.5" "beta" $false + Test-Activation $package "3.4.5-rc.1" "beta" $false + Test-Activation $package "3.4.5-beta.1" "beta" $false + Test-Activation $package "3.4.5-beta.1" "public" $false + Test-Activation $package "3.4.5-beta.1" "dev" $false + + $listing = Read-Script (Join-Path $repoRoot "$($package.path)\scripts\listAzCdnVersions.ps1") + Assert-Equal $true ($listing.Extent.Text.Contains('Get-AllVersionFiles $files "beta')) "$($package.path) must retain legacy beta listing" + Write-Output "PASS: $($package.path) publishing, activation and legacy listing" +} + +$e2e = Get-Content (Join-Path $repoRoot "AISKU\Tests\Unit\src\applicationinsights.e2e.tests.ts") -Raw +Assert-Equal $false ($e2e.Contains("https://js.monitor.azure.com/beta/")) "E2E must not consume the frozen beta channel" +Assert-Equal $true ($e2e.Contains("https://js.monitor.azure.com/next/ai.3.gbl.min.js?")) "E2E must monitor next" +$site = Get-Content (Join-Path $repoRoot "tools\github-page-script-injection\injectScript.js") -Raw +Assert-Equal $true ($site.Contains('scriptContent.replaceAll("/scripts/b/", "/next/")')) "Docs site must consume next" +Assert-Equal $true ($site.Contains("https://js.monitor.azure.com/next/ai.config.1.cfg.json")) "Docs config must consume next" +Write-Output "PASS: live-test and docs-site channel selection" diff --git a/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1 b/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1 index df287b003..f01f2e9c7 100644 --- a/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1 +++ b/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1 @@ -126,15 +126,13 @@ Write-Log "--------------------------------------------------------------------- # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - PublishFiles $releaseFiles "beta/ext" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "scripts/b/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc") { - PublishFiles $releaseFiles "beta/ext" $cacheControl1Year $contentType $overwrite +elseif ($version.type -eq "rc" -or $version.type -eq "beta") { PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "dev" -or $version.type -eq "beta") { +elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)/ext" $cacheControl1Year $contentType $overwrite } diff --git a/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1 b/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1 index 513f093a2..1f70554a6 100644 --- a/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1 +++ b/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1 @@ -73,16 +73,16 @@ Function Validate-Params # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - if ("beta","next","public" -NotContains $container) { + if ("next","public" -NotContains $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc") { - if ("beta","next" -NotContains $container) { + elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "dev" -or $version.type -eq "beta") { + elseif ($version.type -eq "dev") { if ($version.type -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -139,7 +139,7 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec $storePath = "$container/ext" if ($container -eq "public") { $storePath = "scripts/b/ext" -} elseif ($container -ne "beta" -and $container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { +} elseif ($container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { $global:connectDetails.testOnly = $true $global:connectDetails.storeContainer = "tst/ext" } diff --git a/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1 b/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1 index d25ac9548..11fafc4f8 100644 --- a/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1 +++ b/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1 @@ -126,15 +126,13 @@ Write-Log "--------------------------------------------------------------------- # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - PublishFiles $releaseFiles "beta/ext" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "scripts/b/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc") { - PublishFiles $releaseFiles "beta/ext" $cacheControl1Year $contentType $overwrite +elseif ($version.type -eq "rc" -or $version.type -eq "beta") { PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "dev" -or $version.type -eq "beta") { +elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)/ext" $cacheControl1Year $contentType $overwrite } diff --git a/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1 b/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1 index a968001e0..1058870e2 100644 --- a/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1 +++ b/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1 @@ -73,16 +73,16 @@ Function Validate-Params # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - if ("beta","next","public" -NotContains $container) { + if ("next","public" -NotContains $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc") { - if ("beta","next" -NotContains $container) { + elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "dev" -or $version.type -eq "beta") { + elseif ($version.type -eq "dev") { if ($version.type -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -139,7 +139,7 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec $storePath = "$container/ext" if ($container -eq "public") { $storePath = "scripts/b/ext" -} elseif ($container -ne "beta" -and $container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { +} elseif ($container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { $global:connectDetails.testOnly = $true $global:connectDetails.storeContainer = "tst/ext" } diff --git a/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1 b/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1 index e166a7e43..4d3a5bc76 100644 --- a/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1 +++ b/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1 @@ -126,15 +126,13 @@ Write-Log "--------------------------------------------------------------------- # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - PublishFiles $releaseFiles "beta/ext" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "scripts/b/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc") { - PublishFiles $releaseFiles "beta/ext" $cacheControl1Year $contentType $overwrite +elseif ($version.type -eq "rc" -or $version.type -eq "beta") { PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "dev" -or $version.type -eq "beta") { +elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)/ext" $cacheControl1Year $contentType $overwrite } diff --git a/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1 b/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1 index 6a489cc64..8ed65d24b 100644 --- a/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1 +++ b/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1 @@ -73,16 +73,16 @@ Function Validate-Params # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - if ("beta","next","public" -NotContains $container) { + if ("next","public" -NotContains $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc") { - if ("beta","next" -NotContains $container) { + elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "dev" -or $version.type -eq "beta") { + elseif ($version.type -eq "dev") { if ($version.type -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -139,7 +139,7 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec $storePath = "$container/ext" if ($container -eq "public") { $storePath = "scripts/b/ext" -} elseif ($container -ne "beta" -and $container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { +} elseif ($container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { $global:connectDetails.testOnly = $true $global:connectDetails.storeContainer = "tst/ext" } diff --git a/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 b/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 index 0bdc2dd93..3e81571f6 100644 --- a/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 +++ b/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 @@ -115,15 +115,13 @@ Write-Log "--------------------------------------------------------------------- # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - PublishFiles $releaseFiles "beta/tools" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "next/tools" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "release/tools" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc") { - PublishFiles $releaseFiles "beta/tools" $cacheControl1Year $contentType $overwrite +elseif ($version.type -eq "rc" -or $version.type -eq "beta") { PublishFiles $releaseFiles "next/tools" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "dev" -or $version.type -eq "beta") { +elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)/tools" $cacheControl1Year $contentType $overwrite } diff --git a/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 b/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 index 91cc80821..09b4c3c43 100644 --- a/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 +++ b/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 @@ -73,16 +73,16 @@ Function Validate-Params # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - if ("beta","next","public" -NotContains $container) { + if ("next","public" -NotContains $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc") { - if ("beta","next" -NotContains $container) { + elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "dev" -or $version.type -eq "beta") { + elseif ($version.type -eq "dev") { if ($version.type -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -139,7 +139,7 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec $storePath = "$container/tools" if ($container -eq "public") { $storePath = "release/tools" -} elseif ($container -ne "beta" -and $container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { +} elseif ($container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { $global:connectDetails.testOnly = $true $global:connectDetails.storeContainer = "tst/tools" } diff --git a/tools/config/README.md b/tools/config/README.md index 5d771fe08..4e284116e 100644 --- a/tools/config/README.md +++ b/tools/config/README.md @@ -8,14 +8,15 @@ V1 ## Endpoints -### Beta - -https://js.monitor.azure.com/beta/ai.config.1.cfg.json - ### Next https://js.monitor.azure.com/next/ai.config.1.cfg.json +New releases and release candidates are published to `next`; beta prerelease versions retain their +`-beta` filenames and use `next/ai_test.config..cfg.json`. Activating a beta prerelease in +`next` updates the test configuration aliases, not the release configuration aliases. +Existing `beta` files remain available for legacy consumers and version listing, but are no longer published or activated. + ### Public https://js.monitor.azure.com/scripts/b/ai.config.1.cfg.json diff --git a/tools/config/scripts/publishAzReleaseToCdn.ps1 b/tools/config/scripts/publishAzReleaseToCdn.ps1 index 404dcf5b2..e5c97b2ee 100644 --- a/tools/config/scripts/publishAzReleaseToCdn.ps1 +++ b/tools/config/scripts/publishAzReleaseToCdn.ps1 @@ -140,15 +140,16 @@ Write-Log "--------------------------------------------------------------------- # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - PublishFiles $releaseFiles "beta" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "next" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "scripts/b" $cacheControl1Year $contentType $overwrite } elseif ($version.type -eq "rc") { - PublishFiles $releaseFiles "beta" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "next" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "dev" -or $version.type -eq "beta") { +elseif ($version.type -eq "beta") { + PublishFiles $testFiles "next" $cacheControl1Year $contentType $overwrite +} +elseif ($version.type -eq "dev") { # Publish to release type folder folder # PublishFiles $releaseFiles "$($version.type)" $cacheControl1Year $contentType $overwrite PublishFiles $testFiles "$($version.type)" $cacheControl1Year $contentType $overwrite diff --git a/tools/config/scripts/setAzActiveCdnVersion.ps1 b/tools/config/scripts/setAzActiveCdnVersion.ps1 index afdcdad40..796106d51 100644 --- a/tools/config/scripts/setAzActiveCdnVersion.ps1 +++ b/tools/config/scripts/setAzActiveCdnVersion.ps1 @@ -73,16 +73,16 @@ Function Validate-Params # Publish the full versioned files to all release folders if ($version.type -eq "release") { # Normal publishing deployment - if ("beta","next","public" -NotContains $container) { + if ("next","public" -NotContains $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc") { - if ("beta","next" -NotContains $container) { + elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "dev" -or $version.type -eq "beta") { + elseif ($version.type -eq "dev") { if ($version.type -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -140,7 +140,7 @@ $testFiles = New-Object 'system.collections.generic.dictionary[string, system.co $storePath = "$container" if ($container -eq "public") { $storePath = "scripts/b" -} elseif ($container -ne "beta" -and $container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { +} elseif ($container -ne "next" -and $container -ne "dev" -and $container -ne "nightly") { $global:connectDetails.testOnly = $true $global:connectDetails.storeContainer = "tst" } @@ -148,7 +148,7 @@ if ($container -eq "public") { Get-VersionFiles $files $storePath "ai.config." $activeVersion Get-VersionFiles $testFiles $storePath "ai_test.config." $activeVersion -if ($container -eq "dev" -or $container -eq "nightly") { +if ($container -eq "dev" -or $container -eq "nightly" -or $version.type -eq "beta") { if ($testFiles.ContainsKey($activeVersion) -ne $true) { Write-LogFailure "Test Version [$activeVersion] does not appear to be deployed to [$container]" } @@ -163,7 +163,7 @@ if (Get-HasErrors -eq $true) { exit 2 } -if ($container -eq "dev" -or $container -eq "nightly") { +if ($container -eq "dev" -or $container -eq "nightly" -or $version.type -eq "beta") { SetActiveVersion $testFiles[$activeVersion] $storePath $minorOnly } else { SetActiveVersion $files[$activeVersion] $storePath $minorOnly From 19b325bcd3ae8b08d5dedbdfa1d5aeeff9e0397a Mon Sep 17 00:00:00 2001 From: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:18:18 -0800 Subject: [PATCH 2/5] Remove obsolete beta release workflow support Drop beta release inputs, npm tag generation, CDN routing and listing options, and beta CI branch triggers. Validate supported release types before publishing or activation, including npm packaging and latest-tag promotion. Keep deployed CDN files and historical release records unchanged. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/copilot-instructions.md | 4 +- .github/workflows/ci.yml | 8 +- .github/workflows/codeql-analysis.yml | 4 +- AISKU/scripts/README.md | 12 +- AISKU/scripts/listAzCdnVersions.ps1 | 7 +- AISKU/scripts/publishAzReleaseToCdn.ps1 | 12 +- AISKU/scripts/setAzActiveCdnVersion.ps1 | 8 +- README.md | 4 +- common/publish/Tests/CdnPublishing.tests.ps1 | 90 +++++++++-- .../scripts/listAzCdnVersions.ps1 | 7 +- .../scripts/publishAzReleaseToCdn.ps1 | 12 +- .../scripts/setAzActiveCdnVersion.ps1 | 8 +- .../scripts/listAzCdnVersions.ps1 | 7 +- .../scripts/publishAzReleaseToCdn.ps1 | 12 +- .../scripts/setAzActiveCdnVersion.ps1 | 8 +- .../scripts/listAzCdnVersions.ps1 | 7 +- .../scripts/publishAzReleaseToCdn.ps1 | 12 +- .../scripts/setAzActiveCdnVersion.ps1 | 8 +- .../scripts/listAzCdnVersions.ps1 | 7 +- .../scripts/publishAzReleaseToCdn.ps1 | 12 +- .../scripts/setAzActiveCdnVersion.ps1 | 8 +- tools/config/README.md | 7 +- tools/config/scripts/listAzCdnVersions.ps1 | 7 +- .../config/scripts/publishAzReleaseToCdn.ps1 | 13 +- .../config/scripts/setAzActiveCdnVersion.ps1 | 12 +- tools/release-tools/README.md | 16 +- tools/release-tools/ReleaseTypes.tests.js | 141 ++++++++++++++++++ tools/release-tools/npm_package.js | 2 + tools/release-tools/npm_publish.js | 2 + tools/release-tools/npm_set_latest.js | 2 + tools/release-tools/releaseTypes.js | 17 +++ tools/release-tools/setVersion.js | 26 ++-- 32 files changed, 376 insertions(+), 126 deletions(-) create mode 100644 tools/release-tools/ReleaseTypes.tests.js create mode 100644 tools/release-tools/releaseTypes.js diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 0c4216a43..5071b5d17 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -425,9 +425,9 @@ npm run setVersion -- 3.4.0 # Set an explicit version # Pre-release variants: npm run setVersion -- -next -dev # Increment + dev pre-release tag (x.y.z-dev) -npm run setVersion -- -next -beta # Increment + beta pre-release tag (x.y.z-beta) +npm run setVersion -- -next -pre rc # Increment + release candidate tag (x.y.z-rc) npm run setVersion -- -next -alpha # Increment + alpha pre-release tag (x.y.z-alpha) -npm run setVersion -- -release # Strip pre-release tag from current version (x.y.z-beta => x.y.z) +npm run setVersion -- -release # Strip pre-release tag from current version (x.y.z-rc => x.y.z) # Dry run (logs changes without modifying files): npm run setVersion -- -next -test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 935380868..f7dbd8bde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,11 +8,11 @@ permissions: on: push: - branches: [ main, master, beta, Release2.7, release-3.0 ] + branches: [ main, master, Release2.7, release-3.0 ] pull_request: - branches: [ main, master, beta, Release2.7, release-3.0 ] + branches: [ main, master, Release2.7, release-3.0 ] merge_group: - branches: [ "main", "master", "beta", "Release*", "release*", "*-legacy", "legacy-v1" ] + branches: [ "main", "master", "Release*", "release*", "*-legacy", "legacy-v1" ] jobs: build: @@ -41,6 +41,8 @@ jobs: with: node-version: ${{ matrix.node-version }} check-latest: true + - name: Test release type validation + run: node tools/release-tools/ReleaseTypes.tests.js - name: Update rush shrinkwrap dependencies (for different node versions) run: node common/scripts/install-run-rush.js update --full --recheck - run: npm install rollup -g diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1e43fb37e..811e60ffd 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [ "main", "master", "beta", "Release*", "release*", "*-legacy", "legacy-v1" ] + branches: [ "main", "master", "Release*", "release*", "*-legacy", "legacy-v1" ] pull_request: # The branches below must be a subset of the branches above - branches: [ "main", "master", "beta", "Release*", "release*", "*-legacy", "legacy-v1" ] + branches: [ "main", "master", "Release*", "release*", "*-legacy", "legacy-v1" ] schedule: - cron: '15 17 * * 2' # Every Tuesday at 17:15 UTC diff --git a/AISKU/scripts/README.md b/AISKU/scripts/README.md index 1d88a8d98..4e582e82c 100644 --- a/AISKU/scripts/README.md +++ b/AISKU/scripts/README.md @@ -31,9 +31,9 @@ The Scripts and examples are included below, but as a summary they are ### ./publishAzReleaseToCdn.ps1 -This script has been created to automate the deployment of the CDN resources at the same time as publishing of the NPM packages. This script will publish the full release version (v2.#.#) to next and public. Release candidates and beta prerelease versions are published only to next, retaining their version names and NPM tags. It does NOT change the major (ai.2.min.js) or minor (ai.2.#.min.js) release versions. +This script has been created to automate the deployment of the CDN resources at the same time as publishing of the NPM packages. This script will publish the full release version (v2.#.#) to next and public. Release candidates are published only to next. Dev and nightly builds retain their own folders, while alpha builds remain isolated in test storage. It does NOT change the major (ai.2.min.js) or minor (ai.2.#.min.js) release versions. -The beta CDN channel is read-only legacy history: existing files and version listing remain available, but publishing and activation no longer write to beta. The dated example output below is retained as historical output. +Supported version types are `release`, `rc`, `dev`, `nightly` and `alpha`. Unsupported versions fail validation before connecting to Azure. Beta release/channel options are no longer supported by publishing, activation or listing tools; existing CDN files are not deleted. The dated example output below is retained as historical output. Offline publishing and activation regression tests can be run from the repository root with `pwsh -NoProfile -File common\publish\Tests\CdnPublishing.tests.ps1`; they do not connect to Azure. @@ -115,7 +115,7 @@ PS D:\git\ApplicationInsights-JS\AISKU\scripts> .\publishAzReleaseToCdn.ps1 -cdn ### ./setAzActiveCdnVersion.ps1 -This script will set the active release for the specified release folder (next, public) to the requested full version (2.x.x) number. Release candidates and beta prerelease versions can only be activated in next; dev and nightly versions retain their corresponding folders. By default it will set both the major (ai.2.min.js) and minor (ai.2.x.min.js) versions to the requested full version, you can optionally only update the minor version. +This script will set the active release for the specified release folder (next, public) to the requested full version (2.x.x) number. Release candidates can only be activated in next; dev and nightly versions retain their corresponding folders. By default it will set both the major (ai.2.min.js) and minor (ai.2.x.min.js) versions to the requested full version, you can optionally only update the minor version. > :bulb: **Note** > @@ -125,7 +125,7 @@ __Command line arguments__ | Name | Type | Description |------|------|---------------- -| container | string | __[Required]__ Identifies the target container to update (next, public). Beta is no longer a writable CDN channel. +| container | string | __[Required]__ Identifies the target container to update (next, public, dev, nightly). | activeVersion | string | __[Required]__ Identifies the source full version number to copy and make the active released version fro the specified container. This MUST be the full version number in the form "a.b.c". The new active versions will be created (or overwritten) as the major version (ai.[a].min.js) and minor version (ai.[a].[b].min.js). | cdnStorePath | string | [Optional] Identifies the target Azure Storage account (by name) where the files will be uploaded to. As you may have access to multiple subscriptions, resource groups, and storage accounts (which can slow the automatic validation / identification process) you can optionally include the a partial subscription id and resource group name with the storage account name. So you can specify the target using any of the following 3 forms :-
- <Full storage account name>
- <partial or full subscription id>::<Full storage account name>
- <partial or full subscription id>::<Full resource group name>::<Full storage account name>
The subscription id is used to match against the collection of subscription id's that the user/runner has access to, it uses the PowerShell -like matching by wrapping the value in '*'
When a resource group name is supplied it will further limit the collection of storage accounts that are scanned / checked for the storage account name.
Example: `"65b2f83e::tstcdnstore"` | sasToken | string | [Optional] For automated deployments, it is recommended that you pass in a pre-generated Shared Access Signature (SAS) Token to avoid the script attempting to login the user which could cause a blocking UI to be displayed. When supplied the script bypasses the automated scan / checks and will just used the identified storage account name from the `cdnStorePath` argument. If this value is not specified the script will ensure that the user is logged into azure (displaying a login UI), enumerate all of the subscription Id's for the user to find full location of the storage account identified by the `cdnStorePath` argument, once identified it will then Generate a new SAS token for the script (as long as the user has permissions) for the target subscription. @@ -204,12 +204,12 @@ __Command line arguments__ | Name | Type | Description |------|------|---------------- -| container | string | __[Optional]__ Identifies the single target container to list the available versions for (beta, next, public). If not specified all containers will be enumerated. +| container | string | __[Optional]__ Identifies the single target container to list the available versions for (next, public, dev, nightly). If not specified all supported containers will be enumerated. | cdnStorePath | string | [Optional] Identifies the target Azure Storage account (by name) where the files will be uploaded to. As you may have access to multiple subscriptions, resource groups, and storage accounts (which can slow the automatic validation / identification process) you can optionally include the a partial subscription id and resource group name with the storage account name. So you can specify the target using any of the following 3 forms :-
- <Full storage account name>
- <partial or full subscription id>::<Full storage account name>
- <partial or full subscription id>::<Full resource group name>::<Full storage account name>
The subscription id is used to match against the collection of subscription id's that the user/runner has access to, it uses the PowerShell -like matching by wrapping the value in '*'
When a resource group name is supplied it will further limit the collection of storage accounts that are scanned / checked for the storage account name.
Example: `"65b2f83e::tstcdnstore"` | sasToken | string | [Optional] For automated deployments, it is recommended that you pass in a pre-generated Shared Access Signature (SAS) Token to avoid the script attempting to login the user which could cause a blocking UI to be displayed. When supplied the script bypasses the automated scan / checks and will just used the identified storage account name from the `cdnStorePath` argument. If this value is not specified the script will ensure that the user is logged into azure (displaying a login UI), enumerate all of the subscription Id's for the user to find full location of the storage account identified by the `cdnStorePath` argument, once identified it will then Generate a new SAS token for the script (as long as the user has permissions) for the target subscription. | logPath | string | [Optional] Identifies the location where the automatic log file will be written. Defaults to :\Logs | showFiles | switch | [Optional] Identifies whether the details of each located blob should be listed, this includes the CacheControl and metadata for each file -| testOnly | switch | [Optional] By default the script will update the production containers (beta, next and scripts), for testing this switch will effectively only update the "tst" container versions with and the normal container names will instead be prepended (simulating folders) to the name. ([tst] scripts/b/ai.2.min.js) +| testOnly | switch | [Optional] Lists the versions in the "tst" container instead of the normal next and scripts containers, using the normal container names as prefixes. | useConnectedAccount | switch | [Optional] By default the script will use the current logged in user to authenticate with Azure using SAS tokens, if you have disabled SAS token support for the storage account then you will need to use this switch and grant the user "Storage Blob Data Contributor" role. #### Example Usages and output diff --git a/AISKU/scripts/listAzCdnVersions.ps1 b/AISKU/scripts/listAzCdnVersions.ps1 index 37146dc1a..45369189d 100644 --- a/AISKU/scripts/listAzCdnVersions.ps1 +++ b/AISKU/scripts/listAzCdnVersions.ps1 @@ -50,8 +50,8 @@ Function Write-LogParams Function Validate-Params { # Validate parameters - if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "beta","next","public", "dev", "nightly" -NotContains $container) { - Write-LogFailure "[$($container)] is not a valid value, must be beta, next or public" + if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "next","public", "dev", "nightly" -NotContains $container) { + Write-LogFailure "[$($container)] is not a valid value, must be next, public, dev or nightly" } } @@ -98,7 +98,6 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec # Get the public files (scripts/b) if ([string]::IsNullOrWhiteSpace($container) -eq $true) { Get-AllVersionFiles $files "scripts/b" - Get-AllVersionFiles $files "beta" Get-AllVersionFiles $files "next" Get-AllVersionFiles $files "dev" Get-AllVersionFiles $files "nightly" @@ -107,7 +106,7 @@ if ([string]::IsNullOrWhiteSpace($container) -eq $true) { if ([string]::IsNullOrWhiteSpace($container) -ne $true) { if ($container -eq "public") { Get-AllVersionFiles $files "scripts/b" - } elseif ($container -eq "beta" -or $container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { + } elseif ($container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { Get-AllVersionFiles $files "$container" } else { $global:connectDetails.testOnly = $true diff --git a/AISKU/scripts/publishAzReleaseToCdn.ps1 b/AISKU/scripts/publishAzReleaseToCdn.ps1 index e9100ed18..c3212cdea 100644 --- a/AISKU/scripts/publishAzReleaseToCdn.ps1 +++ b/AISKU/scripts/publishAzReleaseToCdn.ps1 @@ -100,6 +100,12 @@ $contentType = "text/javascript; charset=utf-8"; Write-LogParams +$version = GetPackageVersion $jsSdkDir +if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" + exit 2 +} + # You will need to at least have the Az modules installed InstallRequiredModules $global:connectDetails = ParseCdnStorePath $global:connectDetails @@ -113,8 +119,6 @@ if ([string]::IsNullOrWhiteSpace($global:connectDetails.sasToken) -eq $true) { Write-Log "======================================================================" -$version = GetPackageVersion $jsSdkDir - $releaseFiles = GetReleaseFiles $version # Get the versioned files only if ($null -eq $releaseFiles -or $releaseFiles.Count -eq 0) { Write-LogFailure "Unable to find any release files" @@ -130,14 +134,14 @@ if ($version.type -eq "release") { PublishFiles $releaseFiles "next" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "scripts/b" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc" -or $version.type -eq "beta") { +elseif ($version.type -eq "rc") { PublishFiles $releaseFiles "next" $cacheControl1Year $contentType $overwrite } elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -like "nightly*") { +elseif ($version.type -eq "nightly") { # Publish to release nightly folder folder PublishFiles $releaseFiles "nightly" $cacheControl1Year $contentType $overwrite } diff --git a/AISKU/scripts/setAzActiveCdnVersion.ps1 b/AISKU/scripts/setAzActiveCdnVersion.ps1 index f657efc88..aaf7cbe4c 100644 --- a/AISKU/scripts/setAzActiveCdnVersion.ps1 +++ b/AISKU/scripts/setAzActiveCdnVersion.ps1 @@ -54,8 +54,8 @@ Function Validate-Params $version = Get-VersionDetails $activeVersion - if ([string]::IsNullOrWhiteSpace($version.type) -eq $true) { - Write-LogFailure "Unknown release type" + if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" } $versionParts = $version.ver.Split(".") @@ -77,7 +77,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + elseif ($version.type -eq "rc") { if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -87,7 +87,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -like "nightly*") { + elseif ($version.type -eq "nightly") { if ("nightly" -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } diff --git a/README.md b/README.md index e3f8d59cc..968468235 100644 --- a/README.md +++ b/README.md @@ -870,7 +870,7 @@ As with the normal release process the nightly builds also include major, minor, When a new release is deployed the following occurs as part of the release - NPM packages are created and published to [NpmJs](https://www.npmjs.com/package/@microsoft/applicationinsights-web) -- The new explicit versioned release files (eg. `ai.2.7.2.js`; `ai.2.7.2.min.js`; `ai.2.7.2.gbl.min.js`; `ai.2.7.2.min.js.map`; etc) are uploaded to the public and next CDN endpoints (details below). Release candidates and beta prerelease versions are uploaded only to next; their version names and NPM tags are unchanged. +- The new explicit versioned release files (eg. `ai.2.7.2.js`; `ai.2.7.2.min.js`; `ai.2.7.2.gbl.min.js`; `ai.2.7.2.min.js.map`; etc) are uploaded to the public and next CDN endpoints (details below). Release candidates are uploaded only to next. - We then go through a deployment process of "promoting" the new version to the "Major" (`ai.3.gbl.min.js`) and "Minor" (`ai.3.x.gbl.min.js`) release URL's to upgrade everyone to the newly released version based on the schedule listed below | Endpoint | Url | Schedule @@ -878,7 +878,7 @@ When a new release is deployed the following occurs as part of the release | Next | https://js.monitor.azure.com/next/ai.3.gbl.min.js | Initial promotion after the NPM release. | Public | https://js.monitor.azure.com/scripts/b/ai.3.gbl.min.js | Promoted after next validation according to the release deployment plan; the production URL is unchanged. -The beta CDN channel is no longer published or activated. Existing beta files remain available for legacy consumers and version listing. +Beta releases and the beta CDN channel are no longer supported by release tooling. Existing CDN files remain available for legacy consumers. The milestones for each release should include both the deployment plan (as it's about to be released) or the final release times as with [v2.7.2](https://github.com/microsoft/ApplicationInsights-JS/milestone/58) diff --git a/common/publish/Tests/CdnPublishing.tests.ps1 b/common/publish/Tests/CdnPublishing.tests.ps1 index 0f10ea1ed..8f5bdeb70 100644 --- a/common/publish/Tests/CdnPublishing.tests.ps1 +++ b/common/publish/Tests/CdnPublishing.tests.ps1 @@ -33,7 +33,7 @@ $versionFunction = $helper.Find({ }, $false) . ([scriptblock]::Create($versionFunction.Extent.Text)) -function Test-Publishing($package, [string] $versionString, [string[]] $expectedPaths) { +function Test-Publishing($package, [string] $versionString, [string[]] $expectedPaths, [bool] $valid = $true) { $path = Join-Path $repoRoot "$($package.path)\scripts\publishAzReleaseToCdn.ps1" $ast = Read-Script $path $version = Get-VersionDetails $versionString @@ -51,8 +51,33 @@ function Test-Publishing($package, [string] $versionString, [string[]] $expected Assert-Equal $contentType $type "Content type changed" Assert-Equal $overwrite $replace "Overwrite flag changed" } + function Write-LogFailure($message) { throw $message } + + # Execute validation and routing only, never Azure setup or authentication. + $guard = $ast.EndBlock.Statements | Where-Object { + $_ -is [System.Management.Automation.Language.IfStatementAst] -and + $_.Clauses[0].Item1.Extent.Text -like '*-NotContains $version.type' + } + Assert-Equal 1 @($guard).Count "Expected one release type guard in $path" + $setup = $ast.EndBlock.Statements | Where-Object { $_.Extent.Text -eq "InstallRequiredModules" } + Assert-Equal $true ($guard.Extent.StartOffset -lt $setup.Extent.StartOffset) "Unsupported versions must fail before Azure setup" + $validationError = $null + try { + . ([scriptblock]::Create($guard.Extent.Text)) + } catch { + $validationError = $_ + } + if (!$valid) { + if ($null -eq $validationError) { + throw "$path accepted unsupported publishing version $versionString" + } + Assert-Equal 0 $calls.Count "Unsupported publishing must not write files" + return + } + if ($null -ne $validationError) { + throw $validationError + } - # Execute only the real routing block, never Azure setup or authentication. $routing = $ast.EndBlock.Statements | Where-Object { $_ -is [System.Management.Automation.Language.IfStatementAst] -and $_.Clauses[0].Item1.Extent.Text -eq '$version.type -eq "release"' @@ -62,7 +87,7 @@ function Test-Publishing($package, [string] $versionString, [string[]] $expected Assert-Equal ($expectedPaths -join ",") (($calls | ForEach-Object { $_.path }) -join ",") "$path $versionString destinations" $usesTestConfig = $package.path -eq "tools\config" -and - ($version.type -eq "beta" -or $version.type -eq "dev" -or $version.type -like "nightly*") + ($version.type -eq "dev" -or $version.type -eq "nightly") foreach ($call in $calls) { $expectedFiles = $releaseFiles if ($usesTestConfig) { @@ -107,7 +132,7 @@ function Test-Activation($package, [string] $versionString, [string] $container, } $usesTestConfig = $package.path -eq "tools\config" -and - ($container -eq "dev" -or $container -eq "nightly" -or $version.type -eq "beta") + ($container -eq "dev" -or $container -eq "nightly") $selectedFiles = [System.Collections.Generic.List[hashtable]]::new() for ($idx = 0; $idx -lt $package.count; $idx++) { $selectedFiles.Add(@{ name = "file$idx" }) @@ -144,22 +169,59 @@ function Test-Activation($package, [string] $versionString, [string] $container, Assert-Equal $expectedPath $calls[0].path "$path activation destination" } +function Test-Listing($package, [string] $container, [bool] $valid) { + $path = Join-Path $repoRoot "$($package.path)\scripts\listAzCdnVersions.ps1" + $ast = Read-Script $path + $calls = [System.Collections.Generic.List[string]]::new() + function Write-Log($message) {} + function Write-LogFailure($message) { throw $message } + function Get-AllVersionFiles($files, $storePath) { $calls.Add($storePath) } + function Get-AllTestVersionFiles($files, $storePath) { $calls.Add($storePath) } + function ListVersions($files, $activeOnly, $showFiles) {} + $validation = $ast.Find({ + param($node) + $node -is [System.Management.Automation.Language.FunctionDefinitionAst] -and $node.Name -eq "Validate-Params" + }, $false) + . ([scriptblock]::Create($validation.Extent.Text)) + $validationError = $null + try { + Validate-Params + } catch { + $validationError = $_ + } + if (!$valid) { + if ($null -eq $validationError) { + throw "$path accepted unsupported listing container $container" + } + return + } + if ($null -ne $validationError) { + throw $validationError + } + $source = $ast.Extent.Text + . ([scriptblock]::Create($source.Substring($source.IndexOf('$files = New-Object')))) + Assert-Equal $true ($calls.Count -gt 0) "Supported listing must read files" + Assert-Equal 0 @($calls | Where-Object { $_ -like "beta*" }).Count "Listing must not enumerate the obsolete channel" +} + foreach ($package in $packages) { $suffix = $package.suffix Test-Publishing $package "3.4.5" @("next$suffix", $package.publicPath) Test-Publishing $package "3.4.5-rc.1" @("next$suffix") - Test-Publishing $package "3.4.5-beta.1" @("next$suffix") - Test-Publishing $package "3.4.5-beta.2+build7" @("next$suffix") + Test-Publishing $package "3.4.5-beta.1" @() $false + Test-Publishing $package "3.4.5-beta.2+build7" @() $false Test-Publishing $package "3.4.5-dev" @("dev$suffix") Test-Publishing $package "3.4.5-nightly.1" @("nightly$suffix") - Test-Publishing $package "3.4.5-nightlybeta.1" @("nightly$suffix") + Test-Publishing $package "3.4.5-nightlybeta.1" @() $false + Test-Publishing $package "3.4.5-custom.1" @() $false Test-Publishing $package "3.4.5-alpha.1" @("alpha$suffix") Test-Activation $package "3.4.5" "next" $true Test-Activation $package "3.4.5" "public" $true Test-Activation $package "3.4.5-rc.1" "next" $true - Test-Activation $package "3.4.5-beta.1" "next" $true - Test-Activation $package "3.4.5-beta.2+build7" "next" $true $true + Test-Activation $package "3.4.5-rc.2+build7" "next" $true $true + Test-Activation $package "3.4.5-beta.1" "next" $false + Test-Activation $package "3.4.5-beta.2+build7" "next" $false Test-Activation $package "3.4.5-dev" "dev" $true Test-Activation $package "3.4.5-nightly.1" "nightly" $true Test-Activation $package "3.4.5" "beta" $false @@ -167,10 +229,14 @@ foreach ($package in $packages) { Test-Activation $package "3.4.5-beta.1" "beta" $false Test-Activation $package "3.4.5-beta.1" "public" $false Test-Activation $package "3.4.5-beta.1" "dev" $false + Test-Activation $package "3.4.5-nightlybeta.1" "nightly" $false + Test-Activation $package "3.4.5-custom.1" "custom" $false - $listing = Read-Script (Join-Path $repoRoot "$($package.path)\scripts\listAzCdnVersions.ps1") - Assert-Equal $true ($listing.Extent.Text.Contains('Get-AllVersionFiles $files "beta')) "$($package.path) must retain legacy beta listing" - Write-Output "PASS: $($package.path) publishing, activation and legacy listing" + foreach ($container in @("", "next", "public", "dev", "nightly")) { + Test-Listing $package $container $true + } + Test-Listing $package "beta" $false + Write-Output "PASS: $($package.path) supported publishing, activation and listing" } $e2e = Get-Content (Join-Path $repoRoot "AISKU\Tests\Unit\src\applicationinsights.e2e.tests.ts") -Raw diff --git a/extensions/applicationinsights-clickanalytics-js/scripts/listAzCdnVersions.ps1 b/extensions/applicationinsights-clickanalytics-js/scripts/listAzCdnVersions.ps1 index 58677ad87..bdf04582f 100644 --- a/extensions/applicationinsights-clickanalytics-js/scripts/listAzCdnVersions.ps1 +++ b/extensions/applicationinsights-clickanalytics-js/scripts/listAzCdnVersions.ps1 @@ -49,8 +49,8 @@ Function Write-LogParams Function Validate-Params { # Validate parameters - if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "beta","next","public", "dev", "nightly" -NotContains $container) { - Write-LogFailure "[$($container)] is not a valid value, must be beta, next or public" + if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "next","public", "dev", "nightly" -NotContains $container) { + Write-LogFailure "[$($container)] is not a valid value, must be next, public, dev or nightly" } } @@ -94,7 +94,6 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec # Get the public files (scripts/b) if ([string]::IsNullOrWhiteSpace($container) -eq $true) { Get-AllVersionFiles $files "scripts/b" - Get-AllVersionFiles $files "beta" Get-AllVersionFiles $files "next" Get-AllVersionFiles $files "dev" Get-AllVersionFiles $files "nightly" @@ -103,7 +102,7 @@ if ([string]::IsNullOrWhiteSpace($container) -eq $true) { if ([string]::IsNullOrWhiteSpace($container) -ne $true) { if ($container -eq "public") { Get-AllVersionFiles $files "scripts/b" - } elseif ($container -eq "beta" -or $container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { + } elseif ($container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { Get-AllVersionFiles $files "$container" } else { $global:connectDetails.testOnly = $true diff --git a/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1 b/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1 index f01f2e9c7..8f8fc1a19 100644 --- a/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1 +++ b/extensions/applicationinsights-clickanalytics-js/scripts/publishAzReleaseToCdn.ps1 @@ -100,6 +100,12 @@ $contentType = "text/javascript; charset=utf-8"; Write-LogParams +$version = GetPackageVersion $jsSdkDir +if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" + exit 2 +} + # You will need to at least have the Az modules installed InstallRequiredModules $global:connectDetails = ParseCdnStorePath $global:connectDetails @@ -113,8 +119,6 @@ if ([string]::IsNullOrWhiteSpace($global:connectDetails.sasToken) -eq $true) { Write-Log "======================================================================" -$version = GetPackageVersion $jsSdkDir - $releaseFiles = GetReleaseFiles $version # Get the versioned files only if ($null -eq $releaseFiles -or $releaseFiles.Count -eq 0) { Write-LogFailure "Unable to find any release files" @@ -129,14 +133,14 @@ if ($version.type -eq "release") { PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "scripts/b/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc" -or $version.type -eq "beta") { +elseif ($version.type -eq "rc") { PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite } elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -like "nightly*") { +elseif ($version.type -eq "nightly") { # Publish to release nightly folder folder PublishFiles $releaseFiles "nightly/ext" $cacheControl1Year $contentType $overwrite } diff --git a/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1 b/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1 index 1f70554a6..85e294945 100644 --- a/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1 +++ b/extensions/applicationinsights-clickanalytics-js/scripts/setAzActiveCdnVersion.ps1 @@ -54,8 +54,8 @@ Function Validate-Params $version = Get-VersionDetails $activeVersion - if ([string]::IsNullOrWhiteSpace($version.type) -eq $true) { - Write-LogFailure "Unknown release type" + if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" } $versionParts = $version.ver.Split(".") @@ -77,7 +77,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + elseif ($version.type -eq "rc") { if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -87,7 +87,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -like "nightly*") { + elseif ($version.type -eq "nightly") { if ("nightly" -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } diff --git a/extensions/applicationinsights-debugplugin-js/scripts/listAzCdnVersions.ps1 b/extensions/applicationinsights-debugplugin-js/scripts/listAzCdnVersions.ps1 index 1a3f415d9..94521a3d1 100644 --- a/extensions/applicationinsights-debugplugin-js/scripts/listAzCdnVersions.ps1 +++ b/extensions/applicationinsights-debugplugin-js/scripts/listAzCdnVersions.ps1 @@ -49,8 +49,8 @@ Function Write-LogParams Function Validate-Params { # Validate parameters - if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "beta","next","public", "dev", "nightly" -NotContains $container) { - Write-LogFailure "[$($container)] is not a valid value, must be beta, next or public" + if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "next","public", "dev", "nightly" -NotContains $container) { + Write-LogFailure "[$($container)] is not a valid value, must be next, public, dev or nightly" } } @@ -94,7 +94,6 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec # Get the public files (scripts/b) if ([string]::IsNullOrWhiteSpace($container) -eq $true) { Get-AllVersionFiles $files "scripts/b" - Get-AllVersionFiles $files "beta" Get-AllVersionFiles $files "next" Get-AllVersionFiles $files "dev" Get-AllVersionFiles $files "nightly" @@ -103,7 +102,7 @@ if ([string]::IsNullOrWhiteSpace($container) -eq $true) { if ([string]::IsNullOrWhiteSpace($container) -ne $true) { if ($container -eq "public") { Get-AllVersionFiles $files "scripts/b" - } elseif ($container -eq "beta" -or $container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { + } elseif ($container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { Get-AllVersionFiles $files "$container" } else { $global:connectDetails.testOnly = $true diff --git a/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1 b/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1 index 11fafc4f8..cfca27295 100644 --- a/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1 +++ b/extensions/applicationinsights-debugplugin-js/scripts/publishAzReleaseToCdn.ps1 @@ -100,6 +100,12 @@ $contentType = "text/javascript; charset=utf-8"; Write-LogParams +$version = GetPackageVersion $jsSdkDir +if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" + exit 2 +} + # You will need to at least have the Az modules installed InstallRequiredModules $global:connectDetails = ParseCdnStorePath $global:connectDetails @@ -113,8 +119,6 @@ if ([string]::IsNullOrWhiteSpace($global:connectDetails.sasToken) -eq $true) { Write-Log "======================================================================" -$version = GetPackageVersion $jsSdkDir - $releaseFiles = GetReleaseFiles $version # Get the versioned files only if ($null -eq $releaseFiles -or $releaseFiles.Count -eq 0) { Write-LogFailure "Unable to find any release files" @@ -129,14 +133,14 @@ if ($version.type -eq "release") { PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "scripts/b/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc" -or $version.type -eq "beta") { +elseif ($version.type -eq "rc") { PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite } elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -like "nightly*") { +elseif ($version.type -eq "nightly") { # Publish to release nightly folder folder PublishFiles $releaseFiles "nightly/ext" $cacheControl1Year $contentType $overwrite } diff --git a/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1 b/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1 index 1058870e2..f9d2e2290 100644 --- a/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1 +++ b/extensions/applicationinsights-debugplugin-js/scripts/setAzActiveCdnVersion.ps1 @@ -54,8 +54,8 @@ Function Validate-Params $version = Get-VersionDetails $activeVersion - if ([string]::IsNullOrWhiteSpace($version.type) -eq $true) { - Write-LogFailure "Unknown release type" + if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" } $versionParts = $version.ver.Split(".") @@ -77,7 +77,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + elseif ($version.type -eq "rc") { if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -87,7 +87,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -like "nightly*") { + elseif ($version.type -eq "nightly") { if ("nightly" -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } diff --git a/extensions/applicationinsights-perfmarkmeasure-js/scripts/listAzCdnVersions.ps1 b/extensions/applicationinsights-perfmarkmeasure-js/scripts/listAzCdnVersions.ps1 index 7f58462e8..e45e0bb0a 100644 --- a/extensions/applicationinsights-perfmarkmeasure-js/scripts/listAzCdnVersions.ps1 +++ b/extensions/applicationinsights-perfmarkmeasure-js/scripts/listAzCdnVersions.ps1 @@ -49,8 +49,8 @@ Function Write-LogParams Function Validate-Params { # Validate parameters - if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "beta","next","public", "dev", "nightly" -NotContains $container) { - Write-LogFailure "[$($container)] is not a valid value, must be beta, next or public" + if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "next","public", "dev", "nightly" -NotContains $container) { + Write-LogFailure "[$($container)] is not a valid value, must be next, public, dev or nightly" } } @@ -94,7 +94,6 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec # Get the public files (scripts/b) if ([string]::IsNullOrWhiteSpace($container) -eq $true) { Get-AllVersionFiles $files "scripts/b" - Get-AllVersionFiles $files "beta" Get-AllVersionFiles $files "next" Get-AllVersionFiles $files "dev" Get-AllVersionFiles $files "nightly" @@ -103,7 +102,7 @@ if ([string]::IsNullOrWhiteSpace($container) -eq $true) { if ([string]::IsNullOrWhiteSpace($container) -ne $true) { if ($container -eq "public") { Get-AllVersionFiles $files "scripts/b" - } elseif ($container -eq "beta" -or $container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { + } elseif ($container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { Get-AllVersionFiles $files "$container" } else { $global:connectDetails.testOnly = $true diff --git a/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1 b/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1 index 4d3a5bc76..889564d18 100644 --- a/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1 +++ b/extensions/applicationinsights-perfmarkmeasure-js/scripts/publishAzReleaseToCdn.ps1 @@ -100,6 +100,12 @@ $contentType = "text/javascript; charset=utf-8"; Write-LogParams +$version = GetPackageVersion $jsSdkDir +if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" + exit 2 +} + # You will need to at least have the Az modules installed InstallRequiredModules $global:connectDetails = ParseCdnStorePath $global:connectDetails @@ -113,8 +119,6 @@ if ([string]::IsNullOrWhiteSpace($global:connectDetails.sasToken) -eq $true) { Write-Log "======================================================================" -$version = GetPackageVersion $jsSdkDir - $releaseFiles = GetReleaseFiles $version # Get the versioned files only if ($null -eq $releaseFiles -or $releaseFiles.Count -eq 0) { Write-LogFailure "Unable to find any release files" @@ -129,14 +133,14 @@ if ($version.type -eq "release") { PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "scripts/b/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc" -or $version.type -eq "beta") { +elseif ($version.type -eq "rc") { PublishFiles $releaseFiles "next/ext" $cacheControl1Year $contentType $overwrite } elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)/ext" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -like "nightly*") { +elseif ($version.type -eq "nightly") { # Publish to release nightly folder folder PublishFiles $releaseFiles "nightly/ext" $cacheControl1Year $contentType $overwrite } diff --git a/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1 b/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1 index 8ed65d24b..a85e91aa7 100644 --- a/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1 +++ b/extensions/applicationinsights-perfmarkmeasure-js/scripts/setAzActiveCdnVersion.ps1 @@ -54,8 +54,8 @@ Function Validate-Params $version = Get-VersionDetails $activeVersion - if ([string]::IsNullOrWhiteSpace($version.type) -eq $true) { - Write-LogFailure "Unknown release type" + if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" } $versionParts = $version.ver.Split(".") @@ -77,7 +77,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + elseif ($version.type -eq "rc") { if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -87,7 +87,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -like "nightly*") { + elseif ($version.type -eq "nightly") { if ("nightly" -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } diff --git a/tools/chrome-debug-extension/scripts/listAzCdnVersions.ps1 b/tools/chrome-debug-extension/scripts/listAzCdnVersions.ps1 index a431d03c0..48fdef81c 100644 --- a/tools/chrome-debug-extension/scripts/listAzCdnVersions.ps1 +++ b/tools/chrome-debug-extension/scripts/listAzCdnVersions.ps1 @@ -49,8 +49,8 @@ Function Write-LogParams Function Validate-Params { # Validate parameters - if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "beta","next","public", "dev", "nightly" -NotContains $container) { - Write-LogFailure "[$($container)] is not a valid value, must be beta, next or public" + if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "next","public", "dev", "nightly" -NotContains $container) { + Write-LogFailure "[$($container)] is not a valid value, must be next, public, dev or nightly" } } @@ -94,7 +94,6 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec # Get the public files (scripts/b) if ([string]::IsNullOrWhiteSpace($container) -eq $true) { Get-AllVersionFiles $files "release/tools" - Get-AllVersionFiles $files "beta/tools" Get-AllVersionFiles $files "next/tools" Get-AllVersionFiles $files "dev/tools" Get-AllVersionFiles $files "nightly/tools" @@ -103,7 +102,7 @@ if ([string]::IsNullOrWhiteSpace($container) -eq $true) { if ([string]::IsNullOrWhiteSpace($container) -ne $true) { if ($container -eq "public") { Get-AllVersionFiles $files "release/tools" - } elseif ($container -eq "beta" -or $container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { + } elseif ($container -eq "next" -or $container -eq "dev" -or $container -eq "nightly") { Get-AllVersionFiles $files "$container/tools" } else { $global:connectDetails.testOnly = $true diff --git a/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 b/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 index 3e81571f6..9ee9cc2e8 100644 --- a/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 +++ b/tools/chrome-debug-extension/scripts/publishAzReleaseToCdn.ps1 @@ -89,6 +89,12 @@ $contentType = "application/zip"; Write-LogParams +$version = GetPackageVersion $jsSdkDir +if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" + exit 2 +} + # You will need to at least have the Az modules installed InstallRequiredModules $global:connectDetails = ParseCdnStorePath $global:connectDetails @@ -102,8 +108,6 @@ if ([string]::IsNullOrWhiteSpace($global:connectDetails.sasToken) -eq $true) { Write-Log "======================================================================" -$version = GetPackageVersion $jsSdkDir - $releaseFiles = GetReleaseFiles $version # Get the versioned files only if ($null -eq $releaseFiles -or $releaseFiles.Count -eq 0) { Write-LogFailure "Unable to find any release files" @@ -118,14 +122,14 @@ if ($version.type -eq "release") { PublishFiles $releaseFiles "next/tools" $cacheControl1Year $contentType $overwrite PublishFiles $releaseFiles "release/tools" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "rc" -or $version.type -eq "beta") { +elseif ($version.type -eq "rc") { PublishFiles $releaseFiles "next/tools" $cacheControl1Year $contentType $overwrite } elseif ($version.type -eq "dev") { # Publish to release type folder folder PublishFiles $releaseFiles "$($version.type)/tools" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -like "nightly*") { +elseif ($version.type -eq "nightly") { # Publish to release nightly folder folder PublishFiles $releaseFiles "nightly/tools" $cacheControl1Year $contentType $overwrite } diff --git a/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 b/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 index 09b4c3c43..6fa5da9ef 100644 --- a/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 +++ b/tools/chrome-debug-extension/scripts/setAzActiveCdnVersion.ps1 @@ -54,8 +54,8 @@ Function Validate-Params $version = Get-VersionDetails $activeVersion - if ([string]::IsNullOrWhiteSpace($version.type) -eq $true) { - Write-LogFailure "Unknown release type" + if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" } $versionParts = $version.ver.Split(".") @@ -77,7 +77,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + elseif ($version.type -eq "rc") { if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -87,7 +87,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -like "nightly*") { + elseif ($version.type -eq "nightly") { if ("nightly" -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } diff --git a/tools/config/README.md b/tools/config/README.md index 4e284116e..d49705524 100644 --- a/tools/config/README.md +++ b/tools/config/README.md @@ -12,10 +12,9 @@ V1 https://js.monitor.azure.com/next/ai.config.1.cfg.json -New releases and release candidates are published to `next`; beta prerelease versions retain their -`-beta` filenames and use `next/ai_test.config..cfg.json`. Activating a beta prerelease in -`next` updates the test configuration aliases, not the release configuration aliases. -Existing `beta` files remain available for legacy consumers and version listing, but are no longer published or activated. +New releases and release candidates are published to `next`. Dev and nightly builds retain the +`ai_test.config.*` prefix and their corresponding folders. Unsupported release types fail validation; +beta release/channel options are no longer supported. Existing CDN files remain untouched. ### Public diff --git a/tools/config/scripts/listAzCdnVersions.ps1 b/tools/config/scripts/listAzCdnVersions.ps1 index f20c9e33f..34026ff82 100644 --- a/tools/config/scripts/listAzCdnVersions.ps1 +++ b/tools/config/scripts/listAzCdnVersions.ps1 @@ -49,8 +49,8 @@ Function Write-LogParams Function Validate-Params { # Validate parameters - if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "beta","next","public", "dev", "nightly" -NotContains $container) { - Write-LogFailure "[$($container)] is not a valid value, must be beta, next or public" + if ([string]::IsNullOrWhiteSpace($container) -ne $true -and "next","public", "dev", "nightly" -NotContains $container) { + Write-LogFailure "[$($container)] is not a valid value, must be next, public, dev or nightly" } } @@ -101,7 +101,6 @@ $files = New-Object 'system.collections.generic.dictionary[string, system.collec # Get the public files (scripts/b) if ([string]::IsNullOrWhiteSpace($container) -eq $true) { Get-AllVersionFiles $files "scripts/b" - Get-AllVersionFiles $files "beta" Get-AllVersionFiles $files "next" #Get-AllVersionFiles $files "dev" Get-AllTestVersionFiles $files "dev" @@ -112,7 +111,7 @@ if ([string]::IsNullOrWhiteSpace($container) -eq $true) { if ([string]::IsNullOrWhiteSpace($container) -ne $true) { if ($container -eq "public") { Get-AllVersionFiles $files "scripts/b" - } elseif ($container -eq "beta" -or $container -eq "next") { + } elseif ($container -eq "next") { Get-AllVersionFiles $files "$container" } elseif ($container -eq "dev" -or $container -eq "nightly") { # Get-AllVersionFiles $files "$container" diff --git a/tools/config/scripts/publishAzReleaseToCdn.ps1 b/tools/config/scripts/publishAzReleaseToCdn.ps1 index e5c97b2ee..dff615b3e 100644 --- a/tools/config/scripts/publishAzReleaseToCdn.ps1 +++ b/tools/config/scripts/publishAzReleaseToCdn.ps1 @@ -113,6 +113,12 @@ $cacheControl30Min = "public, max-age=1800, immutable, no-transform"; Write-LogParams +$version = GetPackageVersion $jsSdkDir +if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" + exit 2 +} + # You will need to at least have the Az modules installed InstallRequiredModules $global:connectDetails = ParseCdnStorePath $global:connectDetails @@ -126,8 +132,6 @@ if ([string]::IsNullOrWhiteSpace($global:connectDetails.sasToken) -eq $true) { Write-Log "======================================================================" -$version = GetPackageVersion $jsSdkDir - $releaseFiles = GetReleaseFiles $version # Get the versioned files only $testFiles = GetTestFiles $version # Get the versioned files only if ($null -eq $releaseFiles -or $releaseFiles.Count -eq 0) { @@ -146,15 +150,12 @@ if ($version.type -eq "release") { elseif ($version.type -eq "rc") { PublishFiles $releaseFiles "next" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -eq "beta") { - PublishFiles $testFiles "next" $cacheControl1Year $contentType $overwrite -} elseif ($version.type -eq "dev") { # Publish to release type folder folder # PublishFiles $releaseFiles "$($version.type)" $cacheControl1Year $contentType $overwrite PublishFiles $testFiles "$($version.type)" $cacheControl1Year $contentType $overwrite } -elseif ($version.type -like "nightly*") { +elseif ($version.type -eq "nightly") { # Publish to release nightly folder folder # PublishFiles $releaseFiles "nightly" $cacheControl1Year $contentType $overwrite PublishFiles $testFiles "nightly" $cacheControl1Year $contentType $overwrite diff --git a/tools/config/scripts/setAzActiveCdnVersion.ps1 b/tools/config/scripts/setAzActiveCdnVersion.ps1 index 796106d51..319738274 100644 --- a/tools/config/scripts/setAzActiveCdnVersion.ps1 +++ b/tools/config/scripts/setAzActiveCdnVersion.ps1 @@ -54,8 +54,8 @@ Function Validate-Params $version = Get-VersionDetails $activeVersion - if ([string]::IsNullOrWhiteSpace($version.type) -eq $true) { - Write-LogFailure "Unknown release type" + if ("release","rc","dev","nightly","alpha" -NotContains $version.type) { + Write-LogFailure "Version type [$($version.type)] is not supported" } $versionParts = $version.ver.Split(".") @@ -77,7 +77,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -eq "rc" -or $version.type -eq "beta") { + elseif ($version.type -eq "rc") { if ($container -ne "next") { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -87,7 +87,7 @@ Function Validate-Params Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } } - elseif ($version.type -like "nightly*") { + elseif ($version.type -eq "nightly") { if ("nightly" -ne $container) { Write-LogFailure "Container [$container] is not valid for version type [$($version.type)]" } @@ -148,7 +148,7 @@ if ($container -eq "public") { Get-VersionFiles $files $storePath "ai.config." $activeVersion Get-VersionFiles $testFiles $storePath "ai_test.config." $activeVersion -if ($container -eq "dev" -or $container -eq "nightly" -or $version.type -eq "beta") { +if ($container -eq "dev" -or $container -eq "nightly") { if ($testFiles.ContainsKey($activeVersion) -ne $true) { Write-LogFailure "Test Version [$activeVersion] does not appear to be deployed to [$container]" } @@ -163,7 +163,7 @@ if (Get-HasErrors -eq $true) { exit 2 } -if ($container -eq "dev" -or $container -eq "nightly" -or $version.type -eq "beta") { +if ($container -eq "dev" -or $container -eq "nightly") { SetActiveVersion $testFiles[$activeVersion] $storePath $minorOnly } else { SetActiveVersion $files[$activeVersion] $storePath $minorOnly diff --git a/tools/release-tools/README.md b/tools/release-tools/README.md index 2d074198f..3e7de537d 100644 --- a/tools/release-tools/README.md +++ b/tools/release-tools/README.md @@ -2,7 +2,7 @@ 1DS JavaScript Release tools. -This script is used internally to both prepare a release and to automatically generate beta/nightly builds. +This script is used internally to both prepare a release and to automatically generate dev/nightly builds. ## setVersion.js @@ -22,7 +22,7 @@ There are a couple of usages for this script - ```npm run setVersion 3.2.0``` Sets the version explicitly as 3.2.0 (for ALL components), only use this if all components are on the same version. - ```npm run setVersion -- -patch``` Increments version to the next patch version number x.y.[z+1] (eg. ```3.1.2``` => ```3.1.3```) This will increment the patch level based on the components current version and not the root package.json version. - ```npm run setVersion -- -minor``` Increments the version to the next minor version number x.[y+1].0 (eg. ```3.1.2``` => ```3.2.0```) -- During the build pipeline, this script will be called from with the dev-ops pipeline so that we can create an automated pipeline for generating alpha/beta/dev/nightly/release builds, with or without the current build number. This will be used to generate official "Beta" release generation job. +- During the build pipeline, this script is called to generate alpha/dev/nightly/release-candidate/release builds, with or without the current build number. - Note: At this stage the version number will NOT be checked back into the repo ### Example Usages @@ -32,7 +32,7 @@ Not all combinations are show, you can combine several options. General help displayed when the passed arguments appear to be incorrect. ``` -setVersion.js [|-patch|-minor|-major] [-dev|-alpha|-beta|-release] [-bld ######] [-test] +setVersion.js [|-patch|-minor|-major] [-dev|-alpha|-release] [-bld ######] [-test] -------------------------- - Identifies the version to set for all packages, must start with x.y.z -patch - Increment the current version to the next patch number (x.y.z => x.y.[z+1] @@ -40,10 +40,9 @@ setVersion.js [|-patch|-minor|-major] [-dev|-alpha|-beta|-release] [ -major - Increment the current version to the next major number (x.y.z => [x+1].0.0 -dev - Add the 'dev' pre-release to the number (x.y.z => x.y.z-dev) -alpha - Add the 'alpha' pre-release to the number (x.y.z => x.y.z-alpha) - -beta - Add the 'beta' pre-release to the number (x.y.z => x.y.z-beta) -release - Remove any existing pre-release tags (x.y.z-prerel => x.y.z) -bld ###### - Append the provided build number to the version (x.y.z => x.y.z-[prerel].######) [prerel] defaults to dev if not defined - -pre ###### - Set the pre-release to the provided value (x.y.z => x.y.z-[prerel]) + -pre type - Set a supported pre-release type (rc, dev, nightly or alpha) -react - Update only the react packages (Require as the react components need to update after the core because of the different versions of TypeScript being used.) -test - Scan all of the package.json files and log the changes, but DON'T update the files ``` @@ -90,11 +89,15 @@ Running this removes any current pre-release tag. #### Set as a specific pre-release +Supported release types are `release`, `rc`, `dev`, `nightly` and `alpha`. +Version generation, npm packaging, publishing and latest-tag promotion reject unsupported types, including obsolete beta and nightly-beta artifacts. +Run `node tools/release-tools/ReleaseTypes.tests.js` for offline release-tool regression tests. + ```npm run setVersion -- -pre nightly``` (eg. ```3.1.2``` => ```3.1.2-nightly```) #### Add a build number to the release (implied pre-release) -> Using this switch implies that the resulting version WILL be a pre-release complete with a <pre-release> tag. And when no <pre-release> is specified (dev/alpha/beta/etc) ```dev``` will be assumed and added. +> Using this switch implies that the resulting version WILL be a pre-release complete with a <pre-release> tag. And when no <pre-release> is specified (dev/alpha/rc/nightly) ```dev``` will be assumed and added. > > And when also used with the release switch the <pre-release> tag will default to ```rc``` @@ -107,4 +110,3 @@ Build numbers are added using the "." prefix as based on the [semver](https://se ```npm run setVersion -- -bld 20210525.1 -pre nightly``` (eg. ```3.1.2 => 3.1.2-nightly.20210525.1```) ```npm run setVersion -- -bld 20210525.1 -release``` (eg. ```3.1.2 => 3.1.2-rc.20210525.1```) - diff --git a/tools/release-tools/ReleaseTypes.tests.js b/tools/release-tools/ReleaseTypes.tests.js new file mode 100644 index 000000000..1a5b56365 --- /dev/null +++ b/tools/release-tools/ReleaseTypes.tests.js @@ -0,0 +1,141 @@ +const assert = require("assert"); +const fs = require("fs"); +const path = require("path"); +const vm = require("vm"); + +const root = path.resolve(__dirname, "..", ".."); +const setVersionSource = fs.readFileSync(path.join(__dirname, "setVersion.js"), "utf8"); +const publishSource = fs.readFileSync(path.join(__dirname, "npm_publish.js"), "utf8"); +const packageSource = fs.readFileSync(path.join(__dirname, "npm_package.js"), "utf8"); +const latestSource = fs.readFileSync(path.join(__dirname, "npm_set_latest.js"), "utf8"); +const releaseTypes = require("./releaseTypes"); + +function testVersionArgs(args, valid) { + const messages = []; + const context = { + console: { + log: function(message) { messages.push(message); }, + warn: function(message) { messages.push(message); }, + error: function(message) { messages.push(message); } + }, + process: { + argv: ["node", "setVersion.js"].concat(args, ["-test"]), + cwd: function() { return root; }, + exitCode: 0 + }, + require: function(name) { + if (name === "fs") { + return { + existsSync: fs.existsSync, + writeFileSync: function() { throw new Error("Dry-run attempted a filesystem write"); } + }; + } + if (name === "globby") { + return { sync: function() { return []; } }; + } + if (name === "./releaseTypes") { + return releaseTypes; + } + return JSON.parse(fs.readFileSync(name, "utf8")); + } + }; + let error; + try { + vm.runInNewContext(setVersionSource, context); + } catch (caught) { + error = caught; + } + if (valid) { + assert.ifError(error); + assert.strictEqual(context.process.exitCode, 0, args.join(" ")); + assert.ok(messages.some(function(message) { return /^New version /.test(message); }), "Expected version generation"); + } else { + assert.ok(error || context.process.exitCode !== 0, "Accepted unsupported version arguments: " + args.join(" ")); + assert.ok(!messages.some(function(message) { return /^New version /.test(message); }), "Unsupported version generation must stop"); + } +} + +function testNpmReleaseTool(source, version, valid) { + const commands = []; + const packaging = source === packageSource; + const context = { + console: { log: function() {}, error: function() {} }, + process: { + argv: ["node", "release-tool.js", "sdk"].concat(packaging ? ["-test"] : []), + exit: function(code) { throw new Error("Exit " + code); }, + cwd: function() { return root; }, + chdir: function() {} + }, + require: function(name) { + if (name === "fs") { + return { + existsSync: function(file) { return !packaging || !file.endsWith(".tgz"); }, + readFileSync: function(file) { + if (file === "./tools/release-tools/package_groups.json") { + return JSON.stringify({ sdk: ["AISKU"] }); + } + return JSON.stringify({ name: "@microsoft/applicationinsights-web", version: version }); + } + }; + } + if (name === "child_process") { + return { execSync: function(command) { commands.push(command); } }; + } + if (name === "./releaseTypes") { + return releaseTypes; + } + throw new Error("Unexpected dependency " + name); + } + }; + let error; + try { + vm.runInNewContext(source, context); + } catch (caught) { + error = caught; + } + if (valid) { + assert.ifError(error); + assert.strictEqual(commands.length, 1, version); + if (!packaging) { + assert.ok(commands[0].includes(version), "Package version changed"); + } + } else { + assert.ok(error && /Unsupported release version/.test(error.message), version); + assert.strictEqual(commands.length, 0, "Unsupported versions must never invoke npm"); + } +} + +[ + ["-beta"], + ["-pre", "beta"], + ["-pre", "nightlybeta"], + ["3.4.6-beta.1"], + ["3.4.6-beta.2+build7"], + ["3.4.6-nightlybeta.1"], + ["3.4.6-custom.1"] +].forEach(function(args) { testVersionArgs(args, false); }); + +[ + ["-release"], + ["-next", "-release"], + ["-next", "-pre", "rc"], + ["-dev"], + ["-alpha"], + ["-pre", "nightly"], + ["3.4.6"], + ["3.4.6-rc.1"], + ["3.4.6-dev.1"], + ["3.4.6-nightly.1"], + ["3.4.6-alpha.1"] +].forEach(function(args) { testVersionArgs(args, true); }); + +[packageSource, publishSource, latestSource].forEach(function(source) { + ["3.4.6", "3.4.6-rc.1", "3.4.6-dev.1", "3.4.6-nightly.1", "3.4.6-alpha.1"].forEach(function(version) { + testNpmReleaseTool(source, version, true); + }); + ["3.4.6-beta.1", "3.4.6-beta.2+build7", "3.4.6-nightlybeta.1", "3.4.6-custom.1"].forEach(function(version) { + testNpmReleaseTool(source, version, false); + }); +}); + +console.log("PASS: supported release generation, npm packaging, publishing and latest-tag promotion; unsupported versions rejected"); diff --git a/tools/release-tools/npm_package.js b/tools/release-tools/npm_package.js index 3b659ae61..b3a56f475 100644 --- a/tools/release-tools/npm_package.js +++ b/tools/release-tools/npm_package.js @@ -1,5 +1,6 @@ const fs = require("fs"); const child_process = require("child_process"); +const { validateReleaseVersion } = require("./releaseTypes"); const packageGroupDef = "./tools/release-tools/package_groups.json"; let packageGroup; @@ -79,6 +80,7 @@ function getPackage(packageJsonFile) { function getNpmPackageName(packageJson) { let packageName = packageJson.name; let packageVersion = packageJson.version; + validateReleaseVersion(packageVersion); let theNpmPackageName = packageName + "-" + packageVersion; diff --git a/tools/release-tools/npm_publish.js b/tools/release-tools/npm_publish.js index cdcd1d60d..5bd255105 100644 --- a/tools/release-tools/npm_publish.js +++ b/tools/release-tools/npm_publish.js @@ -1,5 +1,6 @@ const fs = require("fs"); const child_process = require("child_process"); +const { validateReleaseVersion } = require("./releaseTypes"); const packageGroupDef = "./tools/release-tools/package_groups.json"; let packageGroup; @@ -71,6 +72,7 @@ function getNpmPackageName(packageJsonFile) { let packageJson = JSON.parse(packageText); let packageName = packageJson.name; let packageVersion = packageJson.version; + validateReleaseVersion(packageVersion); let theNpmPackageName = packageName + "-" + packageVersion; diff --git a/tools/release-tools/npm_set_latest.js b/tools/release-tools/npm_set_latest.js index 2ddbca944..de37e72d7 100644 --- a/tools/release-tools/npm_set_latest.js +++ b/tools/release-tools/npm_set_latest.js @@ -1,5 +1,6 @@ const fs = require("fs"); const child_process = require("child_process"); +const { validateReleaseVersion } = require("./releaseTypes"); const packageGroupDef = "./tools/release-tools/package_groups.json"; let packageGroup; @@ -90,6 +91,7 @@ if (parseArgs()) { } let packageJson = getPackageJson(packageJsonFile); + validateReleaseVersion(packageJson.version); console.log("\n\n##################################################################"); console.log("Setting latest tag - " + packageJson.name); diff --git a/tools/release-tools/releaseTypes.js b/tools/release-tools/releaseTypes.js new file mode 100644 index 000000000..3046b3110 --- /dev/null +++ b/tools/release-tools/releaseTypes.js @@ -0,0 +1,17 @@ +const supportedReleaseTypes = ["release", "rc", "dev", "nightly", "alpha"]; + +function isSupportedReleaseType(type) { + return supportedReleaseTypes.indexOf(type) !== -1; +} + +function validateReleaseVersion(version) { + const preRelease = version.split("+", 2)[0].split("-", 2)[1]; + const type = preRelease ? preRelease.split(".")[0].split("-")[0] : "release"; + if (!isSupportedReleaseType(type)) { + throw new Error("Unsupported release version [" + version + "]"); + } + + return type; +} + +module.exports = { isSupportedReleaseType, validateReleaseVersion }; diff --git a/tools/release-tools/setVersion.js b/tools/release-tools/setVersion.js index c750c1479..71ff32aab 100644 --- a/tools/release-tools/setVersion.js +++ b/tools/release-tools/setVersion.js @@ -1,5 +1,6 @@ const fs = require("fs"); const globby = require("globby"); +const { isSupportedReleaseType, validateReleaseVersion } = require("./releaseTypes"); let newVer = null; let autoInc = null; @@ -25,7 +26,7 @@ function showHelp() { } console.log(""); - console.log(scriptName + " [|-patch|-minor|-major|-next] [-dev|-alpha|-beta|-release] [-bld ######] [-test]"); + console.log(scriptName + " [|-patch|-minor|-major|-next] [-dev|-alpha|-release] [-bld ######] [-test]"); console.log("--------------------------"); console.log(" - Identifies the version to set for all packages, must start with x.y.z"); console.log(" -patch - Increment the current version to the next patch number (x.y.z => x.y.[z+1]"); @@ -34,10 +35,9 @@ function showHelp() { console.log(" -next - Increment the current version to the next value (patch, minor or major) based on the 'next' value in version.json"); console.log(" -dev - Add the 'dev' pre-release to the number (x.y.z => x.y.z-dev)"); console.log(" -alpha - Add the 'alpha' pre-release to the number (x.y.z => x.y.z-alpha)"); - console.log(" -beta - Add the 'beta' pre-release to the number (x.y.z => x.y.z-beta)"); console.log(" -release - Remove any existing pre-release tags (x.y.z-prerel => x.y.z)"); console.log(" -bld ###### - Append the provided build number to the version (x.y.z => x.y.z-[prerel].######) [prerel] defaults to dev if not defined"); - console.log(" -pre ###### - Set the pre-release to the provided value (x.y.z => x.y.z-[prerel])"); + console.log(" -pre type - Set a supported pre-release type (rc, dev, nightly or alpha)"); console.log(" -1ds - Update only the oneDs packages"); console.log(" -test - Scan all of the package.json files and log the changes, but DON'T update the files"); } @@ -48,6 +48,11 @@ function setPreRelVer(name) { return false; } + if (name && !isSupportedReleaseType(getVersionDetails("0.0.0-" + name).type)) { + console.error("Unsupported pre-release value -- [" + name + "]"); + return false; + } + preRel = name; let defaultVer = theVersion[name]; if (defaultVer) { @@ -100,13 +105,6 @@ function parseArgs() { } else if (!setPreRelVer("alpha")) { return false; } - } else if (!isRelease && !preRel && theArg === "-beta") { - preRel = "beta"; - if (!autoInc && !newVer) { - autoInc = "next"; - } else if (!setPreRelVer("beta")) { - return false; - } } else if (!isRelease && !preRel && theArg === "-release") { isRelease = true; preRel = ""; @@ -278,7 +276,10 @@ function calculateVersion(rootVersion, pkgAutoInc) { } } - return newVersion + (postfix || "") + (buildNum || ""); + let result = newVersion + (postfix || "") + (buildNum || ""); + validateReleaseVersion(result); + + return result; } function getVersionDetails(theVersion) { @@ -406,7 +407,7 @@ function updatePublishConfig(package, newVersion) { } // Set the publishing tag - if (details.type === "nightly" || details.type === "nightlybeta" || details.type === "dev" || details.type === "beta" || details.type === "alpha") { + if (details.type === "nightly" || details.type === "dev" || details.type === "alpha") { console.log(` Type - [${details.type}] - ${majorVersion}`); package.publishConfig.tag = details.type + (majorVersion !== "0" ? majorVersion : ""); } else { @@ -552,4 +553,5 @@ if (parseArgs()) { } } else { showHelp(); + process.exitCode = 1; } From 81eda6f152d3fafc6564eb19c9915a3155d5e434 Mon Sep 17 00:00:00 2001 From: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:24:54 -0800 Subject: [PATCH 3/5] Restore unrelated beta branch CI triggers Restore the pre-cleanup beta Git-branch filters for CI and CodeQL while retaining CDN migration, release-type retirement, and the added regression CI steps. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/ci.yml | 6 +++--- .github/workflows/codeql-analysis.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7dbd8bde..51c9855b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,11 +8,11 @@ permissions: on: push: - branches: [ main, master, Release2.7, release-3.0 ] + branches: [ main, master, beta, Release2.7, release-3.0 ] pull_request: - branches: [ main, master, Release2.7, release-3.0 ] + branches: [ main, master, beta, Release2.7, release-3.0 ] merge_group: - branches: [ "main", "master", "Release*", "release*", "*-legacy", "legacy-v1" ] + branches: [ "main", "master", "beta", "Release*", "release*", "*-legacy", "legacy-v1" ] jobs: build: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 811e60ffd..1e43fb37e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [ "main", "master", "Release*", "release*", "*-legacy", "legacy-v1" ] + branches: [ "main", "master", "beta", "Release*", "release*", "*-legacy", "legacy-v1" ] pull_request: # The branches below must be a subset of the branches above - branches: [ "main", "master", "Release*", "release*", "*-legacy", "legacy-v1" ] + branches: [ "main", "master", "beta", "Release*", "release*", "*-legacy", "legacy-v1" ] schedule: - cron: '15 17 * * 2' # Every Tuesday at 17:15 UTC From 8e092574d3fefc9dede698512a96798179020c91 Mon Sep 17 00:00:00 2001 From: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:29:01 -0800 Subject: [PATCH 4/5] Keep beta-to-next migration scoped to CDN changes Restore npm prerelease tags, version generation and unrelated release guidance while retaining CDN routing and its regression coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/copilot-instructions.md | 4 +- .github/workflows/ci.yml | 2 - README.md | 2 +- tools/release-tools/README.md | 16 ++- tools/release-tools/ReleaseTypes.tests.js | 141 ---------------------- tools/release-tools/npm_package.js | 2 - tools/release-tools/npm_publish.js | 2 - tools/release-tools/npm_set_latest.js | 2 - tools/release-tools/releaseTypes.js | 17 --- tools/release-tools/setVersion.js | 26 ++-- 10 files changed, 22 insertions(+), 192 deletions(-) delete mode 100644 tools/release-tools/ReleaseTypes.tests.js delete mode 100644 tools/release-tools/releaseTypes.js diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 5071b5d17..0c4216a43 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -425,9 +425,9 @@ npm run setVersion -- 3.4.0 # Set an explicit version # Pre-release variants: npm run setVersion -- -next -dev # Increment + dev pre-release tag (x.y.z-dev) -npm run setVersion -- -next -pre rc # Increment + release candidate tag (x.y.z-rc) +npm run setVersion -- -next -beta # Increment + beta pre-release tag (x.y.z-beta) npm run setVersion -- -next -alpha # Increment + alpha pre-release tag (x.y.z-alpha) -npm run setVersion -- -release # Strip pre-release tag from current version (x.y.z-rc => x.y.z) +npm run setVersion -- -release # Strip pre-release tag from current version (x.y.z-beta => x.y.z) # Dry run (logs changes without modifying files): npm run setVersion -- -next -test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51c9855b7..935380868 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,8 +41,6 @@ jobs: with: node-version: ${{ matrix.node-version }} check-latest: true - - name: Test release type validation - run: node tools/release-tools/ReleaseTypes.tests.js - name: Update rush shrinkwrap dependencies (for different node versions) run: node common/scripts/install-run-rush.js update --full --recheck - run: npm install rollup -g diff --git a/README.md b/README.md index 968468235..b06d20b16 100644 --- a/README.md +++ b/README.md @@ -878,7 +878,7 @@ When a new release is deployed the following occurs as part of the release | Next | https://js.monitor.azure.com/next/ai.3.gbl.min.js | Initial promotion after the NPM release. | Public | https://js.monitor.azure.com/scripts/b/ai.3.gbl.min.js | Promoted after next validation according to the release deployment plan; the production URL is unchanged. -Beta releases and the beta CDN channel are no longer supported by release tooling. Existing CDN files remain available for legacy consumers. +The beta CDN channel is no longer supported by CDN publishing, activation or listing tools. Existing CDN files remain available for legacy consumers; npm prerelease tags and version-generation tooling are unchanged. The milestones for each release should include both the deployment plan (as it's about to be released) or the final release times as with [v2.7.2](https://github.com/microsoft/ApplicationInsights-JS/milestone/58) diff --git a/tools/release-tools/README.md b/tools/release-tools/README.md index 3e7de537d..2d074198f 100644 --- a/tools/release-tools/README.md +++ b/tools/release-tools/README.md @@ -2,7 +2,7 @@ 1DS JavaScript Release tools. -This script is used internally to both prepare a release and to automatically generate dev/nightly builds. +This script is used internally to both prepare a release and to automatically generate beta/nightly builds. ## setVersion.js @@ -22,7 +22,7 @@ There are a couple of usages for this script - ```npm run setVersion 3.2.0``` Sets the version explicitly as 3.2.0 (for ALL components), only use this if all components are on the same version. - ```npm run setVersion -- -patch``` Increments version to the next patch version number x.y.[z+1] (eg. ```3.1.2``` => ```3.1.3```) This will increment the patch level based on the components current version and not the root package.json version. - ```npm run setVersion -- -minor``` Increments the version to the next minor version number x.[y+1].0 (eg. ```3.1.2``` => ```3.2.0```) -- During the build pipeline, this script is called to generate alpha/dev/nightly/release-candidate/release builds, with or without the current build number. +- During the build pipeline, this script will be called from with the dev-ops pipeline so that we can create an automated pipeline for generating alpha/beta/dev/nightly/release builds, with or without the current build number. This will be used to generate official "Beta" release generation job. - Note: At this stage the version number will NOT be checked back into the repo ### Example Usages @@ -32,7 +32,7 @@ Not all combinations are show, you can combine several options. General help displayed when the passed arguments appear to be incorrect. ``` -setVersion.js [|-patch|-minor|-major] [-dev|-alpha|-release] [-bld ######] [-test] +setVersion.js [|-patch|-minor|-major] [-dev|-alpha|-beta|-release] [-bld ######] [-test] -------------------------- - Identifies the version to set for all packages, must start with x.y.z -patch - Increment the current version to the next patch number (x.y.z => x.y.[z+1] @@ -40,9 +40,10 @@ setVersion.js [|-patch|-minor|-major] [-dev|-alpha|-release] [-bld # -major - Increment the current version to the next major number (x.y.z => [x+1].0.0 -dev - Add the 'dev' pre-release to the number (x.y.z => x.y.z-dev) -alpha - Add the 'alpha' pre-release to the number (x.y.z => x.y.z-alpha) + -beta - Add the 'beta' pre-release to the number (x.y.z => x.y.z-beta) -release - Remove any existing pre-release tags (x.y.z-prerel => x.y.z) -bld ###### - Append the provided build number to the version (x.y.z => x.y.z-[prerel].######) [prerel] defaults to dev if not defined - -pre type - Set a supported pre-release type (rc, dev, nightly or alpha) + -pre ###### - Set the pre-release to the provided value (x.y.z => x.y.z-[prerel]) -react - Update only the react packages (Require as the react components need to update after the core because of the different versions of TypeScript being used.) -test - Scan all of the package.json files and log the changes, but DON'T update the files ``` @@ -89,15 +90,11 @@ Running this removes any current pre-release tag. #### Set as a specific pre-release -Supported release types are `release`, `rc`, `dev`, `nightly` and `alpha`. -Version generation, npm packaging, publishing and latest-tag promotion reject unsupported types, including obsolete beta and nightly-beta artifacts. -Run `node tools/release-tools/ReleaseTypes.tests.js` for offline release-tool regression tests. - ```npm run setVersion -- -pre nightly``` (eg. ```3.1.2``` => ```3.1.2-nightly```) #### Add a build number to the release (implied pre-release) -> Using this switch implies that the resulting version WILL be a pre-release complete with a <pre-release> tag. And when no <pre-release> is specified (dev/alpha/rc/nightly) ```dev``` will be assumed and added. +> Using this switch implies that the resulting version WILL be a pre-release complete with a <pre-release> tag. And when no <pre-release> is specified (dev/alpha/beta/etc) ```dev``` will be assumed and added. > > And when also used with the release switch the <pre-release> tag will default to ```rc``` @@ -110,3 +107,4 @@ Build numbers are added using the "." prefix as based on the [semver](https://se ```npm run setVersion -- -bld 20210525.1 -pre nightly``` (eg. ```3.1.2 => 3.1.2-nightly.20210525.1```) ```npm run setVersion -- -bld 20210525.1 -release``` (eg. ```3.1.2 => 3.1.2-rc.20210525.1```) + diff --git a/tools/release-tools/ReleaseTypes.tests.js b/tools/release-tools/ReleaseTypes.tests.js deleted file mode 100644 index 1a5b56365..000000000 --- a/tools/release-tools/ReleaseTypes.tests.js +++ /dev/null @@ -1,141 +0,0 @@ -const assert = require("assert"); -const fs = require("fs"); -const path = require("path"); -const vm = require("vm"); - -const root = path.resolve(__dirname, "..", ".."); -const setVersionSource = fs.readFileSync(path.join(__dirname, "setVersion.js"), "utf8"); -const publishSource = fs.readFileSync(path.join(__dirname, "npm_publish.js"), "utf8"); -const packageSource = fs.readFileSync(path.join(__dirname, "npm_package.js"), "utf8"); -const latestSource = fs.readFileSync(path.join(__dirname, "npm_set_latest.js"), "utf8"); -const releaseTypes = require("./releaseTypes"); - -function testVersionArgs(args, valid) { - const messages = []; - const context = { - console: { - log: function(message) { messages.push(message); }, - warn: function(message) { messages.push(message); }, - error: function(message) { messages.push(message); } - }, - process: { - argv: ["node", "setVersion.js"].concat(args, ["-test"]), - cwd: function() { return root; }, - exitCode: 0 - }, - require: function(name) { - if (name === "fs") { - return { - existsSync: fs.existsSync, - writeFileSync: function() { throw new Error("Dry-run attempted a filesystem write"); } - }; - } - if (name === "globby") { - return { sync: function() { return []; } }; - } - if (name === "./releaseTypes") { - return releaseTypes; - } - return JSON.parse(fs.readFileSync(name, "utf8")); - } - }; - let error; - try { - vm.runInNewContext(setVersionSource, context); - } catch (caught) { - error = caught; - } - if (valid) { - assert.ifError(error); - assert.strictEqual(context.process.exitCode, 0, args.join(" ")); - assert.ok(messages.some(function(message) { return /^New version /.test(message); }), "Expected version generation"); - } else { - assert.ok(error || context.process.exitCode !== 0, "Accepted unsupported version arguments: " + args.join(" ")); - assert.ok(!messages.some(function(message) { return /^New version /.test(message); }), "Unsupported version generation must stop"); - } -} - -function testNpmReleaseTool(source, version, valid) { - const commands = []; - const packaging = source === packageSource; - const context = { - console: { log: function() {}, error: function() {} }, - process: { - argv: ["node", "release-tool.js", "sdk"].concat(packaging ? ["-test"] : []), - exit: function(code) { throw new Error("Exit " + code); }, - cwd: function() { return root; }, - chdir: function() {} - }, - require: function(name) { - if (name === "fs") { - return { - existsSync: function(file) { return !packaging || !file.endsWith(".tgz"); }, - readFileSync: function(file) { - if (file === "./tools/release-tools/package_groups.json") { - return JSON.stringify({ sdk: ["AISKU"] }); - } - return JSON.stringify({ name: "@microsoft/applicationinsights-web", version: version }); - } - }; - } - if (name === "child_process") { - return { execSync: function(command) { commands.push(command); } }; - } - if (name === "./releaseTypes") { - return releaseTypes; - } - throw new Error("Unexpected dependency " + name); - } - }; - let error; - try { - vm.runInNewContext(source, context); - } catch (caught) { - error = caught; - } - if (valid) { - assert.ifError(error); - assert.strictEqual(commands.length, 1, version); - if (!packaging) { - assert.ok(commands[0].includes(version), "Package version changed"); - } - } else { - assert.ok(error && /Unsupported release version/.test(error.message), version); - assert.strictEqual(commands.length, 0, "Unsupported versions must never invoke npm"); - } -} - -[ - ["-beta"], - ["-pre", "beta"], - ["-pre", "nightlybeta"], - ["3.4.6-beta.1"], - ["3.4.6-beta.2+build7"], - ["3.4.6-nightlybeta.1"], - ["3.4.6-custom.1"] -].forEach(function(args) { testVersionArgs(args, false); }); - -[ - ["-release"], - ["-next", "-release"], - ["-next", "-pre", "rc"], - ["-dev"], - ["-alpha"], - ["-pre", "nightly"], - ["3.4.6"], - ["3.4.6-rc.1"], - ["3.4.6-dev.1"], - ["3.4.6-nightly.1"], - ["3.4.6-alpha.1"] -].forEach(function(args) { testVersionArgs(args, true); }); - -[packageSource, publishSource, latestSource].forEach(function(source) { - ["3.4.6", "3.4.6-rc.1", "3.4.6-dev.1", "3.4.6-nightly.1", "3.4.6-alpha.1"].forEach(function(version) { - testNpmReleaseTool(source, version, true); - }); - ["3.4.6-beta.1", "3.4.6-beta.2+build7", "3.4.6-nightlybeta.1", "3.4.6-custom.1"].forEach(function(version) { - testNpmReleaseTool(source, version, false); - }); -}); - -console.log("PASS: supported release generation, npm packaging, publishing and latest-tag promotion; unsupported versions rejected"); diff --git a/tools/release-tools/npm_package.js b/tools/release-tools/npm_package.js index b3a56f475..3b659ae61 100644 --- a/tools/release-tools/npm_package.js +++ b/tools/release-tools/npm_package.js @@ -1,6 +1,5 @@ const fs = require("fs"); const child_process = require("child_process"); -const { validateReleaseVersion } = require("./releaseTypes"); const packageGroupDef = "./tools/release-tools/package_groups.json"; let packageGroup; @@ -80,7 +79,6 @@ function getPackage(packageJsonFile) { function getNpmPackageName(packageJson) { let packageName = packageJson.name; let packageVersion = packageJson.version; - validateReleaseVersion(packageVersion); let theNpmPackageName = packageName + "-" + packageVersion; diff --git a/tools/release-tools/npm_publish.js b/tools/release-tools/npm_publish.js index 5bd255105..cdcd1d60d 100644 --- a/tools/release-tools/npm_publish.js +++ b/tools/release-tools/npm_publish.js @@ -1,6 +1,5 @@ const fs = require("fs"); const child_process = require("child_process"); -const { validateReleaseVersion } = require("./releaseTypes"); const packageGroupDef = "./tools/release-tools/package_groups.json"; let packageGroup; @@ -72,7 +71,6 @@ function getNpmPackageName(packageJsonFile) { let packageJson = JSON.parse(packageText); let packageName = packageJson.name; let packageVersion = packageJson.version; - validateReleaseVersion(packageVersion); let theNpmPackageName = packageName + "-" + packageVersion; diff --git a/tools/release-tools/npm_set_latest.js b/tools/release-tools/npm_set_latest.js index de37e72d7..2ddbca944 100644 --- a/tools/release-tools/npm_set_latest.js +++ b/tools/release-tools/npm_set_latest.js @@ -1,6 +1,5 @@ const fs = require("fs"); const child_process = require("child_process"); -const { validateReleaseVersion } = require("./releaseTypes"); const packageGroupDef = "./tools/release-tools/package_groups.json"; let packageGroup; @@ -91,7 +90,6 @@ if (parseArgs()) { } let packageJson = getPackageJson(packageJsonFile); - validateReleaseVersion(packageJson.version); console.log("\n\n##################################################################"); console.log("Setting latest tag - " + packageJson.name); diff --git a/tools/release-tools/releaseTypes.js b/tools/release-tools/releaseTypes.js deleted file mode 100644 index 3046b3110..000000000 --- a/tools/release-tools/releaseTypes.js +++ /dev/null @@ -1,17 +0,0 @@ -const supportedReleaseTypes = ["release", "rc", "dev", "nightly", "alpha"]; - -function isSupportedReleaseType(type) { - return supportedReleaseTypes.indexOf(type) !== -1; -} - -function validateReleaseVersion(version) { - const preRelease = version.split("+", 2)[0].split("-", 2)[1]; - const type = preRelease ? preRelease.split(".")[0].split("-")[0] : "release"; - if (!isSupportedReleaseType(type)) { - throw new Error("Unsupported release version [" + version + "]"); - } - - return type; -} - -module.exports = { isSupportedReleaseType, validateReleaseVersion }; diff --git a/tools/release-tools/setVersion.js b/tools/release-tools/setVersion.js index 71ff32aab..c750c1479 100644 --- a/tools/release-tools/setVersion.js +++ b/tools/release-tools/setVersion.js @@ -1,6 +1,5 @@ const fs = require("fs"); const globby = require("globby"); -const { isSupportedReleaseType, validateReleaseVersion } = require("./releaseTypes"); let newVer = null; let autoInc = null; @@ -26,7 +25,7 @@ function showHelp() { } console.log(""); - console.log(scriptName + " [|-patch|-minor|-major|-next] [-dev|-alpha|-release] [-bld ######] [-test]"); + console.log(scriptName + " [|-patch|-minor|-major|-next] [-dev|-alpha|-beta|-release] [-bld ######] [-test]"); console.log("--------------------------"); console.log(" - Identifies the version to set for all packages, must start with x.y.z"); console.log(" -patch - Increment the current version to the next patch number (x.y.z => x.y.[z+1]"); @@ -35,9 +34,10 @@ function showHelp() { console.log(" -next - Increment the current version to the next value (patch, minor or major) based on the 'next' value in version.json"); console.log(" -dev - Add the 'dev' pre-release to the number (x.y.z => x.y.z-dev)"); console.log(" -alpha - Add the 'alpha' pre-release to the number (x.y.z => x.y.z-alpha)"); + console.log(" -beta - Add the 'beta' pre-release to the number (x.y.z => x.y.z-beta)"); console.log(" -release - Remove any existing pre-release tags (x.y.z-prerel => x.y.z)"); console.log(" -bld ###### - Append the provided build number to the version (x.y.z => x.y.z-[prerel].######) [prerel] defaults to dev if not defined"); - console.log(" -pre type - Set a supported pre-release type (rc, dev, nightly or alpha)"); + console.log(" -pre ###### - Set the pre-release to the provided value (x.y.z => x.y.z-[prerel])"); console.log(" -1ds - Update only the oneDs packages"); console.log(" -test - Scan all of the package.json files and log the changes, but DON'T update the files"); } @@ -48,11 +48,6 @@ function setPreRelVer(name) { return false; } - if (name && !isSupportedReleaseType(getVersionDetails("0.0.0-" + name).type)) { - console.error("Unsupported pre-release value -- [" + name + "]"); - return false; - } - preRel = name; let defaultVer = theVersion[name]; if (defaultVer) { @@ -105,6 +100,13 @@ function parseArgs() { } else if (!setPreRelVer("alpha")) { return false; } + } else if (!isRelease && !preRel && theArg === "-beta") { + preRel = "beta"; + if (!autoInc && !newVer) { + autoInc = "next"; + } else if (!setPreRelVer("beta")) { + return false; + } } else if (!isRelease && !preRel && theArg === "-release") { isRelease = true; preRel = ""; @@ -276,10 +278,7 @@ function calculateVersion(rootVersion, pkgAutoInc) { } } - let result = newVersion + (postfix || "") + (buildNum || ""); - validateReleaseVersion(result); - - return result; + return newVersion + (postfix || "") + (buildNum || ""); } function getVersionDetails(theVersion) { @@ -407,7 +406,7 @@ function updatePublishConfig(package, newVersion) { } // Set the publishing tag - if (details.type === "nightly" || details.type === "dev" || details.type === "alpha") { + if (details.type === "nightly" || details.type === "nightlybeta" || details.type === "dev" || details.type === "beta" || details.type === "alpha") { console.log(` Type - [${details.type}] - ${majorVersion}`); package.publishConfig.tag = details.type + (majorVersion !== "0" ? majorVersion : ""); } else { @@ -553,5 +552,4 @@ if (parseArgs()) { } } else { showHelp(); - process.exitCode = 1; } From a7bb5a1470e9e67314efaae7bac22ae5aa038262 Mon Sep 17 00:00:00 2001 From: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:30:03 -0800 Subject: [PATCH 5/5] Document CDN preview channel migration in unreleased changes Describe next-only preview publishing and retired beta CDN options without changing npm versions or tags. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- RELEASES.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index 5080accd3..762ad0995 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4,6 +4,14 @@ ## Unreleased Changes +### Significant Changes + +- CDN preview deployment now uses `next` instead of `beta` across the SDK, extensions, tools, and configuration. + Stable release artifacts publish to `next` and their existing production destinations; release candidates publish only to `next`. + Beta CDN publishing, activation, and listing options are removed, while existing CDN artifacts and production URLs remain unchanged. + Dev/nightly folders, alpha test-storage isolation, npm prerelease tags, and version-generation tooling are unchanged. + The SDK CDN monitor now checks `next`. + ### Bug Fixes - Automatic payload compression is now limited to recognized Microsoft Application Insights ingestion endpoints. Custom endpoints and