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..4e582e82c 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 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. + +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. + +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 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, 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. | 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 @@ -196,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 4367b754a..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" @@ -127,19 +131,17 @@ 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 "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 97472c382..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(".") @@ -73,21 +73,21 @@ 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) { + 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)]" } } - 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)]" } @@ -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..b06d20b16 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 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 |----------|-------------|-------- -| 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 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) -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/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 diff --git a/common/publish/Tests/CdnPublishing.tests.ps1 b/common/publish/Tests/CdnPublishing.tests.ps1 new file mode 100644 index 000000000..8f5bdeb70 --- /dev/null +++ b/common/publish/Tests/CdnPublishing.tests.ps1 @@ -0,0 +1,248 @@ +$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, [bool] $valid = $true) { + $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" + } + 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 + } + + $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 "dev" -or $version.type -eq "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") + $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" +} + +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" @() $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" @() $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-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 + 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 + Test-Activation $package "3.4.5-nightlybeta.1" "nightly" $false + Test-Activation $package "3.4.5-custom.1" "custom" $false + + 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 +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/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 df287b003..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" @@ -126,19 +130,17 @@ 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 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 } -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 513f093a2..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(".") @@ -73,21 +73,21 @@ 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) { + 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)]" } } - 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)]" } @@ -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/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 d25ac9548..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" @@ -126,19 +130,17 @@ 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 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 } -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 a968001e0..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(".") @@ -73,21 +73,21 @@ 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) { + 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)]" } } - 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)]" } @@ -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/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 e166a7e43..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" @@ -126,19 +130,17 @@ 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 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 } -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 6a489cc64..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(".") @@ -73,21 +73,21 @@ 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) { + 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)]" } } - 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)]" } @@ -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/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 0bdc2dd93..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" @@ -115,19 +119,17 @@ 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 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 } -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 91cc80821..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(".") @@ -73,21 +73,21 @@ 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) { + 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)]" } } - 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)]" } @@ -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..d49705524 100644 --- a/tools/config/README.md +++ b/tools/config/README.md @@ -8,14 +8,14 @@ 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`. 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 https://js.monitor.azure.com/scripts/b/ai.config.1.cfg.json 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 404dcf5b2..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) { @@ -140,20 +144,18 @@ 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 "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 afdcdad40..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(".") @@ -73,21 +73,21 @@ 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) { + 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)]" } } - 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)]" } @@ -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" }