Merge branch 'main' into siyu/policy

This commit is contained in:
siyuniu-ms 2024-09-10 13:19:23 -07:00 коммит произвёл GitHub
Родитель 673c1eb5e3 5df231cc55
Коммит 474cf55869
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
5 изменённых файлов: 86 добавлений и 4 удалений

Просмотреть файл

@ -803,6 +803,13 @@ module.exports = function (grunt) {
{ src: "./tools/config/config.json", dest: `./tools/config/browser/es5/ai.config${configVer}.cfg.json` },
{ src: "./tools/config/config.json", dest: `./tools/config/browser/es5/ai.config${configMajorVer}.cfg.json` }
]
},
testConfig: {
files: [
{ src: "./tools/config/test-config.json", dest: `./tools/config/browser/es5/ai_test.config${configVer}.cfg.json` },
{ src: "./tools/config/test-config.json", dest: `./tools/config/browser/es5/ai_test.config${configMajorVer}.cfg.json` }
]
}
}
}));
@ -955,6 +962,7 @@ module.exports = function (grunt) {
grunt.registerTask("serve", ["connect:server:keepalive"]);
grunt.registerTask("copy-config", ["copy:config"]);
grunt.registerTask("copy-testConfig", ["copy:testConfig"]);
grunt.registerTask("example-aisku", tsBuildActions("example-aisku"));
grunt.registerTask("example-dependency", tsBuildActions("example-dependency"));

Просмотреть файл

@ -10,8 +10,9 @@
},
"scripts": {
"clean": "git clean -xdf",
"build": "npm run build:browser",
"build": "npm run build:browser && npm run build:test",
"build:browser": "grunt copy-config",
"build:test": "grunt copy-testConfig",
"rebuild": "npm run build",
"test": ""
},

Просмотреть файл

@ -72,6 +72,31 @@ Function GetReleaseFiles (
return $files
}
Function GetTestFiles (
[hashtable] $verDetails
)
{
$version = $verDetails.full
Write-Log "Version : $($verDetails.full)"
Write-Log " Number : $($verDetails.ver)"
Write-Log " Type : $($verDetails.type)"
Write-Log " BldNum : $($verDetails.bldNum)"
# check if the minified dir exists
$jsSdkSrcDir = Join-Path $jssdkDir -ChildPath "browser\es5\";
if (-Not (Test-Path $jsSdkSrcDir)) {
Write-LogWarning "'$jsSdkSrcDir' directory doesn't exist. Compile JSSDK first.";
exit
}
$files = New-Object 'system.collections.generic.dictionary[string,string]'
Write-Log "Adding files";
AddReleaseFile $files $jsSdkSrcDir "ai_test.config.$version.cfg.json"
return $files
}
#-----------------------------------------------------------------------------
# Start of Script
#-----------------------------------------------------------------------------
@ -104,6 +129,7 @@ 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) {
Write-LogFailure "Unable to find any release files"
}
@ -124,11 +150,13 @@ elseif ($version.type -eq "rc") {
}
elseif ($version.type -eq "dev" -or $version.type -eq "beta") {
# Publish to release type folder folder
PublishFiles $releaseFiles "$($version.type)" $cacheControl1Year $contentType $overwrite
# PublishFiles $releaseFiles "$($version.type)" $cacheControl1Year $contentType $overwrite
PublishFiles $testFiles "$($version.type)" $cacheControl1Year $contentType $overwrite
}
elseif ($version.type -eq "nightly" -or $version.type -eq "nightly3") {
# Publish to release nightly folder folder
PublishFiles $releaseFiles "nightly" $cacheControl1Year $contentType $overwrite
# PublishFiles $releaseFiles "nightly" $cacheControl1Year $contentType $overwrite
PublishFiles $testFiles "nightly" $cacheControl1Year $contentType $overwrite
}
else {
# Upload to the test container rather than the supplied one

Просмотреть файл

@ -0,0 +1,42 @@
{
"version": "1.0.0",
"enabled": true,
"featureOptIn": {
"iKeyUsage": {
"mode": 3,
"onCfg": {
"throttleMgrCfg.109.disabled": false,
"throttleMgrCfg.106.disabled": false
},
"offCfg": {
"throttleMgrCfg.109.disabled": true,
"throttleMgrCfg.106.disabled": true
}
}
},
"config": {
"throttleMgrCfg": {
"109": {
"disabled": false,
"limit": {
"samplingRate": 2000000,
"maxSendNumber": 1
},
"interval": {
"dayInterval": 2
}
},
"106": {
"disabled": false,
"limit": {
"samplingRate": 1,
"maxSendNumber": 1
},
"interval": {
"monthInterval": 2,
"daysOfMonth": [1]
}
}
}
}
}

Просмотреть файл

@ -31,10 +31,13 @@ let scriptContent = fs.readFileSync(scriptFilePath, 'utf8');
// Replace the placeholder string with the actual connection string
const connectionString = 'InstrumentationKey=1ae9e7ce-18f1-4e14-8fc0-acbf0ed28895;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/';
let iKeyForCfgSync = "1ae9e7ce-18f1-4e14-8fc0-acbf0ed28895";
scriptContent = scriptContent.replace(`connectionString: "YOUR_CONNECTION_STRING"`, `instrumentationKey: "${iKeyForCfgSync}",\n \t\textensionConfig: {\n\t\t\t"AppInsightsCfgSyncPlugin": {\n\t\t\t\tcfgUrl:"https://js.monitor.azure.com/beta/ai.config.1.cfg.json"\n\t\t\t}\n\t\t}`);
//let cfgUrl = "https://js.monitor.azure.com/beta/ai.config.1.cfg.json";
let cfgUrl = "https://js.monitor.azure.com/nightly/ai_test.config.1-nightly3.cfg.json";
scriptContent = scriptContent.replace(`connectionString: "YOUR_CONNECTION_STRING"`, `instrumentationKey: "${iKeyForCfgSync}",\n \texpCfg: {\n\t\tinclScripts: true,\n\t\t\n\t\tmaxLogs: 100},\n \t\textensionConfig: {\n\t\t\t"AppInsightsCfgSyncPlugin": {\n\t\t\t\tcfgUrl:"${cfgUrl}"\n\t\t\t}\n\t\t}`);
//scriptContent = scriptContent.replace('YOUR_CONNECTION_STRING', connectionString);
scriptContent = `<script type="text/javascript">${scriptContent}</script>`;
// write this file into _include folder so that later github would reject it inside markdown files
const includeFolderPath = path.join(__dirname, '../../docs/_includes/');
const includeFolderFile = path.join(includeFolderPath, 'script.html');