-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ubuntu] Implement new directories hierarchy (#8627)
- Loading branch information
1 parent
d1f2c9a
commit 5d40b1e
Showing
146 changed files
with
391 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
190 changes: 95 additions & 95 deletions
190
.../scripts/installers/Configure-Toolset.ps1 → ...buntu/scripts/build/Configure-Toolset.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,95 @@ | ||
################################################################################ | ||
## File: Configure-Toolset.ps1 | ||
## Team: CI-Build | ||
## Desc: Configure toolset | ||
################################################################################ | ||
|
||
Import-Module "$env:HELPER_SCRIPTS/Tests.Helpers.psm1" -DisableNameChecking | ||
|
||
function Get-ToolsetToolFullPath | ||
{ | ||
param | ||
( | ||
[Parameter(Mandatory)] [string] $ToolName, | ||
[Parameter(Mandatory)] [string] $ToolVersion, | ||
[Parameter(Mandatory)] [string] $ToolArchitecture | ||
) | ||
|
||
$toolPath = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $toolName | ||
$toolPathVersion = Join-Path -Path $toolPath -ChildPath $toolVersion | ||
$foundVersion = Get-Item $toolPathVersion | Sort-Object -Property {[version]$_.name} -Descending | Select-Object -First 1 | ||
$installationDir = Join-Path -Path $foundVersion -ChildPath $toolArchitecture | ||
return $installationDir | ||
} | ||
|
||
function Add-EnvironmentVariable | ||
{ | ||
param | ||
( | ||
[Parameter(Mandatory)] [string] $Name, | ||
[Parameter(Mandatory)] [string] $Value, | ||
[string] $FilePath = "/etc/environment" | ||
) | ||
|
||
$envVar = "{0}={1}" -f $name, $value | ||
Tee-Object -InputObject $envVar -FilePath $filePath -Append | ||
} | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
Write-Host "Configure toolset tools environment..." | ||
$toolsEnvironment = @{ | ||
go = @{ | ||
command = "ln -s {0}/bin/* /usr/bin/" | ||
variableTemplate = "GOROOT_{0}_{1}_X64" | ||
} | ||
} | ||
|
||
$toolset = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw | ConvertFrom-Json | ||
|
||
foreach ($tool in $toolset.toolcache) | ||
{ | ||
$toolName = $tool.name | ||
$toolArch = $tool.arch | ||
$toolEnvironment = $toolsEnvironment[$toolName] | ||
|
||
if (-not $toolEnvironment) | ||
{ | ||
continue | ||
} | ||
|
||
foreach ($toolVersion in $tool.versions) | ||
{ | ||
Write-Host "Set $toolName $toolVersion environment variable..." | ||
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $toolArch | ||
$envName = $toolEnvironment.variableTemplate -f $toolVersion.split(".") | ||
|
||
# Add environment variable name=value | ||
Add-EnvironmentVariable -Name $envName -Value $toolPath | ||
} | ||
|
||
# Invoke command and add env variable for the default tool version | ||
$toolDefVersion = $tool.default | ||
if (-not $toolDefVersion) | ||
{ | ||
continue | ||
} | ||
|
||
$envDefName = $toolEnvironment.defaultVariable | ||
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolDefVersion -ToolArchitecture $toolArch | ||
|
||
if ($envDefName) | ||
{ | ||
Write-Host "Set default $envDefName for $toolName $toolDefVersion environment variable..." | ||
Add-EnvironmentVariable -Name $envDefName -Value $toolPath | ||
} | ||
|
||
if ($toolEnvironment.command) | ||
{ | ||
$command = $toolEnvironment.command -f $toolPath | ||
Write-Host "Invoke $command command for default $toolName $toolDefVersion..." | ||
Invoke-Expression -Command $command | ||
} | ||
} | ||
|
||
Invoke-PesterTests -TestFile "Toolset" -TestName "Toolset" | ||
################################################################################ | ||
## File: Configure-Toolset.ps1 | ||
## Team: CI-Build | ||
## Desc: Configure toolset | ||
################################################################################ | ||
|
||
Import-Module "$env:HELPER_SCRIPTS/Tests.Helpers.psm1" -DisableNameChecking | ||
|
||
function Get-ToolsetToolFullPath | ||
{ | ||
param | ||
( | ||
[Parameter(Mandatory)] [string] $ToolName, | ||
[Parameter(Mandatory)] [string] $ToolVersion, | ||
[Parameter(Mandatory)] [string] $ToolArchitecture | ||
) | ||
|
||
$toolPath = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath $toolName | ||
$toolPathVersion = Join-Path -Path $toolPath -ChildPath $toolVersion | ||
$foundVersion = Get-Item $toolPathVersion | Sort-Object -Property {[version]$_.name} -Descending | Select-Object -First 1 | ||
$installationDir = Join-Path -Path $foundVersion -ChildPath $toolArchitecture | ||
return $installationDir | ||
} | ||
|
||
function Add-EnvironmentVariable | ||
{ | ||
param | ||
( | ||
[Parameter(Mandatory)] [string] $Name, | ||
[Parameter(Mandatory)] [string] $Value, | ||
[string] $FilePath = "/etc/environment" | ||
) | ||
|
||
$envVar = "{0}={1}" -f $name, $value | ||
Tee-Object -InputObject $envVar -FilePath $filePath -Append | ||
} | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
Write-Host "Configure toolset tools environment..." | ||
$toolsEnvironment = @{ | ||
go = @{ | ||
command = "ln -s {0}/bin/* /usr/bin/" | ||
variableTemplate = "GOROOT_{0}_{1}_X64" | ||
} | ||
} | ||
|
||
$toolset = Get-Content -Path "$env:INSTALLER_SCRIPT_FOLDER/toolset.json" -Raw | ConvertFrom-Json | ||
|
||
foreach ($tool in $toolset.toolcache) | ||
{ | ||
$toolName = $tool.name | ||
$toolArch = $tool.arch | ||
$toolEnvironment = $toolsEnvironment[$toolName] | ||
|
||
if (-not $toolEnvironment) | ||
{ | ||
continue | ||
} | ||
|
||
foreach ($toolVersion in $tool.versions) | ||
{ | ||
Write-Host "Set $toolName $toolVersion environment variable..." | ||
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $toolArch | ||
$envName = $toolEnvironment.variableTemplate -f $toolVersion.split(".") | ||
|
||
# Add environment variable name=value | ||
Add-EnvironmentVariable -Name $envName -Value $toolPath | ||
} | ||
|
||
# Invoke command and add env variable for the default tool version | ||
$toolDefVersion = $tool.default | ||
if (-not $toolDefVersion) | ||
{ | ||
continue | ||
} | ||
|
||
$envDefName = $toolEnvironment.defaultVariable | ||
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolDefVersion -ToolArchitecture $toolArch | ||
|
||
if ($envDefName) | ||
{ | ||
Write-Host "Set default $envDefName for $toolName $toolDefVersion environment variable..." | ||
Add-EnvironmentVariable -Name $envDefName -Value $toolPath | ||
} | ||
|
||
if ($toolEnvironment.command) | ||
{ | ||
$command = $toolEnvironment.command -f $toolPath | ||
Write-Host "Invoke $command command for default $toolName $toolDefVersion..." | ||
Invoke-Expression -Command $command | ||
} | ||
} | ||
|
||
Invoke-PesterTests -TestFile "Toolset" -TestName "Toolset" |
File renamed without changes.
68 changes: 34 additions & 34 deletions
68
.../installers/Install-PowerShellModules.ps1 → ...ripts/build/Install-PowerShellModules.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
$ErrorActionPreference = "Stop" | ||
$ProgressPreference = "SilentlyContinue" | ||
|
||
Import-Module "$env:HELPER_SCRIPTS/Tests.Helpers.psm1" -DisableNameChecking | ||
|
||
# Specifies the installation policy | ||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery | ||
|
||
# Try to update PowerShellGet before the actual installation | ||
Install-Module -Name PowerShellGet -Force | ||
Update-Module -Name PowerShellGet -Force | ||
|
||
# Install PowerShell modules | ||
$modules = (Get-ToolsetContent).powershellModules | ||
|
||
foreach($module in $modules) | ||
{ | ||
$moduleName = $module.name | ||
Write-Host "Installing ${moduleName} module" | ||
|
||
if ($module.versions) | ||
{ | ||
foreach ($version in $module.versions) | ||
{ | ||
Write-Host " - $version" | ||
Install-Module -Name $moduleName -RequiredVersion $version -Scope AllUsers -SkipPublisherCheck -Force | ||
} | ||
continue | ||
} | ||
|
||
Install-Module -Name $moduleName -Scope AllUsers -SkipPublisherCheck -Force | ||
} | ||
|
||
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "PowerShellModules" | ||
$ErrorActionPreference = "Stop" | ||
$ProgressPreference = "SilentlyContinue" | ||
|
||
Import-Module "$env:HELPER_SCRIPTS/Tests.Helpers.psm1" -DisableNameChecking | ||
|
||
# Specifies the installation policy | ||
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery | ||
|
||
# Try to update PowerShellGet before the actual installation | ||
Install-Module -Name PowerShellGet -Force | ||
Update-Module -Name PowerShellGet -Force | ||
|
||
# Install PowerShell modules | ||
$modules = (Get-ToolsetContent).powershellModules | ||
|
||
foreach($module in $modules) | ||
{ | ||
$moduleName = $module.name | ||
Write-Host "Installing ${moduleName} module" | ||
|
||
if ($module.versions) | ||
{ | ||
foreach ($version in $module.versions) | ||
{ | ||
Write-Host " - $version" | ||
Install-Module -Name $moduleName -RequiredVersion $version -Scope AllUsers -SkipPublisherCheck -Force | ||
} | ||
continue | ||
} | ||
|
||
Install-Module -Name $moduleName -Scope AllUsers -SkipPublisherCheck -Force | ||
} | ||
|
||
Invoke-PesterTests -TestFile "PowerShellModules" -TestName "PowerShellModules" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
5d40b1e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Activate369EVF
5d40b1e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connect369evf
5d40b1e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start369EVF