<commit_before>﻿Param( $BuildNumber=$env:BUILD_NUMBER,

[Parameter(Mandatory=$true)]
[string] $testLocation,

[Parameter(Mandatory=$true)]
[string] $DistroIdentifier, 

[Parameter(Mandatory=$true)]
[string] $testCycle,

[string] $ARMImageName,
[string] $OsVHD,

[Parameter(Mandatory=$true)]  
[string] $OverrideVMSize,
[switch] $EnableAcceleratedNetworking,
[string] $customKernel, 
[string] $customLIS, 
[string] $customLISBranch,
[switch] $ForceDeleteResources,
[string] $customSecretsFilePath = $null,
[string] $ArchiveLogDirectory = $null,
[string] $ResultDBTable = $null,
[string] $ResultDBTestTag = $null,
[string] $RunSelectedTests=$null,
[string] $StorageAccount=$null
)

#---------------------------------------------------------[Initializations]--------------------------------------------------------
Write-Host "-----------$PWD---------"


if ( $customSecretsFilePath ) {
    $secretsFile = $customSecretsFilePath
    Write-Host "Using provided secrets file: $($secretsFile | Split-Path -Leaf)"
}
if ($env:Azure_Secrets_File) {
    $secretsFile = $env:Azure_Secrets_File
    Write-Host "Using predefined secrets file: $($secretsFile | Split-Path -Leaf) in Jenkins Global Environments."	
}
if ( $secretsFile -eq $null ) {
    Write-Host "ERROR: Azure Secrets file not found in Jenkins / user not provided -customSecretsFilePath" -ForegroundColor Red -BackgroundColor Black
    exit 1
}


if ( Test-Path $secretsFile) {
    Write-Host "AzureSecrets.xml found."
    .\AddAzureRmAccountFromSecretsFile.ps1 -customSecretsFilePath $secretsFile
    $xmlSecrets = [xml](Get-Content $secretsFile)
    Set-Variable -Name xmlSecrets -Value $xmlSecrets -Scope Global
}
else { 
    Write-Host "AzureSecrets.xml file is not added in Jenkins Global Environments OR it is not bound to 'Azure_Secrets_File' variable." -ForegroundColor Red -BackgroundColor Black
    Write-Host "Aborting." -ForegroundColor Red -BackgroundColor Black
    exit 1
}

if ( $ARMImageName -eq $null -and $OsVHD -eq $null)
{
    Write-Host "MISSING PARAMETER: ARMImage and OsVHD parameters are missing. Please give atleast one."
}

#region Set Jenkins specific variables.
if ($env:BUILD_NUMBER -gt 0)
{
    Write-Host "Detected Jenkins environment."
    $xmlConfigFileFinal = "$PWD\Azure_ICA_all_run-$env:JOB_NAME-$env:BUILD_NUMBER.xml"
}
else
{
    Write-Host "Detected local environment."
    $xmlConfigFileFinal = "$PWD\Azure_ICA_all_run-$testCycle-$DistroIdentifier.xml"
}

#region Select Storage Account Type
$regionName = $testLocation.Replace(" ","").Replace('"',"").ToLower()
$regionStorageMapping = [xml](Get-Content .\XML\RegionAndStorageAccounts.xml)
if ( $StorageAccount -imatch "ExistingStorage_Standard" )
{
    $StorageAccountName = $regionStorageMapping.AllRegions.$regionName.StandardStorage
}
elseif ( $StorageAccount -imatch "ExistingStorage_Premium" )
{
    $StorageAccountName = $regionStorageMapping.AllRegions.$regionName.PremiumStorage
}
elseif ( $StorageAccount -imatch "NewStorage_Standard" )
{
    $StorageAccountName = "NewStorage_Standard_LRS"
}
elseif ( $StorageAccount -imatch "NewStorage_Premium" )
{
    $StorageAccountName = "NewStorage_Premium_LRS"
}<commit_msg>fixed issue with jenkins environment.<commit_after>﻿Param( $BuildNumber=$env:BUILD_NUMBER,

[Parameter(Mandatory=$true)]
[string] $testLocation,

[Parameter(Mandatory=$true)]
[string] $DistroIdentifier, 

[Parameter(Mandatory=$true)]
[string] $testCycle,

[string] $ARMImageName,
[string] $OsVHD,

[Parameter(Mandatory=$true)]  
[string] $OverrideVMSize,
[switch] $EnableAcceleratedNetworking,
[string] $customKernel, 
[string] $customLIS, 
[string] $customLISBranch,
[switch] $ForceDeleteResources,
[string] $customSecretsFilePath = $null,
[string] $ArchiveLogDirectory = $null,
[string] $ResultDBTable = $null,
[string] $ResultDBTestTag = $null,
[string] $RunSelectedTests=$null,
[string] $StorageAccount=$null
)

#---------------------------------------------------------[Initializations]--------------------------------------------------------
Write-Host "-----------$PWD---------"


if ( $customSecretsFilePath ) {
    $secretsFile = $customSecretsFilePath
    Write-Host "Using provided secrets file: $($secretsFile | Split-Path -Leaf)"
}
if ($env:Azure_Secrets_File) {
    $secretsFile = $env:Azure_Secrets_File
    Write-Host "Using predefined secrets file: $($secretsFile | Split-Path -Leaf) in Jenkins Global Environments."	
}
if ( $secretsFile -eq $null ) {
    Write-Host "ERROR: Azure Secrets file not found in Jenkins / user not provided -customSecretsFilePath" -ForegroundColor Red -BackgroundColor Black
    exit 1
}


if ( Test-Path $secretsFile) {
    Write-Host "AzureSecrets.xml found."
    .\AddAzureRmAccountFromSecretsFile.ps1 -customSecretsFilePath $secretsFile
    $xmlSecrets = [xml](Get-Content $secretsFile)
    Set-Variable -Name xmlSecrets -Value $xmlSecrets -Scope Global
}
else { 
    Write-Host "AzureSecrets.xml file is not added in Jenkins Global Environments OR it is not bound to 'Azure_Secrets_File' variable." -ForegroundColor Red -BackgroundColor Black
    Write-Host "Aborting." -ForegroundColor Red -BackgroundColor Black
    exit 1
}

if ( $ARMImageName -eq $null -and $OsVHD -eq $null)
{
    Write-Host "MISSING PARAMETER: ARMImage and OsVHD parameters are missing. Please give atleast one."
}

#region Set Jenkins specific variables.
if ($env:BUILD_NUMBER -gt 0)
{
    Write-Host "Detected Jenkins environment."
    $xmlConfigFileFinal = "$PWD\Azure_ICA_all_run-$env:JOB_NAME-$env:BUILD_NUMBER.xml"
    $xmlConfigFileFinal = $xmlConfigFileFinal.Replace('/','-')
}
else
{
    Write-Host "Detected local environment."
    $xmlConfigFileFinal = "$PWD\Azure_ICA_all_run-$testCycle-$DistroIdentifier.xml"
}

#region Select Storage Account Type
$regionName = $testLocation.Replace(" ","").Replace('"',"").ToLower()
$regionStorageMapping = [xml](Get-Content .\XML\RegionAndStorageAccounts.xml)
if ( $StorageAccount -imatch "ExistingStorage_Standard" )
{
    $StorageAccountName = $regionStorageMapping.AllRegions.$regionName.StandardStorage
}
elseif ( $StorageAccount -imatch "ExistingStorage_Premium" )
{
    $StorageAccountName = $regionStorageMapping.AllRegions.$regionName.PremiumStorage
}
elseif ( $StorageAccount -imatch "NewStorage_Standard" )
{
    $StorageAccountName = "NewStorage_Standard_LRS"
}
elseif ( $StorageAccount -imatch "NewStorage_Premium" )
{
    $StorageAccountName = "NewStorage_Premium_LRS"
}
{'fraction_non_alphanumeric': 0.15942705900669468, 'fraction_numerical': 0.0012455238984898022, 'mean_word_length': 4.3090909090909095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 26}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4465368', 'n_tokens_mistral': 2048, 'n_tokens_neox': 1976, 'n_words': 458}