├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ └── config.yml ├── pull_request_template.md └── workflows │ ├── create_github_release.yml │ ├── linter.yml │ └── update_github_release.yml ├── images ├── win │ ├── scripts │ │ ├── Tests │ │ │ ├── RunAll-Tests.ps1 │ │ │ ├── LLVM.Tests.ps1 │ │ │ ├── PipxPackages.Tests.ps1 │ │ │ ├── WDK.Tests.ps1 │ │ │ ├── WinAppDriver.Tests.ps1 │ │ │ ├── Wix.Tests.ps1 │ │ │ ├── Miniconda.Tests.ps1 │ │ │ ├── Shell.Tests.ps1 │ │ │ ├── PHP.Tests.ps1 │ │ │ ├── Vsix.Tests.ps1 │ │ │ ├── SSDTExtensions.Tests.ps1 │ │ │ ├── Nginx.Tests.ps1 │ │ │ ├── Apache.Tests.ps1 │ │ │ ├── Git.Tests.ps1 │ │ │ ├── BizTalk.Tests.ps1 │ │ │ ├── Node.Tests.ps1 │ │ │ ├── Docker.Tests.ps1 │ │ │ ├── VisualStudio.Tests.ps1 │ │ │ ├── DotnetSDK.Tests.ps1 │ │ │ ├── CLI.Tools.Tests.ps1 │ │ │ └── Rust.Tests.ps1 │ │ ├── README.md │ │ ├── Installers │ │ │ ├── Install-CommonUtils.ps1 │ │ │ ├── Install-Wix.ps1 │ │ │ ├── Install-AzureDevOpsCli.ps1 │ │ │ ├── Install-Bazel.ps1 │ │ │ ├── Install-R.ps1 │ │ │ ├── Run-NGen.ps1 │ │ │ ├── Install-Mercurial.ps1 │ │ │ ├── Install-DACFx.ps1 │ │ │ ├── Install-Pipx.ps1 │ │ │ ├── Install-AzureCosmosDbEmulator.ps1 │ │ │ ├── Install-SQLOLEDBDriver.ps1 │ │ │ ├── Install-LLVM.ps1 │ │ │ ├── Install-Sbt.ps1 │ │ │ ├── Windows2016 │ │ │ │ ├── Install-Win81SDK.ps1 │ │ │ │ └── Install-SSDT.ps1 │ │ │ ├── Install-PipxPackages.ps1 │ │ │ ├── Wait-WindowsUpdatesForInstall.ps1 │ │ │ ├── Install-WebPlatformInstaller.ps1 │ │ │ ├── Configure-GDIProcessHandleQuota.ps1 │ │ │ ├── Install-NSIS.ps1 │ │ │ ├── Install-GoogleCloudSDK.ps1 │ │ │ ├── Install-NET48.ps1 │ │ │ ├── Install-GitHub-CLI.ps1 │ │ │ ├── Update-DotnetTLS.ps1 │ │ │ ├── Install-MongoDB.ps1 │ │ │ ├── Install-Mingw64.ps1 │ │ │ ├── Install-Nginx.ps1 │ │ │ ├── Install-WinAppDriver.ps1 │ │ │ ├── Install-Apache.ps1 │ │ │ ├── Install-Vcpkg.ps1 │ │ │ ├── Install-AzureCli.ps1 │ │ │ ├── Install-Miniconda.ps1 │ │ │ ├── Enable-DeveloperMode.ps1 │ │ │ ├── Install-ServiceFabricSDK.ps1 │ │ │ ├── Install-VCRedist.ps1 │ │ │ ├── Install-AliyunCli.ps1 │ │ │ ├── Install-PowershellCore.ps1 │ │ │ ├── Configure-DynamicPort.ps1 │ │ │ ├── Configure-Shell.ps1 │ │ │ ├── Install-Vsix.ps1 │ │ │ ├── Install-Kotlin.ps1 │ │ │ ├── Install-CloudFoundryCli.ps1 │ │ │ ├── Install-SQLPowerShellTools.ps1 │ │ │ ├── Install-AWS.ps1 │ │ │ ├── Install-WindowsFeatures.ps1 │ │ │ ├── Install-KubernetesTools.ps1 │ │ │ ├── Install-PowerShellModules.ps1 │ │ │ ├── Disable-JITDebugger.ps1 │ │ │ ├── Install-Choco.ps1 │ │ │ ├── Install-Stack.ps1 │ │ │ ├── Install-NodeLts.ps1 │ │ │ ├── Install-Zstd.ps1 │ │ │ ├── Install-PHP.ps1 │ │ │ ├── Install-Rust.ps1 │ │ │ └── Install-Git.ps1 │ │ ├── ImageHelpers │ │ │ └── test │ │ │ │ ├── ImageHelpers.Tests.ps1 │ │ │ │ └── PathHelpers.Tests.ps1 │ │ └── SoftwareReport │ │ │ └── SoftwareReport.Java.psm1 │ └── post-generation │ │ ├── Msys2FirstLaunch.ps1 │ │ ├── VSConfiguration.ps1 │ │ └── InternetExplorerConfiguration.ps1 ├── macos │ ├── provision │ │ ├── core │ │ │ ├── reboot.sh │ │ │ ├── bicep.sh │ │ │ ├── apache.sh │ │ │ ├── nginx.sh │ │ │ ├── llvm.sh │ │ │ ├── php.sh │ │ │ ├── cocoapods.sh │ │ │ ├── firefox.sh │ │ │ ├── golang.sh │ │ │ ├── openssl.sh │ │ │ ├── aws.sh │ │ │ ├── azcopy.sh │ │ │ ├── gcc.sh │ │ │ ├── chrome.sh │ │ │ ├── xcode-sims.sh │ │ │ ├── rubygem.sh │ │ │ ├── swiftlint.sh │ │ │ ├── vcpkg.sh │ │ │ ├── mongodb.sh │ │ │ ├── node.sh │ │ │ ├── rust.sh │ │ │ ├── homebrew.sh │ │ │ ├── miniconda.sh │ │ │ ├── graalvm.sh │ │ │ ├── pipx-packages.sh │ │ │ ├── safari.sh │ │ │ ├── open_windows_check.sh │ │ │ ├── stack.sh │ │ │ ├── audiodevice.sh │ │ │ ├── postgresql.sh │ │ │ ├── build-xcode-symlinks.sh │ │ │ ├── nvm.sh │ │ │ ├── git.sh │ │ │ ├── python.sh │ │ │ ├── haskell.sh │ │ │ └── xcode-postbuild.sh │ │ ├── configuration │ │ │ ├── environment │ │ │ │ ├── bashprofile │ │ │ │ └── bashrc │ │ │ ├── shell-change.sh │ │ │ ├── configure-ssh.sh │ │ │ ├── disable-auto-updates.sh │ │ │ ├── ntpconf.sh │ │ │ ├── max-files.sh │ │ │ ├── configure-hostname.sh │ │ │ └── preimagedata.sh │ │ ├── utils │ │ │ └── invoke-tests.sh │ │ ├── bootstrap-provisioner │ │ │ ├── change_password │ │ │ └── installNewProvisioner.sh │ │ └── assets │ │ │ └── select-xamarin-sdk.sh │ ├── tests │ │ ├── RunAll-Tests.ps1 │ │ ├── Linters.Tests.ps1 │ │ ├── PipxPackages.Tests.ps1 │ │ ├── LLVM.Tests.ps1 │ │ ├── Git.Tests.ps1 │ │ ├── Haskell.Tests.ps1 │ │ ├── WebServers.Tests.ps1 │ │ ├── PHP.Tests.ps1 │ │ ├── OpenSSL.Tests.ps1 │ │ ├── Databases.Tests.ps1 │ │ ├── Ruby.Tests.ps1 │ │ ├── Rust.Tests.ps1 │ │ ├── RubyGem.Tests.ps1 │ │ └── XamarinNDK.Tests.ps1 │ └── software-report │ │ ├── SoftwareReport.Java.psm1 │ │ └── SoftwareReport.WebServers.psm1 └── linux │ ├── config │ ├── ubuntu1804.conf │ ├── ubuntu2004.conf │ └── ubuntu2204.conf │ ├── scripts │ ├── tests │ │ ├── RunAll-Tests.ps1 │ │ ├── WebServers.Tests.ps1 │ │ ├── Node.Tests.ps1 │ │ ├── Browsers.Tests.ps1 │ │ ├── Haskell.Tests.ps1 │ │ ├── Apt.Tests.ps1 │ │ ├── CLI.Tools.Tests.ps1 │ │ └── DotnetSDK.Tests.ps1 │ ├── base │ │ ├── apt-mock-remove.sh │ │ ├── reboot.sh │ │ ├── snap.sh │ │ ├── repos.sh │ │ ├── limits.sh │ │ └── apt-mock.sh │ ├── installers │ │ ├── powershellcore.sh │ │ ├── sphinx.sh │ │ ├── heroku.sh │ │ ├── yq.sh │ │ ├── hhvm.sh │ │ ├── nginx.sh │ │ ├── docker-compose.sh │ │ ├── apache.sh │ │ ├── mssql-cmd-tools.sh │ │ ├── bazel.sh │ │ ├── complete-snap-setup.sh │ │ ├── sbt.sh │ │ ├── kotlin.sh │ │ ├── miniconda.sh │ │ ├── bicep.sh │ │ ├── packer.sh │ │ ├── r.sh │ │ ├── terraform.sh │ │ ├── basic.sh │ │ ├── oc.sh │ │ ├── aliyun-cli.sh │ │ ├── azure-devops-cli.sh │ │ ├── azure-cli.sh │ │ ├── leiningen.sh │ │ ├── validate-disk-space.sh │ │ ├── azcopy.sh │ │ ├── vcpkg.sh │ │ ├── github-cli.sh │ │ ├── oras-cli.sh │ │ ├── pulumi.sh │ │ ├── nvm.sh │ │ ├── phantomjs.sh │ │ ├── cmake.sh │ │ ├── gfortran.sh │ │ ├── gcc.sh │ │ ├── graalvm.sh │ │ ├── preimagedata.sh │ │ ├── example.sh │ │ ├── dpkg-config.sh │ │ ├── cleanup.sh │ │ ├── google-cloud-sdk.sh │ │ ├── post-deployment.sh │ │ ├── mysql.sh │ │ ├── sqlpackage.sh │ │ ├── nodejs.sh │ │ ├── mono.sh │ │ ├── erlang.sh │ │ ├── Install-PowerShellModules.ps1 │ │ ├── rust.sh │ │ ├── mongodb.sh │ │ ├── aws.sh │ │ ├── kubernetes-tools.sh │ │ ├── selenium.sh │ │ ├── firefox.sh │ │ ├── julia.sh │ │ └── pipx-packages.sh │ ├── helpers │ │ ├── invoke-tests.sh │ │ └── os.sh │ └── SoftwareReport │ │ └── SoftwareReport.Java.psm1 │ ├── post-generation │ ├── environment-variables.sh │ └── cleanup-logs.sh │ └── README.md ├── docs ├── resources │ ├── askOnError.png │ ├── vmCredentials.png │ ├── resourceGroupName.png │ └── packerResourceGroup.png └── debugging-failed-builds.md ├── .prettierrc.yml ├── SECURITY.md ├── images.CI ├── credscan-exclusions.json ├── linux-and-win │ ├── azure-pipelines │ │ ├── ubuntu1804.yml │ │ ├── ubuntu2004.yml │ │ ├── ubuntu2204.yml │ │ ├── windows2016.yml │ │ ├── windows2019.yml │ │ └── windows2022.yml │ ├── create-release.ps1 │ └── cleanup.ps1 ├── download-repo.ps1 └── macos │ ├── azure-pipelines │ ├── macos11.yml │ ├── macos12.yml │ └── macos1015.yml │ └── helpers.psm1 ├── .editorconfig ├── .vscode ├── extensions.json └── settings.json └── LICENSE /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @actions/virtual-environments-owners 2 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/RunAll-Tests.ps1: -------------------------------------------------------------------------------- 1 | Invoke-PesterTests "*" -------------------------------------------------------------------------------- /images/macos/provision/core/reboot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | shutdown -r now -------------------------------------------------------------------------------- /images/linux/config/ubuntu1804.conf: -------------------------------------------------------------------------------- 1 | # Name of pool supported by this image 2 | POOL_NAME="Ubuntu 1804" 3 | -------------------------------------------------------------------------------- /images/linux/config/ubuntu2004.conf: -------------------------------------------------------------------------------- 1 | # Name of pool supported by this image 2 | POOL_NAME="Ubuntu 2004" 3 | -------------------------------------------------------------------------------- /images/linux/config/ubuntu2204.conf: -------------------------------------------------------------------------------- 1 | # Name of pool supported by this image 2 | POOL_NAME="Ubuntu 2204" 3 | -------------------------------------------------------------------------------- /images/macos/provision/configuration/environment/bashprofile: -------------------------------------------------------------------------------- 1 | [ -f $HOME/.bashrc ] && source $HOME/.bashrc -------------------------------------------------------------------------------- /images/win/scripts/README.md: -------------------------------------------------------------------------------- 1 | Common scripts for all Windows images regardless of Visual Studio or OS version 2 | -------------------------------------------------------------------------------- /docs/resources/askOnError.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catthehacker/virtual-environments-fork/HEAD/docs/resources/askOnError.png -------------------------------------------------------------------------------- /docs/resources/vmCredentials.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catthehacker/virtual-environments-fork/HEAD/docs/resources/vmCredentials.png -------------------------------------------------------------------------------- /docs/resources/resourceGroupName.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catthehacker/virtual-environments-fork/HEAD/docs/resources/resourceGroupName.png -------------------------------------------------------------------------------- /images/macos/tests/RunAll-Tests.ps1: -------------------------------------------------------------------------------- 1 | Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking 2 | 3 | Invoke-PesterTests "*" -------------------------------------------------------------------------------- /docs/resources/packerResourceGroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/catthehacker/virtual-environments-fork/HEAD/docs/resources/packerResourceGroup.png -------------------------------------------------------------------------------- /images/linux/scripts/tests/RunAll-Tests.ps1: -------------------------------------------------------------------------------- 1 | Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking 2 | 3 | Invoke-PesterTests "*" 4 | -------------------------------------------------------------------------------- /images/win/post-generation/Msys2FirstLaunch.ps1: -------------------------------------------------------------------------------- 1 | # create user profile at the first launch 2 | $null = cmd /c "C:\msys64\usr\bin\bash.exe -leo pipefail -c 'echo $SHELL' 2>&1" -------------------------------------------------------------------------------- /images/linux/scripts/base/apt-mock-remove.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | prefix=/usr/local/bin 4 | 5 | for tool in apt apt-get apt-fast apt-key;do 6 | sudo rm -f $prefix/$tool 7 | done 8 | -------------------------------------------------------------------------------- /images/macos/provision/configuration/shell-change.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | echo "Changing shell to bash" 4 | sudo chsh -s /bin/bash $USERNAME 5 | sudo chsh -s /bin/bash root -------------------------------------------------------------------------------- /images/macos/provision/core/bicep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | echo Installing bicep cli... 4 | brew tap azure/bicep 5 | brew install bicep 6 | 7 | invoke_tests "Common" "Bicep" 8 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | --- 2 | singleQuote: false 3 | tabWidth: 2 4 | overrides: 5 | - files: '*.json' 6 | options: 7 | tabWidth: 4 8 | - files: '*.yml' 9 | options: 10 | tabWidth: 2 11 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | If you discover a security issue in this repo, please submit it through the [GitHub Security Bug Bounty](https://hackerone.com/github) 2 | 3 | Thanks for helping make GitHub Actions safe for everyone. 4 | -------------------------------------------------------------------------------- /images/macos/provision/core/apache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | brew install httpd 4 | sudo sed -Ei '' 's/Listen .*/Listen 80/' $(brew --prefix)/etc/httpd/httpd.conf 5 | 6 | invoke_tests "WebServers" "Apache" 7 | -------------------------------------------------------------------------------- /images/macos/provision/core/nginx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | brew install nginx 4 | sudo sed -Ei '' 's/listen.*/listen 80;/' $(brew --prefix)/etc/nginx/nginx.conf 5 | 6 | invoke_tests "WebServers" "Nginx" 7 | -------------------------------------------------------------------------------- /images/macos/provision/core/llvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | llvmVersion=$(get_toolset_value '.llvm.version') 5 | 6 | brew_smart_install "llvm@${llvmVersion}" 7 | 8 | invoke_tests "LLVM" -------------------------------------------------------------------------------- /images.CI/credscan-exclusions.json: -------------------------------------------------------------------------------- 1 | { 2 | "tool": "Credential Scanner", 3 | "suppressions": [ 4 | { 5 | "placeholder": "P@ssword!!", 6 | "_justification": "Password used by SQL Express. It is required to interact with database." 7 | } 8 | ] 9 | } -------------------------------------------------------------------------------- /images/macos/provision/utils/invoke-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | source $HOME/.bashrc 4 | pwsh -Command "Import-Module '$HOME/image-generation/helpers/Tests.Helpers.psm1' -DisableNameChecking 5 | Invoke-PesterTests -TestFile \"$1\" -TestName \"$2\"" 6 | -------------------------------------------------------------------------------- /images/macos/tests/Linters.Tests.ps1: -------------------------------------------------------------------------------- 1 | Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking 2 | 3 | $os = Get-OSVersion 4 | 5 | Describe "SwiftLint" { 6 | It "SwiftLint" { 7 | "swiftlint version" | Should -ReturnZeroExitCode 8 | } 9 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [*.json] 10 | indent_size = 4 11 | indent_style = space 12 | 13 | [*.y{a,}ml] 14 | indent_size = 2 15 | indent_style = space 16 | -------------------------------------------------------------------------------- /images/macos/provision/configuration/configure-ssh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | [[ ! -d ~/.ssh ]] && mkdir ~/.ssh 2>/dev/null 4 | chmod 777 ~/.ssh 5 | 6 | ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> ~/.ssh/known_hosts 7 | ssh-keyscan -t rsa ssh.dev.azure.com >> ~/.ssh/known_hosts 8 | -------------------------------------------------------------------------------- /images/linux/post-generation/environment-variables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Replace $HOME with the default user's home directory for environmental variables related to the default user home directory 4 | 5 | homeDir=$(cut -d: -f6 /etc/passwd | tail -1) 6 | sed -i "s|\$HOME|$homeDir|g" /etc/environment -------------------------------------------------------------------------------- /images/linux/scripts/tests/WebServers.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Apache" { 2 | It "Apache CLI" { 3 | "apache2 -v" | Should -ReturnZeroExitCode 4 | } 5 | } 6 | 7 | Describe "Nginx" { 8 | It "Nginx CLI" { 9 | "nginx -v" | Should -ReturnZeroExitCode 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-CommonUtils.ps1: -------------------------------------------------------------------------------- 1 | $commonPackages = (Get-ToolsetContent).choco.common_packages 2 | 3 | foreach ($package in $commonPackages) 4 | { 5 | Choco-Install -PackageName $package.name -ArgumentList $package.args 6 | } 7 | 8 | Invoke-PesterTests -TestFile "ChocoPackages" -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | 3 | contact_links: 4 | - name: Get help in GitHub Discussions 5 | url: https://github.com/actions/virtual-environments/discussions 6 | about: Have a question? Feel free to ask in the virtual-environments GitHub Discussions! 7 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/LLVM.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Clang/LLVM" { 2 | It "Clang/LLVM installed and version is correct" { 3 | $toolsetVersion = (Get-ToolsetContent).llvm.version 4 | $clangVersion = clang --version 5 | $clangVersion[0] | Should -BeLike "*${toolsetVersion}*" 6 | } 7 | } -------------------------------------------------------------------------------- /images/linux/scripts/base/reboot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: reboot.sh 4 | ## Desc: Reboot VM 5 | ################################################################################ 6 | 7 | echo "Reboot VM" 8 | sudo reboot 9 | -------------------------------------------------------------------------------- /images/macos/tests/PipxPackages.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "PipxPackages" { 2 | $pipxToolset = Get-ToolsetValue "pipx" 3 | $testCases = $pipxToolset | ForEach-Object { @{package = $_.package; cmd = $_.cmd} } 4 | It "" -TestCases $testCases { 5 | "$cmd" | Should -ReturnZeroExitCode 6 | } 7 | } -------------------------------------------------------------------------------- /images/win/scripts/Tests/PipxPackages.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "PipxPackages" { 2 | $pipxToolset = (Get-ToolsetContent).pipx 3 | $testCases = $pipxToolset | ForEach-Object { @{package = $_.package; cmd = $_.cmd} } 4 | It "" -TestCases $testCases { 5 | "$cmd" | Should -ReturnZeroExitCode 6 | } 7 | } -------------------------------------------------------------------------------- /images/macos/provision/core/php.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo Installing PHP 5 | phpVersionToolset=$(get_toolset_value '.php.version') 6 | brew_smart_install "php@${phpVersionToolset}" 7 | 8 | echo Installing composer 9 | brew_smart_install "composer" 10 | 11 | invoke_tests "PHP" 12 | -------------------------------------------------------------------------------- /images/macos/provision/core/cocoapods.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | # Setup the Cocoapods 4 | echo "Installing Cocoapods..." 5 | pod setup 6 | 7 | # Create a symlink to /usr/local/bin since it was removed due to Homebrew change. 8 | ln -sf $(which pod) /usr/local/bin/pod 9 | 10 | invoke_tests "Common" "CocoaPods" 11 | -------------------------------------------------------------------------------- /images/macos/tests/LLVM.Tests.ps1: -------------------------------------------------------------------------------- 1 | $os = Get-OSVersion 2 | 3 | Describe "Clang/LLVM" { 4 | It "Clang/LLVM is installed and version is correct" { 5 | $toolsetVersion = Get-ToolsetValue 'llvm.version' 6 | $clangVersion = & "$(brew --prefix llvm)/bin/clang" --version 7 | $clangVersion[0] | Should -BeLike "*${toolsetVersion}*" 8 | } 9 | } -------------------------------------------------------------------------------- /images/linux/scripts/installers/powershellcore.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: powershellcore.sh 4 | ## Desc: Installs powershellcore 5 | ################################################################################ 6 | 7 | # Install Powershell 8 | apt-get install -y powershell 9 | -------------------------------------------------------------------------------- /images/macos/tests/Git.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Git" { 2 | It "git is installed" { 3 | "git --version" | Should -ReturnZeroExitCode 4 | } 5 | 6 | It "git lfs is installed" { 7 | "git lfs version" | Should -ReturnZeroExitCode 8 | } 9 | 10 | It "hub CLI is installed" { 11 | "hub --version" | Should -ReturnZeroExitCode 12 | } 13 | } -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Wix.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Wix.ps1 3 | ## Desc: Install WIX. 4 | ################################################################################ 5 | 6 | Choco-Install -PackageName wixtoolset -ArgumentList "--force" 7 | 8 | Invoke-PesterTests -TestFile "Wix" 9 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/sphinx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: sphinx.sh 4 | ## Desc: Installs Sphinx 5 | ################################################################################ 6 | 7 | 8 | # Install Sphinx 9 | apt-get install -y sphinxsearch 10 | 11 | invoke_tests "Tools" "Sphinx" -------------------------------------------------------------------------------- /images/linux/post-generation/cleanup-logs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # journalctl 4 | if command -v journalctl; then 5 | journalctl --rotate 6 | journalctl --vacuum-time=1s 7 | fi 8 | 9 | # delete all .gz and rotated file 10 | find /var/log -type f -regex ".*\.gz$" -delete 11 | find /var/log -type f -regex ".*\.[0-9]$" -delete 12 | 13 | # wipe log files 14 | find /var/log/ -type f -exec cp /dev/null {} \; -------------------------------------------------------------------------------- /images/linux/scripts/installers/heroku.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: heroku.sh 4 | ## Desc: Installs Heroku CLI 5 | ################################################################################ 6 | 7 | # Install Heroku CLI 8 | curl https://cli-assets.heroku.com/install.sh | sh 9 | 10 | invoke_tests "Tools" "Heroku" -------------------------------------------------------------------------------- /images/win/scripts/ImageHelpers/test/ImageHelpers.Tests.ps1: -------------------------------------------------------------------------------- 1 | $ModuleManifestName = 'ImageHelpers.psd1' 2 | $ModuleManifestPath = "$PSScriptRoot\..\$ModuleManifestName" 3 | 4 | 5 | 6 | Describe 'Module Manifest Tests' { 7 | It 'Passes Test-ModuleManifest' { 8 | Test-ModuleManifest -Path $ModuleManifestPath | Should Not BeNullOrEmpty 9 | $? | Should Be $true 10 | } 11 | } 12 | 13 | 14 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-AzureDevOpsCli.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-AzureDevOpsCli.ps1 3 | ## Desc: Install Azure DevOps CLI 4 | ################################################################################ 5 | 6 | az extension add -n azure-devops 7 | 8 | Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Azure DevOps CLI" -------------------------------------------------------------------------------- /images/linux/scripts/installers/yq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Source the helpers for use with the script 4 | # shellcheck source=/images/linux/scripts/helpers/install.sh 5 | source "$HELPER_SCRIPTS"/install.sh 6 | 7 | YQ_URL="https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64" 8 | download_with_retries "$YQ_URL" "/usr/bin" "yq" 9 | chmod +x /usr/bin/yq 10 | 11 | invoke_tests "Tools" "yq" 12 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "editorconfig.editorconfig", 4 | "ms-azuretools.vscode-docker", 5 | "usernamehw.errorlens", 6 | "mhutchie.git-graph", 7 | "davidanson.vscode-markdownlint", 8 | "ms-vscode.powershell", 9 | "ms-vscode.powershell-preview", 10 | "esbenp.prettier-vscode", 11 | "timonwong.shellcheck" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /images/macos/provision/configuration/disable-auto-updates.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | # Disabling automatic updates 4 | sudo softwareupdate --schedule off 5 | defaults write com.apple.SoftwareUpdate AutomaticDownload -int 0 6 | defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 0 7 | defaults write com.apple.commerce AutoUpdate -bool false 8 | defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool false -------------------------------------------------------------------------------- /images.CI/linux-and-win/azure-pipelines/ubuntu1804.yml: -------------------------------------------------------------------------------- 1 | schedules: 2 | - cron: "0 0 * * *" 3 | displayName: Daily 4 | branches: 5 | include: 6 | - main 7 | always: true 8 | 9 | trigger: none 10 | pr: 11 | autoCancel: true 12 | branches: 13 | include: 14 | - main 15 | 16 | jobs: 17 | - template: image-generation.yml 18 | parameters: 19 | image_type: ubuntu1804 20 | image_readme_name: Ubuntu1804-Readme.md -------------------------------------------------------------------------------- /images.CI/linux-and-win/azure-pipelines/ubuntu2004.yml: -------------------------------------------------------------------------------- 1 | schedules: 2 | - cron: "0 0 * * *" 3 | displayName: Daily 4 | branches: 5 | include: 6 | - main 7 | always: true 8 | 9 | trigger: none 10 | pr: 11 | autoCancel: true 12 | branches: 13 | include: 14 | - main 15 | 16 | jobs: 17 | - template: image-generation.yml 18 | parameters: 19 | image_type: ubuntu2004 20 | image_readme_name: Ubuntu2004-Readme.md -------------------------------------------------------------------------------- /images.CI/linux-and-win/azure-pipelines/ubuntu2204.yml: -------------------------------------------------------------------------------- 1 | schedules: 2 | - cron: "0 0 * * *" 3 | displayName: Daily 4 | branches: 5 | include: 6 | - main 7 | always: true 8 | 9 | trigger: none 10 | pr: 11 | autoCancel: true 12 | branches: 13 | include: 14 | - main 15 | 16 | jobs: 17 | - template: image-generation.yml 18 | parameters: 19 | image_type: ubuntu2204 20 | image_readme_name: Ubuntu2204-Readme.md -------------------------------------------------------------------------------- /images.CI/linux-and-win/azure-pipelines/windows2016.yml: -------------------------------------------------------------------------------- 1 | schedules: 2 | - cron: "0 0 * * *" 3 | displayName: Daily 4 | branches: 5 | include: 6 | - main 7 | always: true 8 | 9 | trigger: none 10 | pr: 11 | autoCancel: true 12 | branches: 13 | include: 14 | - main 15 | 16 | jobs: 17 | - template: image-generation.yml 18 | parameters: 19 | image_type: windows2016 20 | image_readme_name: Windows2016-Readme.md -------------------------------------------------------------------------------- /images.CI/linux-and-win/azure-pipelines/windows2019.yml: -------------------------------------------------------------------------------- 1 | schedules: 2 | - cron: "0 0 * * *" 3 | displayName: Daily 4 | branches: 5 | include: 6 | - main 7 | always: true 8 | 9 | trigger: none 10 | pr: 11 | autoCancel: true 12 | branches: 13 | include: 14 | - main 15 | 16 | jobs: 17 | - template: image-generation.yml 18 | parameters: 19 | image_type: windows2019 20 | image_readme_name: Windows2019-Readme.md -------------------------------------------------------------------------------- /images.CI/linux-and-win/azure-pipelines/windows2022.yml: -------------------------------------------------------------------------------- 1 | schedules: 2 | - cron: "0 0 * * *" 3 | displayName: Daily 4 | branches: 5 | include: 6 | - main 7 | always: true 8 | 9 | trigger: none 10 | pr: 11 | autoCancel: true 12 | branches: 13 | include: 14 | - main 15 | 16 | jobs: 17 | - template: image-generation.yml 18 | parameters: 19 | image_type: windows2022 20 | image_readme_name: Windows2022-Readme.md -------------------------------------------------------------------------------- /images/macos/provision/core/firefox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo "Installing Firefox..." 5 | brew install --cask firefox 6 | 7 | echo "Installing Geckodriver..." 8 | brew_smart_install "geckodriver" 9 | geckoPath="$(brew --prefix geckodriver)/bin" 10 | 11 | echo "Add GECKOWEBDRIVER to bashrc..." 12 | echo "export GECKOWEBDRIVER=${geckoPath}" >> "${HOME}/.bashrc" 13 | 14 | invoke_tests "Browsers" "Firefox" 15 | -------------------------------------------------------------------------------- /images/linux/scripts/helpers/invoke-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: invoke-tests.sh 4 | ## Desc: Helper function for invoking tests 5 | ################################################################################ 6 | 7 | pwsh -Command "Import-Module '$HELPER_SCRIPTS/Tests.Helpers.psm1' -DisableNameChecking 8 | Invoke-PesterTests -TestFile \"$1\" -TestName \"$2\"" 9 | -------------------------------------------------------------------------------- /images/macos/provision/core/golang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | DEFAULT_GO_VERSION=$(get_toolset_value '.go.default') 5 | echo "Installing Go..." 6 | brew_smart_install "go@${DEFAULT_GO_VERSION}" 7 | 8 | # Create symlinks to preserve backward compatibility. Symlinks are not created when non-latest go is being installed 9 | ln -sf $(brew --prefix go@${DEFAULT_GO_VERSION})/bin/* /usr/local/bin/ 10 | 11 | invoke_tests "Common" "Go" -------------------------------------------------------------------------------- /images/macos/provision/configuration/ntpconf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | echo Additional NTP servers adding into /etc/ntp.conf file... 4 | cat > /etc/ntp.conf << EOF 5 | server 0.pool.ntp.org 6 | server 1.pool.ntp.org 7 | server 2.pool.ntp.org 8 | server 3.pool.ntp.org 9 | server time.apple.com 10 | server time.windows.com 11 | EOF 12 | 13 | # Set the timezone to UTC. 14 | echo The Timezone setting to UTC... 15 | ln -sf /usr/share/zoneinfo/UTC /etc/localtime 16 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/WDK.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "WDK" -Skip:(Test-IsWin22) { 2 | It "WDK exists" { 3 | $WDKVersion = (Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Windows Driver Kit'").Version 4 | $WDKVersion| Should -Not -BeNullOrEmpty 5 | } 6 | 7 | It "WDK version from system" { 8 | $version = Get-VSExtensionVersion -packageName "Microsoft.Windows.DriverKit" 9 | $version | Should -Not -BeNullOrEmpty 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Bazel.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Bazel.ps1 3 | ## Desc: Install Bazel and Bazelisk (A user-friendly launcher for Bazel) 4 | ################################################################################ 5 | 6 | Choco-Install -PackageName bazel 7 | 8 | npm install -g @bazel/bazelisk 9 | 10 | Invoke-PesterTests -TestFile "Tools" -TestName "Bazel" -------------------------------------------------------------------------------- /images/macos/provision/core/openssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo "Install openssl@1.1" 5 | brew_smart_install "openssl@1.1" 6 | 7 | # Symlink brew openssl@1.1 to `/usr/local/bin` as Homebrew refuses 8 | ln -sf $(brew --prefix openssl@1.1)/bin/openssl /usr/local/bin/openssl 9 | 10 | # Most of buildsystems and scripts look up ssl here 11 | ln -sf $(brew --cellar openssl@1.1)/1.1* /usr/local/opt/openssl 12 | 13 | invoke_tests "OpenSSL" 14 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-R.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-R.ps1 3 | ## Desc: Install R for Windows 4 | ################################################################################ 5 | 6 | Choco-Install R.Project 7 | Choco-Install rtools 8 | 9 | $rscriptPath = Resolve-Path "C:\Program Files\R\*\bin\x64" 10 | Add-MachinePathItem $rscriptPath 11 | Invoke-PesterTests -TestFile "Tools" -TestName "R" -------------------------------------------------------------------------------- /images/win/post-generation/VSConfiguration.ps1: -------------------------------------------------------------------------------- 1 | $vsInstallRoot = (Get-VisualStudioInstance).InstallationPath 2 | $devEnvPath = "$vsInstallRoot\Common7\IDE\devenv.exe" 3 | 4 | # Initialize Visual Studio Experimental Instance 5 | # The Out-Null cmdlet is required to ensure PowerShell waits until the '/ResetSettings' command fully completes. 6 | & "$devEnvPath" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit | Out-Null 7 | 8 | cmd.exe /c "`"$devEnvPath`" /updateconfiguration" -------------------------------------------------------------------------------- /images/macos/tests/Haskell.Tests.ps1: -------------------------------------------------------------------------------- 1 | $os = Get-OSVersion 2 | 3 | Describe "Haskell" { 4 | Context "GHCup" { 5 | It "GHCup" { 6 | "ghcup --version" | Should -ReturnZeroExitCode 7 | } 8 | } 9 | Context "GHC" { 10 | It "GHC" { 11 | "ghc --version" | Should -ReturnZeroExitCode 12 | } 13 | } 14 | Context "Cabal" { 15 | It "Cabal" { 16 | "cabal --version" | Should -ReturnZeroExitCode 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /images/macos/provision/core/aws.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo Installing aws... 5 | AWS_CLI_URL="https://awscli.amazonaws.com/AWSCLIV2.pkg" 6 | download_with_retries $AWS_CLI_URL "/tmp" 7 | sudo installer -pkg /tmp/AWSCLIV2.pkg -target / 8 | 9 | echo Installing aws sam cli... 10 | brew tap aws/tap 11 | brew install aws-sam-cli 12 | 13 | echo "Install aws cli session manager" 14 | brew install --cask session-manager-plugin 15 | 16 | invoke_tests "Common" "AWS" 17 | -------------------------------------------------------------------------------- /images/macos/provision/core/azcopy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | AZCOPY_DOWNLOAD_URL="https://aka.ms/downloadazcopy-v10-mac" 5 | 6 | download_with_retries $AZCOPY_DOWNLOAD_URL "/tmp" "azcopy.zip" 7 | unzip /tmp/azcopy.zip -d azcopy 8 | AZCOPY_EXTRACTED=$(echo azcopy/azcopy*) 9 | cp "$AZCOPY_EXTRACTED/azcopy" "/usr/local/bin/azcopy" 10 | chmod +x "/usr/local/bin/azcopy" 11 | 12 | echo "Done, cleaning up" 13 | rm -rf azcopy* 14 | 15 | invoke_tests "Common" "AzCopy" 16 | -------------------------------------------------------------------------------- /images/macos/provision/core/gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | gccVersions=$(get_toolset_value '.gcc.versions | .[]') 5 | 6 | for gccVersion in $gccVersions; do 7 | brew_smart_install "gcc@${gccVersion}" 8 | done 9 | 10 | # Delete default gfortran link if it exists https://github.com/actions/virtual-environments/issues/1280 11 | gfortranPath=$(which gfortran) 12 | if [ $gfortranPath ]; then 13 | rm $gfortranPath 14 | fi 15 | 16 | invoke_tests "Common" "GCC" 17 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/hhvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: hhvm.sh 4 | ## Desc: Installs hhvm 5 | ################################################################################ 6 | 7 | apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94 8 | add-apt-repository https://dl.hhvm.com/ubuntu 9 | apt-get update 10 | apt-get -qq install -y hhvm 11 | 12 | invoke_tests "Tools" "HHVM" 13 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Run-NGen.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "NGen: Microsoft.PowerShell.Utility.Activities" 2 | $null = & $env:SystemRoot\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install "Microsoft.PowerShell.Utility.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 3 | Write-Host "NGen: Framework64" 4 | $null = & $env:SystemRoot\Microsoft.NET\Framework64\v4.0.30319\ngen.exe update 5 | Write-Host "NGen: Framework" 6 | $null = & $env:SystemRoot\Microsoft.NET\Framework\v4.0.30319\ngen.exe update -------------------------------------------------------------------------------- /images/win/scripts/Tests/WinAppDriver.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "WinAppDriver" { 2 | It "WinAppDriver directory exists" { 3 | Test-Path -Path "${env:ProgramFiles(x86)}\Windows Application Driver" | Should -BeTrue 4 | } 5 | } 6 | 7 | Describe "Developer Mode" { 8 | It "Developer Mode is enabled" { 9 | $path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"; 10 | Get-ItemProperty -Path $path | Select-Object -ExpandProperty "AllowDevelopmentWithoutDevLicense" | Should -Be 1 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/nginx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: nginx.sh 4 | ## Desc: Installs Nginx 5 | ################################################################################ 6 | 7 | # Install Nginx 8 | apt-get install nginx -y 9 | 10 | # Disable nginx.service 11 | systemctl is-active --quiet nginx.service && systemctl stop nginx.service 12 | systemctl disable nginx.service 13 | 14 | invoke_tests "WebServers" "Nginx" 15 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/Wix.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Wix" -Skip:(Test-IsWin22) { 2 | BeforeAll { 3 | $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" 4 | $installedApplications = Get-ItemProperty -Path $regKey 5 | $version = ($installedApplications | Where-Object { $_.BundleCachePath -imatch ".*\\WiX\d*\.exe$" } | Select-Object -First 1).DisplayName 6 | } 7 | 8 | It "Wix Toolset version from registry" { 9 | $version | Should -Not -BeNullOrEmpty 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /images/macos/provision/core/chrome.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo "Installing Chrome..." 5 | brew_cask_install_ignoring_sha256 "google-chrome" 6 | 7 | echo "Installing Chrome Driver" 8 | brew install --cask chromedriver 9 | 10 | echo "Installing Selenium" 11 | brew_smart_install "selenium-server" 12 | 13 | CHROMEWEBDRIVER_DIR=$(readlink $(which chromedriver) | xargs dirname) 14 | echo "export CHROMEWEBDRIVER=$CHROMEWEBDRIVER_DIR" >> "${HOME}/.bashrc" 15 | 16 | invoke_tests "Browsers" "Chrome" 17 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Mercurial.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Mercurial.ps1 3 | ## Desc: Install Mercurial 4 | ################################################################################ 5 | 6 | Choco-Install -PackageName hg -ArgumentList "--version", "5.0.0" 7 | 8 | $hgPath = "${env:ProgramFiles}\Mercurial\" 9 | Add-MachinePathItem $hgPath 10 | $env:Path = Get-MachinePath 11 | 12 | Invoke-PesterTests -TestFile "Tools" -TestName "Mercurial" -------------------------------------------------------------------------------- /images.CI/download-repo.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [String] [Parameter (Mandatory=$true)] $RepoUrl, 3 | [String] [Parameter (Mandatory=$true)] $RepoBranch 4 | ) 5 | 6 | Write-Host "Clean up default repository" 7 | Remove-Item -path './*' -Recurse -Force 8 | 9 | Write-Host "Download ${RepoBranch} branch from ${RepoUrl}" 10 | $env:GIT_REDIRECT_STDERR = '2>&1' 11 | git clone $RepoUrl . -b $RepoBranch --single-branch --depth 1 12 | 13 | Write-Host "Latest commit:" 14 | git --no-pager log --pretty=format:"Date: %cd; Commit: %H - %s; Author: %an <%ae>" -1 -------------------------------------------------------------------------------- /images/win/scripts/Tests/Miniconda.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Miniconda" -Skip:(Test-IsWin22) { 2 | It "Miniconda Environment variables is set. " { 3 | ${env:CONDA} | Should -Not -BeNullOrEmpty 4 | } 5 | 6 | It "Miniconda $env:CONDA\ " -TestCases @( 7 | @{ PathTest = "python.exe" } 8 | @{ PathTest = "Scripts\conda.exe" } 9 | ) { 10 | $condaPath = Join-Path ${env:CONDA} $PathTest 11 | $condaPath | Should -Exist 12 | "$condaPath --version" | Should -ReturnZeroExitCode 13 | } 14 | } -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-DACFx.ps1: -------------------------------------------------------------------------------- 1 | #################################################################################### 2 | ## File: Install-DACFx.ps1 3 | ## Desc: Install SQL Server® Data-Tier Application Framework (DacFx) for Windows 4 | #################################################################################### 5 | 6 | $InstallerName = "DacFramework.msi" 7 | $InstallerUrl = "https://aka.ms/dacfx-msi" 8 | 9 | Install-Binary -Url $InstallerUrl -Name $InstallerName 10 | 11 | Invoke-PesterTests -TestFile "Tools" -TestName "DACFx" -------------------------------------------------------------------------------- /images/win/scripts/Tests/Shell.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Shell" { 2 | $shellTestCases = @( 3 | @{Name = "C:\shells\gitbash.exe"; Target = "$env:ProgramFiles\Git\bin\bash.exe"}, 4 | @{Name = "C:\shells\msys2bash.cmd"; Target = $null} 5 | ) 6 | if (Test-IsWin19) { 7 | $shellTestCases += @{Name = "C:\shells\wslbash.exe"; Target = "$env:SystemRoot\System32\bash.exe"} 8 | } 9 | 10 | It " target to " -TestCases $shellTestCases { 11 | (Get-Item $Name).Target | Should -BeExactly $Target 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Pipx.ps1: -------------------------------------------------------------------------------- 1 | # Set custom directorys for pipx 2 | $env:PIPX_BIN_DIR = "${env:ProgramFiles(x86)}\pipx_bin" 3 | $env:PIPX_HOME = "${env:ProgramFiles(x86)}\pipx" 4 | 5 | # Install pipx 6 | pip install pipx 7 | 8 | # Set environment variables 9 | Add-MachinePathItem "${env:PIPX_BIN_DIR}" 10 | Set-SystemVariable -SystemVariable PIPX_BIN_DIR -Value $env:PIPX_BIN_DIR 11 | Set-SystemVariable -SystemVariable PIPX_HOME -Value $env:PIPX_HOME 12 | 13 | # Test pipx 14 | Invoke-PesterTests -TestFile "Tools" -TestName "Pipx" -------------------------------------------------------------------------------- /images/macos/tests/WebServers.Tests.ps1: -------------------------------------------------------------------------------- 1 | $os = Get-OSVersion 2 | 3 | Describe "Apache" { 4 | It "Apache CLI" { 5 | "httpd -v" | Should -ReturnZeroExitCode 6 | } 7 | 8 | It "Apache Service" { 9 | brew services list | Out-String | Should -Match "httpd\s+(stopped|none)" 10 | } 11 | } 12 | 13 | Describe "Nginx" { 14 | It "Nginx CLI" { 15 | "nginx -v" | Should -ReturnZeroExitCode 16 | } 17 | 18 | It "Nginx Service" { 19 | brew services list | Out-String | Should -Match "nginx\s+(stopped|none)" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /images/macos/provision/core/xcode-sims.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | source ~/utils/utils.sh 4 | 5 | # Downloading and installing simulators 6 | SIMS_TO_INSTALL=( 7 | "8.4" 8 | "9.0" 9 | "9.1" 10 | "9.2" 11 | "9.3" 12 | "10.0" 13 | "10.1" 14 | "10.2" 15 | "10.3" 16 | ) 17 | 18 | for SIM_VERSION in ${SIMS_TO_INSTALL[@]} 19 | do 20 | echo "Installing iOS $SIM_VERSION ..." 21 | sudo xcversion simulators --install="iOS ${SIM_VERSION}" 22 | echo "Successfuly installed iOS $SIM_VERSION ..." 23 | done 24 | 25 | echo "Done installing simulator runtimes." 26 | -------------------------------------------------------------------------------- /images.CI/macos/azure-pipelines/macos11.yml: -------------------------------------------------------------------------------- 1 | name: macOS-11_$(date:yyyyMMdd)$(rev:.r)_unstable 2 | schedules: 3 | - cron: "0 0 * * *" 4 | displayName: Daily 5 | branches: 6 | include: 7 | - main 8 | always: true 9 | 10 | trigger: none 11 | pr: 12 | autoCancel: true 13 | branches: 14 | include: 15 | - main 16 | 17 | jobs: 18 | - template: image-generation.yml 19 | parameters: 20 | image_label: 'macOS Big Sur' 21 | base_image_name: 'clean-macOS-11-380Gb-runner' 22 | template_path: 'templates/macOS-11.json' 23 | target_datastore: 'ds-image' 24 | -------------------------------------------------------------------------------- /images.CI/macos/azure-pipelines/macos12.yml: -------------------------------------------------------------------------------- 1 | name: macOS-12_$(date:yyyyMMdd)$(rev:.r)_unstable 2 | schedules: 3 | - cron: "0 0 * * *" 4 | displayName: Daily 5 | branches: 6 | include: 7 | - main 8 | always: true 9 | 10 | trigger: none 11 | pr: 12 | autoCancel: true 13 | branches: 14 | include: 15 | - main 16 | 17 | jobs: 18 | - template: image-generation.yml 19 | parameters: 20 | image_label: 'macOS Monterey' 21 | base_image_name: 'clean-macOS-12-380Gb-runner' 22 | template_path: 'templates/macOS-12.json' 23 | target_datastore: 'ds-image' 24 | -------------------------------------------------------------------------------- /images/macos/provision/core/rubygem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | # Temporarily downgrade RubyGems version to 3.2.33 due to issue with RubyGems 3.3.3 (https://github.com/actions/virtual-environments-internal/issues/3162) 5 | echo Updating RubyGems... 6 | gem update --system 3.2.33 7 | 8 | gemsToInstall=$(get_toolset_value '.ruby.rubygems | .[]') 9 | if [ -n "$gemsToInstall" ]; then 10 | for gem in $gemsToInstall; do 11 | echo "Installing gem $gem" 12 | gem install $gem 13 | done 14 | fi 15 | 16 | invoke_tests "RubyGem" 17 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1: -------------------------------------------------------------------------------- 1 | #################################################################################### 2 | ## File: Install-AzureCosmosDbEmulator.ps1 3 | ## Desc: Install Azure CosmosDb Emulator 4 | #################################################################################### 5 | 6 | $InstallerName = "AzureCosmosDBEmulator.msi" 7 | $InstallerUrl = "https://aka.ms/cosmosdb-emulator" 8 | 9 | Install-Binary -Url $InstallerUrl -Name $InstallerName 10 | 11 | Invoke-PesterTests -TestFile "Tools" -TestName "Azure Cosmos DB Emulator" -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-SQLOLEDBDriver.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-SQLOLEDBDriver.ps1 3 | ## Desc: Install SQL OLEDB Driver 4 | ################################################################################ 5 | 6 | $binaryDownloadPath = Start-DownloadWithRetry "https://go.microsoft.com/fwlink/?linkid=2183083" "msoledbsql.msi" 7 | $ArgumentList = ("/i", "$binaryDownloadPath", "ADDLOCAL=ALL", "IACCEPTMSOLEDBSQLLICENSETERMS=YES", "/qn") 8 | Install-Binary -FilePath msiexec.exe -ArgumentList $ArgumentList -------------------------------------------------------------------------------- /images/linux/scripts/installers/docker-compose.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: docker-compose.sh 4 | ## Desc: Installs Docker Compose 5 | ################################################################################ 6 | 7 | # Install docker-compose v1 from releases 8 | URL="https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64" 9 | curl -L $URL -o /usr/local/bin/docker-compose 10 | chmod +x /usr/local/bin/docker-compose 11 | 12 | invoke_tests "Tools" "Docker-compose v1" 13 | -------------------------------------------------------------------------------- /images/macos/provision/core/swiftlint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo "Install SwiftLint" 5 | swiftlintUrl=$(get_github_package_download_url "realm/SwiftLint" "contains(\"portable_swiftlint.zip\")" "latest" "$API_PAT") 6 | download_with_retries $swiftlintUrl "/tmp" "portable_swiftlint.zip" 7 | unzip -q "/tmp/portable_swiftlint.zip" -d /usr/local/bin 8 | # Remove the LICENSE file that comes along with the binary and the downloaded archive 9 | rm -rf "/usr/local/bin/LICENSE" 10 | rm -rf "/tmp/portable_swiftlint.zip" 11 | 12 | invoke_tests "Linters" "SwiftLint" 13 | -------------------------------------------------------------------------------- /images/linux/scripts/base/snap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Put snapd auto refresh on hold 4 | # as it may generate too much traffic on Canonical's snap server 5 | # when they are rolling a new major update out. 6 | # Hold is calculated as today's date + 60 days 7 | 8 | # snapd is started automatically, but during image generation 9 | # a unix socket may die, restart snapd.service (and therefore snapd.socket) 10 | # to make sure the socket is alive. 11 | 12 | systemctl restart snapd.socket 13 | systemctl restart snapd 14 | snap set system refresh.hold="$(date --date='today+60 days' +%Y-%m-%dT%H:%M:%S%:z)" 15 | -------------------------------------------------------------------------------- /images/macos/provision/core/vcpkg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | # Set env variable for vcpkg 5 | VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg 6 | echo "export VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a ~/.bashrc 7 | 8 | # Install vcpkg 9 | git clone https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT 10 | $VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh 11 | $VCPKG_INSTALLATION_ROOT/vcpkg integrate install 12 | chmod -R 0777 $VCPKG_INSTALLATION_ROOT 13 | ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin 14 | 15 | invoke_tests "Common" "vcpkg" 16 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-LLVM.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-LLVM.ps1 3 | ## Desc: Install the latest stable version of llvm and clang compilers 4 | ################################################################################ 5 | 6 | $llvmVersion = (Get-ToolsetContent).llvm.version 7 | $latestChocoVersion = Get-LatestChocoPackageVersion -TargetVersion $llvmVersion -PackageName "llvm" 8 | Choco-Install -PackageName llvm -ArgumentList '--version', $latestChocoVersion 9 | 10 | Invoke-PesterTests -TestFile "LLVM" 11 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Sbt.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Sbt.ps1 3 | ## Desc: Install sbt for Windows 4 | ################################################################################ 5 | 6 | # Install the latest version of sbt. 7 | # See https://chocolatey.org/packages/sbt 8 | Choco-Install -PackageName sbt 9 | 10 | $env:SBT_HOME="${env:ProgramFiles(x86)}\sbt" 11 | 12 | # Add sbt binaries to the path 13 | Add-MachinePathItem "$env:SBT_HOME\bin" 14 | 15 | Invoke-PesterTests -TestFile "Tools" -TestName "Sbt" 16 | -------------------------------------------------------------------------------- /images/macos/provision/core/mongodb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | # MongoDB object-value database 5 | # Install latest release version of MongoDB Community Edition 6 | # https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x 7 | toolsetVersion=$(get_toolset_value '.mongodb.version') 8 | 9 | brew tap mongodb/brew 10 | versionToInstall=$(brew search --formulae /mongodb-community@$toolsetVersion/ | awk -F'/' '{print $3}' | tail -1) 11 | echo "Installing mongodb $versionToInstall" 12 | brew_smart_install "$versionToInstall" 13 | 14 | invoke_tests "Databases" "MongoDB" 15 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Windows2016/Install-Win81SDK.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Win81SDK.ps1 3 | ## Desc: Install Windows 8.1 SDK 4 | ################################################################################ 5 | 6 | $InstallerName = "sdksetup.exe" 7 | $InstallerUrl = "http://download.microsoft.com/download/B/0/C/B0C80BA3-8AD6-4958-810B-6882485230B5/standalonesdk/${InstallerName}" 8 | $ArgumentList = ("/quiet", "/norestart") 9 | 10 | Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList 11 | -------------------------------------------------------------------------------- /images.CI/macos/azure-pipelines/macos1015.yml: -------------------------------------------------------------------------------- 1 | name: macOS-10.15_$(date:yyyyMMdd)$(rev:.r)_unstable 2 | schedules: 3 | - cron: "0 0 * * *" 4 | displayName: Daily 5 | branches: 6 | include: 7 | - main 8 | always: true 9 | 10 | trigger: none 11 | pr: 12 | autoCancel: true 13 | branches: 14 | include: 15 | - main 16 | 17 | jobs: 18 | - template: image-generation.yml 19 | parameters: 20 | image_label: 'macOS Catalina' 21 | base_image_name: 'clean-macOS-10.15-380Gb-runner' 22 | template_path: 'templates/macOS-10.15.json' 23 | target_datastore: 'ds-image' 24 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/apache.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: apache.sh 4 | ## Desc: Installs Apache HTTP Server 5 | ################################################################################ 6 | 7 | # Install Apache 8 | apt-get install apache2 -y 9 | 10 | if [[ ! -f /run/systemd/container ]]; then 11 | # Disable apache2.service 12 | systemctl is-active --quiet apache2.service && systemctl stop apache2.service 13 | systemctl disable apache2.service 14 | fi 15 | 16 | invoke_tests "WebServers" "Apache" 17 | -------------------------------------------------------------------------------- /images/macos/provision/core/node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | defaultVersion=$(get_toolset_value '.node.default') 5 | 6 | echo "Installing Node.js $defaultVersion" 7 | brew_smart_install "node@$defaultVersion" 8 | brew link node@$defaultVersion --force 9 | 10 | echo Installing yarn... 11 | curl -o- -L https://yarnpkg.com/install.sh | bash 12 | 13 | npm_global_packages=$(get_toolset_value '.npm.global_packages[].name') 14 | for module in ${npm_global_packages[@]}; do 15 | echo "Install $module" 16 | npm install -g $module 17 | done 18 | 19 | invoke_tests "Node" "Node.js" 20 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/PHP.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "PHP" { 2 | It "Check PHP version" { 3 | $phpMajorMinor = (Get-ToolsetContent).php.version 4 | $phpInstalledVersion = php --version | Select-String -Pattern "PHP $phpMajorMinor" 5 | $phpInstalledVersion | Should -BeLike "*${phpMajorMinor}*" 6 | } 7 | 8 | It "Check Composer in the PATH" { 9 | "composer --version" | Should -ReturnZeroExitCode 10 | } 11 | 12 | It "PHP Environment variables is set." { 13 | ${env:PHPROOT} | Should -Not -BeNullOrEmpty 14 | ${env:PHPROOT} | Should -Exist 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-PipxPackages.ps1: -------------------------------------------------------------------------------- 1 | $pipxToolset = (Get-ToolsetContent).pipx 2 | foreach($tool in $pipxToolset) { 3 | if ($tool.python) { 4 | $pythonPath = (Get-Item -Path "${env:AGENT_TOOLSDIRECTORY}\Python\${tool.python}.*\x64\python-${tool.python}*").FullName 5 | Write-Host "Install ${tool.package} into python ${tool.python}" 6 | pipx install $tool.package --python $pythonPath 7 | } else { 8 | Write-Host "Install ${tool.package} into default python" 9 | pipx install $tool.package 10 | } 11 | } 12 | Invoke-PesterTests -TestFile "PipxPackages" -------------------------------------------------------------------------------- /images/macos/provision/core/rust.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo Installing Rustup... 5 | brew_smart_install "rustup-init" 6 | 7 | echo Installing Rust language... 8 | rustup-init -y --no-modify-path --default-toolchain=stable --profile=minimal 9 | 10 | echo Initialize environment variables... 11 | CARGO_HOME=$HOME/.cargo 12 | 13 | echo Install common tools... 14 | rustup component add rustfmt clippy 15 | cargo install --locked bindgen cbindgen cargo-audit cargo-outdated 16 | 17 | echo Cleanup Cargo registry cached data... 18 | rm -rf $CARGO_HOME/registry/* 19 | 20 | invoke_tests "Rust" 21 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/mssql-cmd-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: mssql-cmd-tools.sh 4 | ## Desc: Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017) 5 | ################################################################################ 6 | 7 | export ACCEPT_EULA=Y 8 | 9 | apt-get update 10 | apt-get install -y mssql-tools unixodbc-dev 11 | apt-get -f install 12 | ln -s /opt/mssql-tools/bin/* /usr/local/bin/ 13 | 14 | invoke_tests "Tools" "MSSQLCommandLineTools" -------------------------------------------------------------------------------- /images/linux/scripts/helpers/os.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: install-helpers.sh 4 | ## Desc: Helper functions for installing tools 5 | ################################################################################ 6 | 7 | function isUbuntu18 8 | { 9 | lsb_release -d | grep -q 'Ubuntu 18' 10 | } 11 | 12 | function isUbuntu20 13 | { 14 | lsb_release -d | grep -q 'Ubuntu 20' 15 | } 16 | 17 | function isUbuntu22 18 | { 19 | lsb_release -d | grep -q 'Ubuntu 22' 20 | } 21 | 22 | function getOSVersionLabel 23 | { 24 | lsb_release -cs 25 | } -------------------------------------------------------------------------------- /images/win/scripts/Installers/Wait-WindowsUpdatesForInstall.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Wait-WindowsUpdatesForInstall.ps1 3 | ## Desc: Wait for installation windows updates to complete 4 | ################################################################################ 5 | 6 | Invoke-SBWithRetry -RetryCount 10 -RetryIntervalSeconds 120 -Command { 7 | $inProgress = Get-WindowsUpdatesHistory | Where-Object Status -eq "InProgress" 8 | if ( $inProgress ) { 9 | $title = $inProgress.Title -join "`n" 10 | throw "InProgress: $title" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/bazel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: bazel.sh 4 | ## Desc: Installs Bazel and Bazelisk (A user-friendly launcher for Bazel) 5 | ################################################################################ 6 | # shellcheck source=/images/linux/scripts/helpers/install.sh 7 | source "$HELPER_SCRIPTS"/install.sh 8 | 9 | # Install bazelisk 10 | npm install -g @bazel/bazelisk 11 | 12 | # run bazelisk once in order to instal /usr/local/bin/bazel binary 13 | sudo -u $SUDO_USER bazel version 14 | 15 | invoke_tests "Tools" "Bazel" 16 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/complete-snap-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: snap-environment.sh 4 | ## Desc: Update /etc/environment to include /snap/bin in PATH 5 | ## because /etc/profile.d is ignored by `--norc` shell launch option 6 | ################################################################################ 7 | 8 | # Source the helpers 9 | # shellcheck source=/images/linux/scripts/helpers/etc-environment.sh 10 | source "$HELPER_SCRIPTS"/etc-environment.sh 11 | 12 | # Update /etc/environemnt 13 | prependEtcEnvironmentPath "/snap/bin" 14 | -------------------------------------------------------------------------------- /images/macos/provision/core/homebrew.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | source ~/utils/utils.sh 4 | 5 | echo "Installing Homebrew..." 6 | HOMEBREW_INSTALL_URL="https://raw.githubusercontent.com/Homebrew/install/master/install.sh" 7 | /bin/bash -c "$(curl -fsSL ${HOMEBREW_INSTALL_URL})" 8 | 9 | echo "Disabling Homebrew analytics..." 10 | brew analytics off 11 | 12 | # jq is required for further installation scripts 13 | echo "Installing jq..." 14 | brew install jq 15 | 16 | echo "Installing curl..." 17 | brew install curl 18 | 19 | echo "Installing wget..." 20 | brew_smart_install "wget" 21 | 22 | # init brew bundle feature 23 | brew tap Homebrew/bundle -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-WebPlatformInstaller.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-WebPI.ps1 3 | ## Desc: Install WebPlatformInstaller 4 | ################################################################################ 5 | 6 | # Download and install WebPlatformInstaller 7 | $webPlatformInstallerFile = "WebPlatformInstaller_x64_en-US.msi" 8 | $webPlatformInstallerUrl = "http://go.microsoft.com/fwlink/?LinkId=287166" 9 | Install-Binary -Url $webPlatformInstallerUrl -Name $webPlatformInstallerFile 10 | 11 | Invoke-PesterTests -TestFile "Tools" -TestName "WebPlatformInstaller" -------------------------------------------------------------------------------- /images/win/scripts/Installers/Configure-GDIProcessHandleQuota.ps1: -------------------------------------------------------------------------------- 1 | # https://docs.microsoft.com/en-us/windows/win32/sysinfo/gdi-objects 2 | # This value can be set to a number between 256 and 65,536 3 | 4 | $defaultValue = 20000 5 | Write-Host "Set the GDIProcessHandleQuota value to $defaultValue" 6 | Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows" -Name GDIProcessHandleQuota -Value $defaultValue 7 | Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Windows" -Name GDIProcessHandleQuota -Value $defaultValue 8 | 9 | Invoke-PesterTests -TestFile "WindowsFeatures" -TestName "GDIProcessHandleQuota" 10 | -------------------------------------------------------------------------------- /images/linux/scripts/tests/Node.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Node.js" { 2 | $binaries = @("node") 3 | $module_commands = (Get-ToolsetContent).node_modules | ForEach-Object { $_.command } 4 | $testCases = $binaries + $module_commands | ForEach-Object { @{NodeCommand = $_ } } 5 | 6 | It "" -TestCases $testCases { 7 | param ( 8 | [string] $NodeCommand 9 | ) 10 | 11 | "$NodeCommand --version" | Should -ReturnZeroExitCode 12 | } 13 | 14 | It "Node.js version should correspond to the version in the toolset" { 15 | node --version | Should -BeLike "v$((Get-ToolsetContent).node.default).*" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/sbt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: scala.sh 4 | ## Desc: Installs sbt 5 | ################################################################################ 6 | 7 | # shellcheck source=/images/linux/scripts/helpers/install.sh 8 | source "$HELPER_SCRIPTS"/install.sh 9 | 10 | # Install latest sbt release 11 | downloadUrl=$(get_github_package_download_url "sbt/sbt" "endswith(\".tgz\")") 12 | download_with_retries "$downloadUrl" "/tmp" "sbt.tgz" 13 | tar zxf /tmp/sbt.tgz -C /usr/share 14 | ln -s /usr/share/sbt/bin/sbt /usr/bin/sbt 15 | 16 | invoke_tests "Tools" "Sbt" 17 | -------------------------------------------------------------------------------- /images/macos/provision/bootstrap-provisioner/change_password: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | USERNAME="$1" 3 | OLD_PASSWD="$2" 4 | NEW_PASSWD="$3" 5 | UPDATE_LOGIN_KEYCHAIN="${4:-true}" 6 | 7 | sudo /usr/sbin/sysadminctl -resetPasswordFor $USERNAME -newPassword "$NEW_PASSWD" -adminUser $USERNAME -adminPassword "$OLD_PASSWD" 8 | sudo /usr/bin/python3 /Users/$USERNAME/bootstrap/kcpassword.py "$NEW_PASSWD" 9 | sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "$USERNAME" 10 | 11 | if [[ $UPDATE_LOGIN_KEYCHAIN == "true" ]]; then 12 | /usr/bin/security set-keychain-password -o "$OLD_PASSWD" -p "$NEW_PASSWD" /Users/$USERNAME/Library/Keychains/login.keychain 13 | fi 14 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/kotlin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: kotlin.sh 4 | ## Desc: Installs Kotlin 5 | ################################################################################ 6 | 7 | source $HELPER_SCRIPTS/install.sh 8 | 9 | KOTLIN_ROOT="/usr/share" 10 | downloadUrl=$(get_github_package_download_url "JetBrains/kotlin" "contains(\"kotlin-compiler\")") 11 | download_with_retries "$downloadUrl" "/tmp" 12 | 13 | unzip -qq /tmp/kotlin-compiler*.zip -d $KOTLIN_ROOT 14 | rm $KOTLIN_ROOT/kotlinc/bin/*.bat 15 | ln -sf $KOTLIN_ROOT/kotlinc/bin/* /usr/bin 16 | 17 | invoke_tests "Tools" "Kotlin" -------------------------------------------------------------------------------- /images/macos/tests/PHP.Tests.ps1: -------------------------------------------------------------------------------- 1 | $os = Get-OSVersion 2 | 3 | Describe "PHP" { 4 | Context "PHP" { 5 | It "PHP Path" { 6 | Get-WhichTool "php" | Should -Not -BeLike "/usr/bin/php*" 7 | } 8 | It "PHP version" { 9 | $phpVersionToolset = Get-ToolsetValue 'php.version' 10 | $phpInstalledVersion = php --version | Out-String | Select-String "${phpVersionToolset}" 11 | $phpInstalledVersion | Should -BeLike "PHP ${phpVersionToolset}*" 12 | } 13 | } 14 | 15 | Context "Composer" { 16 | It "Composer" { 17 | "composer --version" | Should -ReturnZeroExitCode 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /images/linux/scripts/base/repos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: repos.sh 4 | ## Desc: Installs official Microsoft package repos for the distribution 5 | ################################################################################ 6 | 7 | LSB_RELEASE=$(lsb_release -rs) 8 | 9 | # Install Microsoft repository 10 | wget https://packages.microsoft.com/config/ubuntu/$LSB_RELEASE/packages-microsoft-prod.deb 11 | dpkg -i packages-microsoft-prod.deb 12 | 13 | # update 14 | apt-get install -y apt-transport-https ca-certificates curl software-properties-common 15 | apt-get -yq update 16 | apt-get -yq dist-upgrade 17 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-NSIS.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-NSIS.ps1 3 | ## Desc: Install NSIS 4 | ################################################################################ 5 | 6 | $NsisVersion = (Get-ToolsetContent).nsis.version 7 | Install-Binary -Url "https://downloads.sourceforge.net/project/nsis/NSIS%203/${NsisVersion}/nsis-${NsisVersion}-setup.exe" -Name "nsis-${NsisVersion}-setup.exe" -ArgumentList ('/S') 8 | 9 | $NsisPath = "${env:ProgramFiles(x86)}\NSIS\" 10 | Add-MachinePathItem $NsisPath 11 | $env:Path = Get-MachinePath 12 | 13 | Invoke-PesterTests -TestFile "Tools" -TestName "NSIS" 14 | -------------------------------------------------------------------------------- /images/linux/scripts/tests/Browsers.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Firefox" -Skip:(Test-IsUbuntu22) { 2 | It "Firefox" { 3 | "sudo -i firefox --version" | Should -ReturnZeroExitCode 4 | } 5 | 6 | It "Geckodriver" { 7 | "geckodriver --version" | Should -ReturnZeroExitCode 8 | } 9 | } 10 | 11 | Describe "Chrome" { 12 | It "Chrome" { 13 | "google-chrome --version" | Should -ReturnZeroExitCode 14 | } 15 | 16 | It "Chrome Driver" { 17 | "chromedriver --version" | Should -ReturnZeroExitCode 18 | } 19 | } 20 | 21 | Describe "Chromium" { 22 | It "Chromium" { 23 | "chromium-browser --version" | Should -ReturnZeroExitCode 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/miniconda.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: miniconda.sh 4 | ## Desc: Installs miniconda 5 | ################################################################################ 6 | 7 | # Install Miniconda 8 | curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \ 9 | && chmod +x miniconda.sh \ 10 | && ./miniconda.sh -b -p /usr/share/miniconda \ 11 | && rm miniconda.sh 12 | 13 | CONDA=/usr/share/miniconda 14 | echo "CONDA=$CONDA" | tee -a /etc/environment 15 | 16 | ln -s $CONDA/bin/conda /usr/bin/conda 17 | 18 | invoke_tests "Tools" "Conda" -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Description 2 | New tool, Bug fixing, or Improvement? 3 | Please include a summary of the change and which issue is fixed. Also include relevant motivation and context. 4 | **For new tools, please provide total size and installation time.** 5 | 6 | 7 | 8 | #### Related issue: 9 | 10 | ## Check list 11 | - [ ] Related issue / work item is attached 12 | - [ ] Tests are written (if applicable) 13 | - [ ] Documentation is updated (if applicable) 14 | - [ ] Changes are tested and related VM images are successfully generated 15 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/bicep.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: bicep.sh 4 | ## Desc: Installs bicep cli 5 | ################################################################################ 6 | # shellcheck source=/images/linux/scripts/helpers/install.sh 7 | source "$HELPER_SCRIPTS"/install.sh 8 | 9 | # Install Bicep CLI 10 | download_with_retries "https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64" "." "bicep.bin" 11 | # Mark it as executable 12 | chmod +x ./bicep.bin 13 | # Add bicep to PATH (requires admin) 14 | sudo mv ./bicep.bin /usr/local/bin/bicep 15 | 16 | invoke_tests "Tools" "Bicep" 17 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/packer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: packer.sh 4 | ## Desc: Installs packer 5 | ################################################################################ 6 | 7 | source $HELPER_SCRIPTS/install.sh 8 | 9 | # Install Packer 10 | URL=$(curl -s https://api.releases.hashicorp.com/v1/releases/packer/latest | jq -r '.builds[] | select((.arch=="amd64") and (.os=="linux")).url') 11 | ZIP_NAME="packer_linux_amd64.zip" 12 | download_with_retries "${URL}" "/tmp" "${ZIP_NAME}" 13 | unzip -qq "/tmp/${ZIP_NAME}" -d /usr/local/bin 14 | rm -f "/tmp/${ZIP_NAME}" 15 | 16 | invoke_tests "Tools" "Packer" -------------------------------------------------------------------------------- /images/macos/tests/OpenSSL.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "OpenSSL" { 2 | Context "OpenSSL Version" { 3 | It "OpenSSL is available" { 4 | "openssl version" | Should -ReturnZeroExitCode 5 | } 6 | } 7 | 8 | Context "OpenSSL 1.1 Path Check" { 9 | It "OpenSSL 1.1 path exists" { 10 | $openSSLpath = "/usr/local/opt/openssl@1.1" 11 | $openSSLpath | Should -Exist 12 | } 13 | } 14 | 15 | Context "OpenSSL 1.1 is default" { 16 | It "Default OpenSSL version is 1.1" { 17 | $commandResult = Get-CommandResult "openssl version" 18 | $commandResult.Output | Should -Match "OpenSSL 1.1" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /images/linux/scripts/installers/r.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Source the helpers for use with the script 4 | # shellcheck source=/images/linux/scripts/helpers/os.sh 5 | source "$HELPER_SCRIPTS"/os.sh 6 | 7 | # install R 8 | osLabel=$(getOSVersionLabel) 9 | 10 | wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | gpg --dearmor > /usr/share/keyrings/rlang.gpg 11 | echo "deb [signed-by=/usr/share/keyrings/rlang.gpg] https://cloud.r-project.org/bin/linux/ubuntu $osLabel-cran40/" > /etc/apt/sources.list.d/rlang.list 12 | 13 | apt-get update 14 | apt-get install r-base 15 | 16 | rm /etc/apt/sources.list.d/rlang.list 17 | rm /usr/share/keyrings/rlang.gpg 18 | 19 | invoke_tests "Tools" "R" 20 | -------------------------------------------------------------------------------- /images/macos/provision/core/miniconda.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | MINICONDA_INSTALLER="/tmp/miniconda.sh" 4 | curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o $MINICONDA_INSTALLER 5 | chmod +x $MINICONDA_INSTALLER 6 | sudo $MINICONDA_INSTALLER -b -p /usr/local/miniconda 7 | 8 | # Chmod with full permissions recursively to avoid permissions restrictions 9 | sudo chmod -R 777 /usr/local/miniconda 10 | 11 | sudo ln -s /usr/local/miniconda/bin/conda /usr/local/bin/conda 12 | 13 | if [ -d "$HOME/.conda" ]; then 14 | sudo chown -R $USER "$HOME/.conda" 15 | fi 16 | 17 | echo "export CONDA=/usr/local/miniconda" >> $HOME/.bashrc 18 | 19 | invoke_tests "Common" "Miniconda" 20 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-GoogleCloudSDK.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-GoogleCloudSDK.ps1 3 | ## Desc: Install Google Cloud SDK 4 | ################################################################################ 5 | 6 | # https://cloud.google.com/sdk/docs/downloads-interactive 7 | $googleCloudSDKInstaller = "https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe" 8 | $argumentList = @("/S", "/allusers", "/noreporting") 9 | Install-Binary -Url $googleCloudSDKInstaller -Name "GoogleCloudSDKInstaller.exe" -ArgumentList $argumentList 10 | 11 | Invoke-PesterTests -TestFile "Tools" -TestName "GoogleCloudSDK" 12 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-NET48.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-NET48.ps1 3 | ## Desc: Install .NET 4.8 4 | ################################################################################ 5 | 6 | # .NET 4.8 Dev pack 7 | $InstallerName = "ndp48-devpack-enu.exe" 8 | $InstallerUrl = "https://download.visualstudio.microsoft.com/download/pr/014120d7-d689-4305-befd-3cb711108212/0307177e14752e359fde5423ab583e43/${InstallerName}" 9 | $ArgumentList = ("Setup", "/passive", "/norestart") 10 | 11 | Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList 12 | 13 | Invoke-PesterTests -TestFile "Tools" -TestName "NET48" -------------------------------------------------------------------------------- /images/linux/scripts/base/limits.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | echo 'session required pam_limits.so' >>/etc/pam.d/common-session 4 | echo 'session required pam_limits.so' >>/etc/pam.d/common-session-noninteractive 5 | if [[ ! -f /run/systemd/container ]]; then 6 | echo 'DefaultLimitNOFILE=65536' >>/etc/systemd/system.conf 7 | echo 'DefaultLimitSTACK=16M:infinity' >>/etc/systemd/system.conf 8 | fi 9 | 10 | # Raise Number of File Descriptors 11 | echo '* soft nofile 65536' >>/etc/security/limits.conf 12 | echo '* hard nofile 65536' >>/etc/security/limits.conf 13 | 14 | # Double stack size from default 8192KB 15 | echo '* soft stack 16384' >>/etc/security/limits.conf 16 | echo '* hard stack 16384' >>/etc/security/limits.conf 17 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/terraform.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: terraform.sh 4 | ## Desc: Installs terraform 5 | ################################################################################ 6 | 7 | source $HELPER_SCRIPTS/install.sh 8 | 9 | # Install Terraform 10 | URL=$(curl -s https://api.releases.hashicorp.com/v1/releases/terraform/latest | jq -r '.builds[] | select((.arch=="amd64") and (.os=="linux")).url') 11 | ZIP_NAME="terraform_linux_amd64.zip" 12 | download_with_retries "${URL}" "/tmp" "${ZIP_NAME}" 13 | unzip -qq "/tmp/${ZIP_NAME}" -d /usr/local/bin 14 | rm -f "/tmp/${ZIP_NAME}" 15 | 16 | invoke_tests "Tools" "Terraform" -------------------------------------------------------------------------------- /images/linux/scripts/installers/basic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: basic.sh 4 | ## Desc: Installs basic command line utilities and dev packages 5 | ################################################################################ 6 | # shellcheck source=/images/linux/scripts/helpers/install.sh 7 | source "$HELPER_SCRIPTS"/install.sh 8 | 9 | common_packages=$(get_toolset_value .apt.common_packages[]) 10 | cmd_packages=$(get_toolset_value .apt.cmd_packages[]) 11 | for package in $common_packages $cmd_packages; do 12 | echo "Install $package" 13 | apt-get install -y --no-install-recommends "$package" 14 | done 15 | 16 | invoke_tests "Apt" 17 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/oc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: oc.sh 4 | ## Desc: Installs the OC CLI 5 | ################################################################################ 6 | 7 | # shellcheck source=/images/linux/scripts/helpers/install.sh 8 | source "$HELPER_SCRIPTS"/install.sh 9 | 10 | # Install the oc CLI 11 | DOWNLOAD_URL="https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz" 12 | PACKAGE_TAR_NAME="oc.tar.gz" 13 | download_with_retries $DOWNLOAD_URL "/tmp" $PACKAGE_TAR_NAME 14 | tar xzf "/tmp/$PACKAGE_TAR_NAME" -C "/usr/local/bin" oc 15 | 16 | invoke_tests "CLI.Tools" "OC CLI" 17 | -------------------------------------------------------------------------------- /images/macos/provision/assets/select-xamarin-sdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | if [ -z "$1" ]; then 3 | echo "No Xamarin SDK specified." 4 | exit 0 5 | fi 6 | 7 | XAMARIN_SDK=$1 8 | 9 | echo "Set Xamarin SDK to ${XAMARIN_SDK}" 10 | FOLDERS_LIST=( 11 | '/Library/Frameworks/Mono.framework/Versions' 12 | '/Library/Frameworks/Xamarin.iOS.framework/Versions' 13 | '/Library/Frameworks/Xamarin.Android.framework/Versions' 14 | '/Library/Frameworks/Xamarin.Mac.framework/Versions' 15 | ) 16 | 17 | for FOLDER in "${FOLDERS_LIST[@]}" 18 | do 19 | echo "Set Current folder for ${FOLDER}" 20 | sudo rm -f ${FOLDER}/Current 21 | sudo ln -s ${FOLDER}/${XAMARIN_SDK} ${FOLDER}/Current 22 | done 23 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/aliyun-cli.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: aliyun-cli.sh 4 | ## Desc: Installs Alibaba Cloud CLI 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/install.sh 9 | source "$HELPER_SCRIPTS"/install.sh 10 | 11 | # Install Alibaba Cloud CLI 12 | downloadUrl="https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz" 13 | download_with_retries $downloadUrl "/tmp" 14 | tar xzf /tmp/aliyun-cli-linux-*-amd64.tgz 15 | mv aliyun /usr/local/bin 16 | 17 | invoke_tests "CLI.Tools" "Aliyun CLI" 18 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/azure-devops-cli.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: azure-devops-cli.sh 4 | ## Desc: Installed Azure DevOps CLI (az devops) 5 | ################################################################################ 6 | 7 | # AZURE_EXTENSION_DIR shell variable defines where modules are installed 8 | # https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview 9 | export AZURE_EXTENSION_DIR=/opt/az/azcliextensions 10 | echo "AZURE_EXTENSION_DIR=$AZURE_EXTENSION_DIR" | tee -a /etc/environment 11 | 12 | # install azure devops Cli extension 13 | az extension add -n azure-devops 14 | 15 | invoke_tests "CLI.Tools" "Azure DevOps CLI" -------------------------------------------------------------------------------- /images/linux/scripts/installers/azure-cli.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: azure-cli.sh 4 | ## Desc: Installed Azure CLI (az) 5 | ################################################################################ 6 | 7 | # Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) 8 | curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash 9 | echo "azure-cli https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt" >> "$HELPER_SCRIPTS"/apt-sources.txt 10 | rm -f /etc/apt/sources.list.d/azure-cli.list 11 | rm -f /etc/apt/sources.list.d/azure-cli.list.save 12 | 13 | invoke_tests "CLI.Tools" "Azure CLI" 14 | -------------------------------------------------------------------------------- /images/macos/tests/Databases.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "MongoDB" { 2 | It "" -TestCases @( 3 | @{ ToolName = "mongo" } 4 | @{ ToolName = "mongod" } 5 | ) { 6 | $toolsetVersion = Get-ToolsetValue 'mongodb.version' 7 | (&$ToolName --version)[2].Split('"')[-2] | Should -BeLike "$toolsetVersion*" 8 | } 9 | } 10 | 11 | Describe "PostgreSQL" { 12 | It "PostgreSQL version should correspond to the version in the toolset" { 13 | $toolsetVersion = Get-ToolsetValue 'postgresql.version' 14 | # Client version 15 | (psql --version).split()[-1] | Should -BeLike "$toolsetVersion*" 16 | # Server version 17 | (pg_config --version).split()[-1] | Should -BeLike "$toolsetVersion*" 18 | } 19 | } -------------------------------------------------------------------------------- /images/linux/scripts/installers/leiningen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: leiningen.sh 4 | ## Desc: Installs Leiningen 5 | ################################################################################ 6 | 7 | LEIN_BIN=/usr/local/bin/lein 8 | curl -s https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > $LEIN_BIN 9 | chmod 0755 $LEIN_BIN 10 | 11 | # Run lein to trigger self-install 12 | export LEIN_HOME=/usr/local/lib/lein 13 | lein 14 | 15 | LEIN_JAR=$(find $LEIN_HOME -name "leiningen-*-standalone.jar") 16 | echo "LEIN_JAR=$LEIN_JAR" | tee -a /etc/environment 17 | echo "LEIN_HOME=$LEIN_HOME" | tee -a /etc/environment 18 | 19 | invoke_tests "Tools" "Leiningen" -------------------------------------------------------------------------------- /images/macos/provision/core/graalvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo Installing GraalVM... 5 | brew install --cask graalvm/tap/graalvm-ce-java11 6 | 7 | exportPath=$(echo /Library/Java/JavaVirtualMachines/graalvm-ce-java*/Contents/Home/bin) 8 | echo "Setting up GRAALVM_11_ROOT variable to ${exportPath}" 9 | echo "export GRAALVM_11_ROOT=${exportPath}" >> "${HOME}/.bashrc" 10 | 11 | # GraalVM not being signed and notarized yet on macOS Catalina 12 | if is_Catalina; then 13 | quarantinePath=$(echo /Library/Java/JavaVirtualMachines/graalvm-ce-java*) 14 | sudo xattr -rd com.apple.quarantine $quarantinePath 15 | fi 16 | 17 | # Install Native Image 18 | $exportPath/gu install native-image 19 | 20 | invoke_tests "Common" "GraalVM" -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-GitHub-CLI.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-GitHub-CLI.ps1 3 | ## Desc: Install GitHub CLI 4 | ################################################################################ 5 | 6 | Write-Host "Get the latest gh version..." 7 | 8 | $Name = "gh_windows_amd64.msi" 9 | $Assets = (Invoke-RestMethod -Uri "https://api.github.com/repos/cli/cli/releases/latest").assets 10 | $DownloadUrl = ($Assets.browser_download_url -match "windows_amd64.msi") | Select-Object -First 1 11 | 12 | Install-Binary -Url $DownloadUrl -Name $Name 13 | 14 | Add-MachinePathItem "C:\Program Files (x86)\GitHub CLI" 15 | 16 | Invoke-PesterTests -TestFile "CLI.Tools" -TestName "GitHub CLI" 17 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Update-DotnetTLS.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Update-DotnetTLS.ps1 3 | ## Desc: Update DotNetFramework security protocol to TLS 1.2 4 | ################################################################################ 5 | 6 | $registryPath = "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" 7 | $name = "SchUseStrongCrypto" 8 | $value = "1" 9 | if(Test-Path $registryPath){ 10 | Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD 11 | } 12 | 13 | $registryPath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" 14 | if(Test-Path $registryPath){ 15 | Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD 16 | } 17 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/validate-disk-space.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: validate-disk-space.sh 4 | ## Desc: Validate free disk space 5 | ################################################################################ 6 | 7 | availableSpaceMB=$(df / -hm | sed 1d | awk '{ print $4}') 8 | minimumFreeSpaceMB=15000 9 | 10 | echo "Available disk space: $availableSpaceMB MB" 11 | 12 | if [ "$RUN_VALIDATION" != "true" ]; then 13 | echo "Skipping validation disk space..." 14 | exit 0 15 | fi 16 | 17 | if [ "$availableSpaceMB" -le $minimumFreeSpaceMB ]; then 18 | echo "Not enough disk space on the image (minimum available space: $minimumFreeSpaceMB MB)" 19 | exit 1 20 | fi 21 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-MongoDB.ps1: -------------------------------------------------------------------------------- 1 | #################################################################################### 2 | ## File: Install-MongoDB.ps1 3 | ## Desc: Install MongoDB 4 | #################################################################################### 5 | 6 | $toolsetVersion = (Get-ToolsetContent).mongodb.version 7 | $latestChocoPackage = Get-LatestChocoPackageVersion -TargetVersion $toolsetVersion -PackageName "mongodb" 8 | Choco-Install -PackageName mongodb -ArgumentList "--version=$latestChocoPackage" 9 | $mongoPath = (Get-CimInstance Win32_Service -Filter "Name LIKE 'mongodb'").PathName 10 | $mongoBin = Split-Path -Path $mongoPath.split('"')[1] 11 | Add-MachinePathItem "$mongoBin" 12 | 13 | Invoke-PesterTests -TestFile "Databases" -TestName "MongoDB" -------------------------------------------------------------------------------- /images/linux/scripts/installers/azcopy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: azcopy.sh 4 | ## Desc: Installs AzCopy 5 | ################################################################################ 6 | 7 | # shellcheck source=/images/linux/scripts/helpers/install.sh 8 | source "$HELPER_SCRIPTS"/install.sh 9 | 10 | # Install AzCopy10 11 | download_with_retries "https://aka.ms/downloadazcopy-v10-linux" "/tmp" "azcopy.tar.gz" 12 | tar xzf /tmp/azcopy.tar.gz --strip-components=1 -C /tmp 13 | mv /tmp/azcopy /usr/local/bin/azcopy 14 | chmod +x /usr/local/bin/azcopy 15 | # Create azcopy 10 alias for backward compatibility 16 | ln -sf /usr/local/bin/azcopy /usr/local/bin/azcopy10 17 | 18 | invoke_tests "Tools" "azcopy" 19 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/vcpkg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: vcpkg.sh 4 | ## Desc: Installs vcpkg 5 | ################################################################################ 6 | 7 | # Set env variable for vcpkg 8 | VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg 9 | echo "VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a /etc/environment 10 | 11 | # Install vcpkg 12 | git clone https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT 13 | 14 | $VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh 15 | $VCPKG_INSTALLATION_ROOT/vcpkg integrate install 16 | chmod 0777 -R $VCPKG_INSTALLATION_ROOT 17 | ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin 18 | 19 | invoke_tests "Tools" "Vcpkg" 20 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Mingw64.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Mingw64.ps1 3 | ## Desc: Install GNU tools for Windows 4 | ################################################################################ 5 | 6 | $toolsetVersion = (Get-ToolsetContent).mingw.version 7 | Choco-Install -PackageName mingw -ArgumentList "--version=$toolsetVersion" 8 | 9 | # Make a copy of mingw32-make.exe to make.exe, which is a more discoverable name 10 | # and so the same command line can be used on Windows as on macOS and Linux 11 | $path = where.exe mingw32-make.exe | Get-Item 12 | Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe') 13 | 14 | Invoke-PesterTests -TestFile "Tools" -TestName "Mingw64" 15 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Nginx.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Nginx.ps1 3 | ## Desc: Install Nginx 4 | ################################################################################ 5 | 6 | # Stop w3svc service 7 | Stop-Service -Name w3svc | Out-Null 8 | 9 | # Install latest nginx in chocolatey 10 | $installDir = "C:\tools" 11 | Choco-Install -PackageName nginx -ArgumentList "--force", "--params", "/installLocation:$installDir /port:80" 12 | 13 | # Stop and disable Nginx service 14 | Stop-Service -Name nginx 15 | Set-Service nginx -StartupType Disabled 16 | 17 | # Start w3svc service 18 | Start-Service -Name w3svc | Out-Null 19 | 20 | # Invoke Pester Tests 21 | Invoke-PesterTests -TestFile "Nginx" 22 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-WinAppDriver.ps1: -------------------------------------------------------------------------------- 1 | #################################################################################### 2 | ## File: Install-WinAppDriver.ps1 3 | ## Desc: Install Windows Application Driver (WinAppDriver) 4 | #################################################################################### 5 | 6 | $LatestReleaseUrl = 'https://api.github.com/repos/microsoft/WinAppDriver/releases/latest' 7 | $InstallerUrl = (Invoke-RestMethod -Uri $LatestReleaseUrl).assets.browser_download_url 8 | $InstallerName = "WindowsApplicationDriver.msi" 9 | 10 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 11 | Install-Binary -Url $InstallerUrl -Name $InstallerName 12 | 13 | Invoke-PesterTests -TestFile "WinAppDriver" -TestName "WinAppDriver" 14 | -------------------------------------------------------------------------------- /images/macos/provision/core/pipx-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | export PATH="$PATH:/opt/pipx_bin" 5 | 6 | toolset=$(get_toolset_path) 7 | pipx_packages=$(jq -r ".pipx[] .package" $toolset) 8 | 9 | for package in $pipx_packages; do 10 | python_version=$(jq -r ".pipx[] | select(.package == \"$package\") .python" $toolset) 11 | if [ "$python_version" != "null" ]; then 12 | python_path="$HOME/hostedtoolcache/Python/$python_version*/x64/bin/python$python_version" 13 | echo "Install $package into python $python_path" 14 | pipx install $package --python $python_path 15 | else 16 | echo "Install $package into default python" 17 | pipx install $package 18 | fi 19 | done 20 | 21 | invoke_tests "PipxPackages" 22 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/Vsix.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Vsix" { 2 | $toolset = Get-ToolsetContent 3 | $requiredVsixs = $toolset.visualStudio.vsix 4 | 5 | $allPackages = (Get-VisualStudioInstance).Packages 6 | $testCases = $requiredVsixs | ForEach-Object { 7 | $vsix = Get-VsixExtenstionFromMarketplace -ExtensionMarketPlaceName $_ 8 | @{ 9 | VsixName = $vsix.ExtensionName 10 | VsixId = $vsix.VsixId 11 | AllPackages = $allPackages 12 | } 13 | } 14 | if ($testCases.Count -gt 0) { 15 | It "Extension is installed" -TestCases $testCases { 16 | $objVsix = $AllPackages | Where-Object { $_.id -eq $VsixId } 17 | $objVsix | Should -Not -BeNullOrEmpty 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /images/linux/scripts/installers/github-cli.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: github-cli.sh 4 | ## Desc: Installs GitHub CLI 5 | ## Must be run as non-root user after homebrew 6 | ################################################################################ 7 | 8 | # Source the helpers for use with the script 9 | # shellcheck source=/images/linux/scripts/helpers/install.sh 10 | source "$HELPER_SCRIPTS"/install.sh 11 | 12 | # Install GitHub CLI 13 | downloadUrl=$(get_github_package_download_url "cli/cli" "contains(\"linux\") and contains(\"amd64\") and contains(\".deb\")") 14 | download_with_retries $downloadUrl "/tmp" 15 | apt install /tmp/gh_*_linux_amd64.deb 16 | 17 | invoke_tests "CLI.Tools" "GitHub CLI" 18 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/oras-cli.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: oras-cli.sh 4 | ## Desc: Installs ORAS CLI 5 | ################################################################################ 6 | 7 | # shellcheck source=/images/linux/scripts/helpers/install.sh 8 | source "$HELPER_SCRIPTS"/install.sh 9 | 10 | # Determine latest ORAS CLI version 11 | ORAS_CLI_DOWNLOAD_URL=$(get_github_package_download_url "oras-project/oras" "endswith(\"linux_amd64.tar.gz\")") 12 | ORAS_CLI_ARCHIVE=$(basename "$ORAS_CLI_DOWNLOAD_URL") 13 | 14 | # Install ORAS CLI 15 | cd /tmp 16 | download_with_retries "$ORAS_CLI_DOWNLOAD_URL" 17 | tar xzf "$ORAS_CLI_ARCHIVE" -C /usr/local/bin oras 18 | 19 | invoke_tests "CLI.Tools" "Oras CLI" 20 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/pulumi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: pulumi.sh 4 | ## Desc: Installs Pulumi 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/install.sh 9 | source "$HELPER_SCRIPTS"/install.sh 10 | 11 | # Install Pulumi 12 | VERSION=$(curl --fail --silent -L "https://www.pulumi.com/latest-version") 13 | TARBALL_URL="https://get.pulumi.com/releases/sdk/pulumi-v${VERSION}-linux-x64.tar.gz" 14 | download_with_retries ${TARBALL_URL} "/tmp" pulumi-v${VERSION}.tar.gz 15 | tar --strip=1 -xf /tmp/pulumi-v${VERSION}.tar.gz -C /usr/local/bin 16 | 17 | invoke_tests "Tools" "Pulumi" 18 | -------------------------------------------------------------------------------- /images/macos/provision/core/safari.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | echo "Enabling safari driver..." 4 | # https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari 5 | # Safari’s executable is located at /usr/bin/safaridriver 6 | # Configure Safari to Enable WebDriver Support 7 | sudo safaridriver --enable 8 | 9 | echo "Enabling the 'Allow Remote Automation' option in Safari's Develop menu" 10 | mkdir -p $HOME/Library/WebDriver 11 | safari_plist="$HOME/Library/WebDriver/com.apple.Safari.plist" 12 | # "|| true" is needed to suppress exit code 1 in case if property or file doesn't exist 13 | /usr/libexec/PlistBuddy -c 'delete AllowRemoteAutomation' $safari_plist || true 14 | /usr/libexec/PlistBuddy -c 'add AllowRemoteAutomation bool true' $safari_plist 15 | 16 | invoke_tests "Browsers" "Safari" -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Apache.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Apache.ps1 3 | ## Desc: Install Apache HTTP Server 4 | ################################################################################ 5 | 6 | # Stop w3svc service 7 | Stop-Service -Name w3svc | Out-Null 8 | 9 | # Install latest apache in chocolatey 10 | $installDir = "C:\tools" 11 | Choco-Install -PackageName apache-httpd -ArgumentList "--force", "--params", "/installLocation:$installDir /port:80" 12 | 13 | # Stop and disable Apache service 14 | Stop-Service -Name Apache 15 | Set-Service Apache -StartupType Disabled 16 | 17 | # Start w3svc service 18 | Start-Service -Name w3svc | Out-Null 19 | 20 | # Invoke Pester Tests 21 | Invoke-PesterTests -TestFile "Apache" 22 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Vcpkg.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Vcpkg.ps1 3 | ## Desc: Install vcpkg 4 | ################################################################################ 5 | 6 | $Uri = 'https://github.com/Microsoft/vcpkg.git' 7 | $InstallDir = 'C:\vcpkg' 8 | $VcpkgExecPath = 'vcpkg.exe' 9 | 10 | git clone $Uri $InstallDir -q 11 | 12 | # Build and integrate vcpkg 13 | Invoke-Expression "$InstallDir\bootstrap-vcpkg.bat" 14 | Invoke-Expression "$InstallDir\$VcpkgExecPath integrate install" 15 | 16 | # Add vcpkg to system environment 17 | Add-MachinePathItem $InstallDir 18 | $env:Path = Get-MachinePath 19 | setx VCPKG_INSTALLATION_ROOT $InstallDir /M 20 | 21 | Invoke-PesterTests -TestFile "Tools" -TestName "Vcpkg" 22 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-AzureCli.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-AzureCli.ps1 3 | ## Desc: Install Azure CLI 4 | ################################################################################ 5 | 6 | Write-Host "Install the latest Azure CLI release" 7 | $azCliUrl = "https://aka.ms/installazurecliwindows" 8 | Install-Binary -Url $azCliUrl -Name "azure-cli.msi" 9 | 10 | $azureCliExtensionPath = Join-Path $Env:CommonProgramFiles 'AzureCliExtensionDirectory' 11 | $null = New-Item -ItemType "Directory" -Path $azureCliExtensionPath 12 | 13 | [Environment]::SetEnvironmentVariable("AZURE_EXTENSION_DIR", $azureCliExtensionPath, [System.EnvironmentVariableTarget]::Machine) 14 | 15 | Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Azure CLI" -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Miniconda.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Miniconda.ps1 3 | ## Desc: Install the latest version of Miniconda and set $env:CONDA 4 | ################################################################################ 5 | 6 | $CondaDestination = "C:\Miniconda" 7 | 8 | # Install the latest Miniconda 9 | $InstallerName = "Miniconda3-latest-Windows-x86_64.exe" 10 | $InstallerUrl = "https://repo.continuum.io/miniconda/${InstallerName}" 11 | $ArgumentList = ("/S", "/AddToPath=0", "/RegisterPython=0", "/D=$CondaDestination") 12 | 13 | Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList 14 | Set-SystemVariable -SystemVariable "CONDA" -Value $CondaDestination 15 | 16 | Invoke-PesterTests -TestFile "Miniconda" -------------------------------------------------------------------------------- /images/linux/scripts/installers/nvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: nvm.sh 4 | ## Desc: Installs Nvm 5 | ################################################################################ 6 | 7 | export NVM_DIR="/etc/skel/.nvm" 8 | mkdir $NVM_DIR 9 | VERSION=$(curl -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name') 10 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash 11 | echo 'NVM_DIR=$HOME/.nvm' | tee -a /etc/environment 12 | echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile 13 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" 14 | 15 | invoke_tests "Tools" "nvm" 16 | 17 | # set system node.js as default one 18 | nvm alias default system 19 | -------------------------------------------------------------------------------- /.github/workflows/create_github_release.yml: -------------------------------------------------------------------------------- 1 | name: Create GitHub release 2 | 3 | on: 4 | repository_dispatch: 5 | types: [create-github-release] 6 | 7 | 8 | jobs: 9 | Create_GitHub_release: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | - name: Create release for ${{ github.event.client_payload.ReleaseBranchName }} 16 | uses: actions/create-release@v1.1.1 17 | env: 18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 19 | with: 20 | tag_name: ${{ github.event.client_payload.ReleaseBranchName }} 21 | release_name: ${{ github.event.client_payload.ReleaseTitle }} 22 | body: ${{ github.event.client_payload.ReleaseBody }} 23 | prerelease: ${{ github.event.client_payload.Prerelease }} 24 | commitish: ${{ github.event.client_payload.Commitish }} -------------------------------------------------------------------------------- /images/win/scripts/Installers/Enable-DeveloperMode.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Enable-DeveloperMode.ps1 3 | ## Desc: Enables Developer Mode by toggling registry setting. Developer Mode is required to enable certain tools (e.g. WinAppDriver). 4 | ################################################################################ 5 | 6 | # Create AppModelUnlock if it doesn't exist, required for enabling Developer Mode 7 | $RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" 8 | if (-not(Test-Path -Path $RegistryKeyPath)) { 9 | New-Item -Path $RegistryKeyPath -ItemType Directory -Force 10 | } 11 | 12 | # Add registry value to enable Developer Mode 13 | New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1 14 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-ServiceFabricSDK.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-ServiceFabricSDK.ps1 3 | ## Desc: Install webpicmd and then the service fabric sdk 4 | ## must be install after Visual Studio 5 | ################################################################################ 6 | 7 | #Creating 'Installer' cache folder if it doesn't exist 8 | $temp_install_dir = 'C:\Windows\Installer' 9 | New-Item -Path $temp_install_dir -ItemType Directory -Force 10 | 11 | Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force 12 | 13 | WebpiCmd.exe /Install /Products:MicrosoftAzure-ServiceFabric-CoreSDK /AcceptEula /XML:https://webpifeed.blob.core.windows.net/webpifeed/5.1/WebProductList.xml 14 | 15 | Invoke-PesterTests -TestFile "Tools" -TestName "ServiceFabricSDK" 16 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-VCRedist.ps1: -------------------------------------------------------------------------------- 1 | if (Test-IsWin16) { 2 | # Install vcredist140 3 | Choco-Install -PackageName vcredist140 4 | } 5 | 6 | if (Test-IsWin19) { 7 | # Install vcredist2010 8 | $Vc2010x86Name = "vcredist_x86.exe" 9 | $Vc2010x86URI = "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/${Vc2010x86Name}" 10 | $Vc2010x64Name = "vcredist_x64.exe" 11 | $Vc2010x64URI = "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/${Vc2010x64Name}" 12 | $ArgumentList = ("/install", "/quiet", "/norestart") 13 | Install-Binary -Url $Vc2010x86URI -Name $Vc2010x86Name -ArgumentList $ArgumentList 14 | Install-Binary -Url $Vc2010x64URI -Name $Vc2010x64Name -ArgumentList $ArgumentList 15 | } 16 | 17 | Invoke-PesterTests -TestFile "Tools" -TestName "VCRedist" 18 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/SSDTExtensions.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "SSDTExtensions" { 2 | #These extensions don't have any proper name in the state.packages.json file, only id is available, which can be found on extension marketplace download page 3 | 4 | if (Test-isWin19) { 5 | $testExtenions = @( 6 | @{id = "04a86fc2-dbd5-4222-848e-911638e487fe"} 7 | @{id = "851E7A09-7B2B-4F06-A15D-BABFCB26B970"} 8 | @{id = "717ad572-c4b7-435c-c166-c2969777f718"} 9 | ) 10 | 11 | It "Extensions id=" -TestCases $testExtenions { 12 | $version = Get-VSExtensionVersion -packageName "${id}" 13 | $version | Should -Not -BeNullOrEmpty 14 | } 15 | } else { 16 | It "Extension SSDT" { 17 | $version = Get-VSExtensionVersion -packageName "SSDT" 18 | $version | Should -Not -BeNullOrEmpty 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/Nginx.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Nginx" { 2 | Context "Path" { 3 | It "Nginx" { 4 | $nginxPath = Join-Path (Join-Path "C:\tools\" (Get-Item C:\tools\nginx*).Name) "nginx" 5 | "$nginxPath -v" | Should -ReturnZeroExitCode 6 | } 7 | } 8 | 9 | Context "Service" { 10 | $nginxService = Get-Service -Name nginx 11 | $nginxServiceTests = @{ 12 | Name = $nginxService.Name 13 | Status = $nginxService.Status 14 | StartType = $nginxService.StartType 15 | } 16 | 17 | It " service is stopped" -TestCases $nginxServiceTests { 18 | $Status | Should -Be "Stopped" 19 | } 20 | 21 | It " service is disabled" -TestCases $nginxServiceTests { 22 | $StartType | Should -Be "Disabled" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /images/linux/README.md: -------------------------------------------------------------------------------- 1 | # Linux images 2 | 3 | Images size varies as our upstream adds/removes/modifies tools. 4 | Currently: ~40GB as of 02.08.2021 5 | 6 | Image is built upon `ghcr.io/catthehacker/ubuntu:runner-*` as it provides better base than plain Ubuntu (and if you use `ubuntu:act-*`/`ubuntu:runner-*` it will save on layers) 7 | 8 | Tools currently not included: 9 | - MySQL (because it slows the whole build and fails) 10 | - PostgreSQL (same as above) 11 | - certain other tools also might be unavailable as it is still work in progress (contribution appreciated) 12 | 13 | Tags available: 14 | - `ghcr.io/catthehacker/ubuntu:full-latest` (currently `ubuntu-20.04`) 15 | - `ghcr.io/catthehacker/ubuntu:full-20.04` 16 | - `ghcr.io/catthehacker/ubuntu:full-18.04` 17 | 18 | ## [`ubuntu-16.04` will be deprecated soon](https://github.com/actions/virtual-environments/issues/3287) 19 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-AliyunCli.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-AliyunCli.ps1 3 | ## Desc: Install Alibaba Cloud CLI 4 | ################################################################################ 5 | 6 | Write-Host "Download Latest aliyun-cli archive" 7 | $ZipballUrl = 'https://aliyuncli.alicdn.com/aliyun-cli-windows-latest-amd64.zip' 8 | $aliyunArchivePath = Start-DownloadWithRetry -Url $ZipballUrl -Name "aliyun-cli.zip" 9 | 10 | Write-Host "Expand aliyun-cli archive" 11 | $aliyunPath = "C:\aliyun-cli" 12 | New-Item -Path $aliyunPath -ItemType Directory -Force 13 | Extract-7Zip -Path $aliyunArchivePath -DestinationPath $aliyunPath 14 | 15 | # Add aliyun-cli to path 16 | Add-MachinePathItem $aliyunPath 17 | 18 | Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Aliyun CLI" -------------------------------------------------------------------------------- /images/win/scripts/Tests/Apache.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Apache" { 2 | Context "Path" { 3 | It "Apache" { 4 | $apachePath = Join-Path (Join-Path "C:\tools\" (Get-Item C:\tools\apache*).Name) "\bin\httpd" 5 | "$apachePath -V" | Should -ReturnZeroExitCode 6 | } 7 | } 8 | 9 | Context "Service" { 10 | $apacheService = Get-Service -Name Apache 11 | $apacheServiceTests = @{ 12 | Name = $apacheService.Name 13 | Status = $apacheService.Status 14 | StartType = $apacheService.StartType 15 | } 16 | 17 | It " service is stopped" -TestCases $apacheServiceTests { 18 | $Status | Should -Be "Stopped" 19 | } 20 | 21 | It " service is disabled" -TestCases $apacheServiceTests { 22 | $StartType | Should -Be "Disabled" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/phantomjs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: phantomjs.sh 4 | ## Desc: Installs PhantomJS 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/install.sh 9 | source "$HELPER_SCRIPTS"/install.sh 10 | 11 | # Install PhantomJS 12 | apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev 13 | PHANTOM_JS=phantomjs-2.1.1-linux-x86_64 14 | download_with_retries https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 "/tmp" 15 | tar xjf /tmp/$PHANTOM_JS.tar.bz2 -C /usr/local/share 16 | ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin 17 | 18 | invoke_tests "Tools" "Phantomjs" 19 | -------------------------------------------------------------------------------- /images/macos/provision/core/open_windows_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | retry=10 4 | while [ $retry -gt 0 ]; do 5 | openwindows=$(osascript -e 'tell application "System Events" to get every window of (every process whose class of windows contains window)') && break 6 | 7 | retry=$((retry-1)) 8 | if [ $retry -eq 0 ]; then 9 | echo "No retry attempts left" 10 | exit 1 11 | fi 12 | sleep 30 13 | done 14 | IFS=',' read -r -a windowslist <<< "$openwindows" 15 | 16 | if [ -n "${openwindows}" ]; then 17 | echo "Found opened window:" 18 | fi 19 | 20 | for window in "${windowslist[@]}"; do 21 | if [[ $window =~ "NotificationCenter" ]]; then 22 | echo "[Warning] $window" 23 | else 24 | echo " - ${window}" | xargs 25 | scripterror=true 26 | fi 27 | done 28 | 29 | if [ "${scripterror}" = true ]; then 30 | exit 1 31 | fi 32 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/Git.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Git" { 2 | $gitTools = 'bash', 'awk', 'git', 'git-lfs' 3 | $gitTestCases = $gitTools | ForEach-Object { 4 | @{ 5 | toolName = $_ 6 | source = [regex]::Escape("$env:ProgramFiles\Git") 7 | } 8 | } 9 | 10 | It " is installed" -TestCases $gitTestCases { 11 | "$toolName --version" | Should -ReturnZeroExitCode 12 | } 13 | 14 | It " is located in ''" -TestCases $gitTestCases { 15 | (Get-Command -Name $toolName).Source | Should -Match $source 16 | } 17 | 18 | It "Git core.symlinks=true option is enabled" { 19 | git config core.symlinks | Should -BeExactly true 20 | } 21 | 22 | It "GCM_INTERACTIVE environment variable should be equal Never" { 23 | $env:GCM_INTERACTIVE | Should -BeExactly Never 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /images/macos/provision/core/stack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo "Get the latest Stack version..." 5 | stackDownloadUrl=$(get_github_package_download_url "commercialhaskell/stack" "contains(\"osx-x86_64.tar.gz\")" "latest" "$API_PAT") 6 | stackVersion=$(echo $stackDownloadUrl | cut -d "/" -f8 | tr -d "v") 7 | stackArchive="/tmp/stack.tar.gz" 8 | 9 | echo "Download stack version $stackVersion..." 10 | download_with_retries $stackDownloadUrl "/tmp" "stack.tar.gz" 11 | 12 | stackToolcachePath="$AGENT_TOOLSDIRECTORY/stack/$stackVersion" 13 | destinationPath="$stackToolcachePath/x64" 14 | 15 | mkdir -p $destinationPath 16 | 17 | echo "Unzip stack archive..." 18 | tar -xzf $stackArchive -C $destinationPath --strip 1 19 | 20 | touch $stackToolcachePath/x64.complete 21 | 22 | echo "export PATH="\$PATH":$destinationPath" >> "$HOME/.bashrc" 23 | 24 | invoke_tests "Common" "Stack" 25 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/BizTalk.Tests.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: BizTalk.Tests.ps1 3 | ## Desc: Test BizTalk project build component installed. 4 | ################################################################################ 5 | 6 | Describe "BizTalk Build Component Setup" -Skip:(-not (Test-IsWin19)) { 7 | It "BizTalk Registry Check" { 8 | Test-Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\BizTalk Server\3.0" | Should -BeTrue 9 | } 10 | 11 | It "BizTalk Folder Check" { 12 | "${env:ProgramFiles(x86)}\Microsoft BizTalk Server" | Should -Exist 13 | } 14 | 15 | It "BizTalk Build Targets files Check" { 16 | "${env:ProgramFiles(x86)}\MSBuild\Microsoft\BizTalk\BizTalkC.targets" | Should -Exist 17 | "${env:ProgramFiles(x86)}\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets" | Should -Exist 18 | } 19 | } -------------------------------------------------------------------------------- /images/linux/scripts/installers/cmake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: cmake.sh 4 | ## Desc: Installs CMake 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | source $HELPER_SCRIPTS/install.sh 9 | 10 | # Test to see if the software in question is already installed, if not install it 11 | echo "Checking to see if the installer script has already been run" 12 | if command -v cmake; then 13 | echo "cmake is already installed" 14 | else 15 | downloadUrl=$(get_github_package_download_url "Kitware/CMake" "endswith(\"inux-x86_64.sh\")") 16 | curl -sL ${downloadUrl} -o cmakeinstall.sh \ 17 | && chmod +x cmakeinstall.sh \ 18 | && ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \ 19 | && rm cmakeinstall.sh 20 | fi 21 | 22 | invoke_tests "Tools" "Cmake" 23 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/gfortran.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: gfortran.sh 4 | ## Desc: Installs GNU Fortran 5 | ################################################################################ 6 | 7 | # shellcheck source=/images/linux/scripts/helpers/install.sh 8 | source "$HELPER_SCRIPTS"/install.sh 9 | # shellcheck source=/images/linux/scripts/helpers/os.sh 10 | source "$HELPER_SCRIPTS"/os.sh 11 | 12 | function InstallFortran { 13 | version=$1 14 | 15 | echo "Installing $version..." 16 | apt-get install $version -y 17 | } 18 | 19 | # Install GNU Fortran compiler 20 | add-apt-repository ppa:ubuntu-toolchain-r/test -y 21 | apt-get update -y 22 | 23 | versions=$(get_toolset_value '.gfortran.versions[]') 24 | 25 | for version in ${versions[*]} 26 | do 27 | InstallFortran $version 28 | done 29 | 30 | invoke_tests "Tools" "gfortran" 31 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-PowershellCore.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-PowershellCore.ps1 3 | ## Desc: Install PowerShell Core 4 | ################################################################################ 5 | 6 | Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet" 7 | 8 | # about_update_notifications 9 | # While the update check happens during the first session in a given 24-hour period, for performance reasons, 10 | # the notification will only be shown on the start of subsequent sessions. 11 | # Also for performance reasons, the check will not start until at least 3 seconds after the session begins. 12 | [System.Environment]::SetEnvironmentVariable("POWERSHELL_UPDATECHECK", "Off", [System.EnvironmentVariableTarget]::Machine) 13 | 14 | Invoke-PesterTests -TestFile "Tools" -TestName "PowerShell Core" 15 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/gcc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: gcc.sh 4 | ## Desc: Installs GNU C++ 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/os.sh 9 | source "$HELPER_SCRIPTS"/os.sh 10 | # shellcheck source=/images/linux/scripts/helpers/install.sh 11 | source "$HELPER_SCRIPTS"/install.sh 12 | 13 | function InstallGcc { 14 | version=$1 15 | 16 | echo "Installing $version..." 17 | apt-get install $version -y 18 | } 19 | 20 | # Install GNU C++ compiler 21 | add-apt-repository ppa:ubuntu-toolchain-r/test -y 22 | apt-get update -y 23 | 24 | versions=$(get_toolset_value '.gcc.versions[]') 25 | 26 | for version in ${versions[*]}; do 27 | InstallGcc $version 28 | done 29 | 30 | invoke_tests "Tools" "gcc" 31 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/Node.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Node.JS" { 2 | Context "Basic modules"{ 3 | It " " -TestCases @( 4 | @{ ToolName = "node" } 5 | @{ ToolName = "npm" } 6 | ) { 7 | "$ToolName --version" | Should -ReturnZeroExitCode 8 | } 9 | } 10 | 11 | $globalNpmPackages = (Get-ToolsetContent).npm.global_packages 12 | $globalNpmPackagesWithTests = $globalNpmPackages | Where-Object { $_.test } | ForEach-Object { @{ Name = $_.name; Test = $_.test } } 13 | 14 | Context "Global NPM Packages" { 15 | It "" -TestCases $globalNpmPackagesWithTests { 16 | $Test | Should -ReturnZeroExitCode 17 | } 18 | } 19 | 20 | Context "Node.js version" { 21 | It "Node.js version should correspond to the version in the toolset" { 22 | node --version | Should -BeLike "v$((Get-ToolsetContent).node.default)*" 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /images/linux/scripts/installers/graalvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # shellcheck source=/images/linux/scripts/helpers/install.sh 4 | source "$HELPER_SCRIPTS"/install.sh 5 | # shellcheck source=/images/linux/scripts/helpers/etc-environment.sh 6 | source "$HELPER_SCRIPTS"/etc-environment.sh 7 | 8 | # Install GraalVM 9 | GRAALVM_ROOT=/usr/local/graalvm 10 | export GRAALVM_11_ROOT="$GRAALVM_ROOT/graalvm-ce-java11*" 11 | 12 | downloadUrl=$(get_github_package_download_url "graalvm/graalvm-ce-builds" "contains(\"graalvm-ce-java11-linux-amd64\") and endswith(\"tar.gz\")") 13 | download_with_retries "$downloadUrl" "/tmp" "graalvm-archive.tar.gz" 14 | mkdir $GRAALVM_ROOT 15 | tar -xzf "/tmp/graalvm-archive.tar.gz" -C $GRAALVM_ROOT 16 | 17 | # Set environment variable for GraalVM root 18 | setEtcEnvironmentVariable "GRAALVM_11_ROOT" "$GRAALVM_11_ROOT" 19 | 20 | # Install Native Image 21 | $GRAALVM_11_ROOT/bin/gu install native-image 22 | 23 | invoke_tests "Tools" "GraalVM" 24 | -------------------------------------------------------------------------------- /images/macos/software-report/SoftwareReport.Java.psm1: -------------------------------------------------------------------------------- 1 | function Get-JavaVersions { 2 | $defaultJavaPath = (Get-Item env:JAVA_HOME).value 3 | $javaVersions = Get-Item env:JAVA_HOME_*_X64 4 | $sortRules = @{ 5 | Expression = { [Int32]$_.Name.Split("_")[2] } 6 | Descending = $false 7 | } 8 | 9 | return $javaVersions | Sort-Object $sortRules | ForEach-Object { 10 | $javaPath = $_.Value 11 | # Take semver from the java path 12 | $version = $javaPath.split('/')[5] 13 | $fullVersion = $version.Replace('-', '+') 14 | $defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : "" 15 | $vendorName = ($javaPath -like '*Java_Adopt_jdk*') ? "Adopt OpenJDK" : "Eclipse Temurin" 16 | 17 | [PSCustomObject] @{ 18 | "Version" = $fullVersion + $defaultPostfix 19 | "Vendor" = $vendorName 20 | "Environment Variable" = $_.Name 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /images/macos/tests/Ruby.Tests.ps1: -------------------------------------------------------------------------------- 1 | Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" 2 | Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking 3 | 4 | Describe "Ruby" { 5 | It "Ruby is available" { 6 | "ruby --version" | Should -ReturnZeroExitCode 7 | } 8 | 9 | It "Ruby is installed via HomeBrew" { 10 | Get-WhichTool "ruby" | Should -Not -BeLike "/usr/bin/ruby*" 11 | } 12 | 13 | It "Ruby tools are consistent" { 14 | $expectedPrefix = "/usr/local" 15 | Get-WhichTool "ruby" | Should -Match "$($expectedPrefix)*" 16 | Get-WhichTool "gem" | Should -Match "$($expectedPrefix)*" 17 | Get-WhichTool "bundler" | Should -Match "$($expectedPrefix)*" 18 | } 19 | 20 | It "Ruby gems permissions are valid" { 21 | "gem install bundle" | Should -ReturnZeroExitCode 22 | "gem uninstall bundle" | Should -ReturnZeroExitCode 23 | } 24 | } -------------------------------------------------------------------------------- /images/win/scripts/Installers/Configure-DynamicPort.ps1: -------------------------------------------------------------------------------- 1 | # https://support.microsoft.com/en-us/help/929851/the-default-dynamic-port-range-for-tcp-ip-has-changed-in-windows-vista 2 | # The new default start port is 49152, and the new default end port is 65535. 3 | # Default port configuration was changed during image generation by Visual Studio Enterprise Installer to: 4 | # Protocol tcp Dynamic Port Range 5 | # --------------------------------- 6 | # Start Port : 1024 7 | # Number of Ports : 64511 8 | Write-Host "Set the dynamic port range to start at port 49152 and to end at the 65536 (16384 ports)" 9 | $null = netsh int ipv4 set dynamicport tcp start=49152 num=16384 10 | $null = netsh int ipv4 set dynamicport udp start=49152 num=16384 11 | $null = netsh int ipv6 set dynamicport tcp start=49152 num=16384 12 | $null = netsh int ipv6 set dynamicport udp start=49152 num=16384 13 | 14 | Invoke-PesterTests -TestFile "WindowsFeatures" -TestName "DynamicPorts" -------------------------------------------------------------------------------- /images/win/scripts/Tests/Docker.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Docker" { 2 | It "" -TestCases @( 3 | @{ ToolName = "docker" } 4 | @{ ToolName = "docker-compose" } 5 | ) { 6 | "$ToolName --version" | Should -ReturnZeroExitCode 7 | } 8 | 9 | It "docker-wincred" { 10 | "docker-credential-wincred version" | Should -ReturnZeroExitCode 11 | } 12 | 13 | It "docker compose v2" { 14 | "docker compose version" | Should -ReturnZeroExitCode 15 | } 16 | 17 | It "docker service is up" { 18 | "docker images" | Should -ReturnZeroExitCode 19 | } 20 | } 21 | 22 | Describe "DockerImages" { 23 | Context "docker images" { 24 | $testCases = (Get-ToolsetContent).docker.images | ForEach-Object { @{ ImageName = $_ } } 25 | 26 | It "" -TestCases $testCases { 27 | docker images "$ImageName" --format "{{.Repository}}" | Should -Not -BeNullOrEmpty 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /images/win/scripts/Installers/Configure-Shell.ps1: -------------------------------------------------------------------------------- 1 | # Create shells folder 2 | $shellPath = "C:\shells" 3 | New-Item -Path $shellPath -ItemType Directory | Out-Null 4 | 5 | # add a wrapper for C:\msys64\usr\bin\bash.exe 6 | @' 7 | @echo off 8 | setlocal 9 | IF NOT DEFINED MSYS2_PATH_TYPE set MSYS2_PATH_TYPE=strict 10 | IF NOT DEFINED MSYSTEM set MSYSTEM=mingw64 11 | set CHERE_INVOKING=1 12 | C:\msys64\usr\bin\bash.exe -leo pipefail %* 13 | '@ | Out-File -FilePath "$shellPath\msys2bash.cmd" -Encoding ascii 14 | 15 | # gitbash <--> C:\Program Files\Git\bin\bash.exe 16 | New-Item -ItemType SymbolicLink -Path "$shellPath\gitbash.exe" -Target "$env:ProgramFiles\Git\bin\bash.exe" | Out-Null 17 | 18 | # WSL is available on Windows Server 2019 and Windows Server 2022 19 | if (-not (Test-IsWin16)) 20 | { 21 | # wslbash <--> C:\Windows\System32\bash.exe 22 | New-Item -ItemType SymbolicLink -Path "$shellPath\wslbash.exe" -Target "$env:SystemRoot\System32\bash.exe" | Out-Null 23 | } 24 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Vsix.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################### 2 | ## File: Install-Vsix.ps1 3 | ## Desc: Install the Visual Studio Extensions from toolset.json 4 | ################################################################################### 5 | 6 | $toolset = Get-ToolsetContent 7 | $vsixPackagesList = $toolset.visualStudio.vsix 8 | if (-not $vsixPackagesList) { 9 | Write-Host "No extensions to install" 10 | exit 0 11 | } 12 | 13 | $vsVersion = $toolset.visualStudio.Version 14 | $vsixPackagesList | ForEach-Object { 15 | # Retrieve cdn endpoint to avoid HTTP error 429 https://github.com/actions/virtual-environments/issues/3074 16 | $vsixPackage = Get-VsixExtenstionFromMarketplace -ExtensionMarketPlaceName $_ 17 | Install-VsixExtension -Url $vsixPackage.DownloadUri -Name $vsixPackage.FileName -VSversion $vsVersion 18 | } 19 | 20 | Invoke-PesterTests -TestFile "Vsix" -------------------------------------------------------------------------------- /images/linux/scripts/installers/preimagedata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | imagedata_file=$IMAGEDATA_FILE 4 | image_version=$IMAGE_VERSION 5 | os_name=$(lsb_release -ds | sed "s/ /\\\n/g") 6 | os_version=$(lsb_release -rs) 7 | image_label="ubuntu-${os_version}" 8 | version_major=${os_version/.*/} 9 | version_wo_dot=${os_version/./} 10 | github_url="https://github.com/actions/virtual-environments/blob" 11 | 12 | software_url="${github_url}/ubuntu${version_major}/${image_version}/images/linux/Ubuntu${version_wo_dot}-Readme.md" 13 | releaseUrl="https://github.com/actions/virtual-environments/releases/tag/ubuntu${version_major}%2F${image_version}" 14 | 15 | cat < $imagedata_file 16 | [ 17 | { 18 | "group": "Operating System", 19 | "detail": "${os_name}" 20 | }, 21 | { 22 | "group": "Virtual Environment", 23 | "detail": "Environment: ${image_label}\nVersion: ${image_version}\nIncluded Software: ${software_url}\nImage Release: ${releaseUrl}" 24 | } 25 | ] 26 | EOF 27 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Kotlin.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Kotlin.ps1 3 | ## Desc: Install Kotlin 4 | ################################################################################ 5 | 6 | # Install Kotlin 7 | $kotlinVersion = (Get-ToolsetContent).kotlin.version 8 | $kotlinBinaryName = (Get-ToolsetContent).kotlin.binary_name 9 | 10 | $kotlinDownloadUrl = Get-GitHubPackageDownloadUrl -RepoOwner "JetBrains" -RepoName "kotlin" -BinaryName $kotlinBinaryName -Version $kotlinVersion -UrlFilter "*{BinaryName}-{Version}.zip" 11 | $kotlinInstallerPath = Start-DownloadWithRetry -Url $kotlinDownloadUrl -Name "$kotlinBinaryName.zip" 12 | 13 | Write-Host "Expand Kotlin archive" 14 | $kotlinPath = "C:\tools" 15 | Extract-7Zip -Path $kotlinInstallerPath -DestinationPath $kotlinPath 16 | 17 | # Add to PATH 18 | Add-MachinePathItem "$kotlinPath\kotlinc\bin" 19 | 20 | Invoke-PesterTests -TestFile "Tools" -TestName "Kotlin" -------------------------------------------------------------------------------- /images/win/scripts/Installers/Windows2016/Install-SSDT.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-SSDT.ps1 3 | ## Desc: Install SQL Server Data Tools for Windows 4 | ################################################################################ 5 | 6 | #SSDT for Visual Studio 2017 7 | #The link down below points to the latest version of SSDT for Visual Studio 2017 8 | $InstallerName = "SSDT-Setup-ENU.exe" 9 | $InstallerUrl = "https://go.microsoft.com/fwlink/?linkid=2124518" 10 | $logFilePath = "$env:TEMP\ssdtlog.txt" 11 | $ArgumentList = ("/install", "INSTALLALL", "/passive", "/norestart", "/log `"$logFilePath`"") 12 | 13 | Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList 14 | 15 | Write-Host "******** SSDT SETUP LOG START ********" 16 | Write-Host $(Get-Content $logFilePath | Out-String) 17 | Write-Host "******** SSDT SETUP LOG END ********" 18 | 19 | Invoke-PesterTests -TestFile "SSDTExtensions" 20 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/example.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: example.sh 4 | ## Desc: This is an example script that can be copied to add a new software 5 | ## installer to the image 6 | ################################################################################ 7 | 8 | # Test to see if the software in question is already installed, if not install it 9 | echo "Checking to see if the installer script has already been run" 10 | if [ -z $EXAMPLE_VAR ]; then 11 | $EXAMPLE_VAR=1.0.0 12 | else 13 | echo "Example variable already set to $EXAMPLE_VAR" 14 | fi 15 | 16 | # Run tests to determine that the software installed as expected 17 | echo "Testing to make sure that script performed as expected, and basic scenarios work" 18 | if [ -z $EXAMPLE_VAR ]; then 19 | echo "EXAMPLE_VAR variable was not set as expected" 20 | exit 1 21 | else 22 | echo "EXAMPLE_VAR was set properly" 23 | fi 24 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "[json]": { 3 | "editor.defaultFormatter": "esbenp.prettier-vscode" 4 | }, 5 | "[markdown]": { 6 | "editor.defaultFormatter": "esbenp.prettier-vscode" 7 | }, 8 | "[powershell]": { 9 | "editor.defaultFormatter": "ms-vscode.powershell" 10 | }, 11 | "[shellscript]": { 12 | "editor.defaultFormatter": "foxundermoon.shell-format", 13 | "files.eol": "\n" 14 | }, 15 | "files.trimTrailingWhitespace": false, 16 | "powershell.codeFormatting.autoCorrectAliases": true, 17 | "powershell.codeFormatting.preset": "OTBS", 18 | "powershell.codeFormatting.trimWhitespaceAroundPipe": true, 19 | "powershell.codeFormatting.useConstantStrings": true, 20 | "powershell.codeFormatting.useCorrectCasing": true, 21 | "powershell.codeFormatting.whitespaceBetweenParameters": true, 22 | "shellcheck.customArgs": ["-x"], 23 | "shellcheck.useWorkspaceRootAsCwd": true, 24 | "yaml.format.singleQuote": true 25 | } 26 | -------------------------------------------------------------------------------- /.github/workflows/linter.yml: -------------------------------------------------------------------------------- 1 | # CI Validation 2 | 3 | name: Linter 4 | 5 | on: 6 | pull_request: 7 | branches: [ master ] 8 | paths: 9 | - '**.json' 10 | - '**.md' 11 | - '**.sh' 12 | 13 | jobs: 14 | build: 15 | name: Lint JSON & MD files 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - name: Checkout Code 20 | uses: actions/checkout@v2 21 | with: 22 | fetch-depth: 0 23 | 24 | - name: Lint Code Base 25 | uses: github/super-linter/slim@v4 26 | env: 27 | VALIDATE_ALL_CODEBASE: false 28 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 29 | VALIDATE_JSON: true 30 | VALIDATE_MARKDOWN: true 31 | VALIDATE_POWERSHELL: true 32 | DEFAULT_BRANCH: ${{ github.base_ref }} 33 | FILTER_REGEX_EXCLUDE: .*images/*/.*-Readme.md 34 | 35 | - name: Checking shebang lines in MacOS and Ubuntu releases. 36 | run: ./images.CI/shebang-linter.ps1 37 | shell: pwsh 38 | -------------------------------------------------------------------------------- /images/macos/provision/core/audiodevice.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo "install switchaudio-osx" 5 | brew_smart_install "switchaudio-osx" 6 | 7 | echo "install sox" 8 | brew_smart_install "sox" 9 | 10 | # Big Sur doesn't support soundflower installation without user interaction https://github.com/mattingalls/Soundflower/releases/tag/2.0b2 11 | # Install blackhole-2ch for Big Sur instead 12 | if is_Catalina; then 13 | echo "install soundflower" 14 | brew install --cask soundflower 15 | 16 | echo "set Soundflower (2ch) as input/output device" 17 | SwitchAudioSource -s "Soundflower (2ch)" -t input 18 | SwitchAudioSource -s "Soundflower (2ch)" -t output 19 | else 20 | echo "install blackhole-2ch" 21 | brew_smart_install "blackhole-2ch" 22 | 23 | echo "set BlackHole 2ch as input/output device" 24 | SwitchAudioSource -s "BlackHole 2ch" -t input 25 | SwitchAudioSource -s "BlackHole 2ch" -t output 26 | fi 27 | 28 | invoke_tests "System" "Audio Device" 29 | -------------------------------------------------------------------------------- /.github/workflows/update_github_release.yml: -------------------------------------------------------------------------------- 1 | name: Update release 2 | 3 | on: 4 | repository_dispatch: 5 | types: [update-github-release] 6 | 7 | 8 | jobs: 9 | Update_GitHub_release: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | 15 | - name: Update release for ${{ github.event.client_payload.ReleaseBranchName }} 16 | uses: actions/github-script@v2 17 | with: 18 | github-token: ${{secrets.GITHUB_TOKEN}} 19 | script: | 20 | const response = await github.repos.getReleaseByTag({ 21 | owner: context.repo.owner, 22 | repo: context.repo.repo, 23 | tag: "${{ github.event.client_payload.ReleaseBranchName }}" 24 | }); 25 | github.repos.updateRelease({ 26 | owner: context.repo.owner, 27 | repo: context.repo.repo, 28 | release_id: response.data.id, 29 | prerelease: ${{ github.event.client_payload.Prerelease }} 30 | }); 31 | -------------------------------------------------------------------------------- /images/macos/provision/core/postgresql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | # Fetch PostgreSQL version to install from the toolset 5 | toolsetVersion=$(get_toolset_value '.postgresql.version') 6 | 7 | # Install latest version of PostgreSQL 8 | brew_smart_install postgresql@$toolsetVersion 9 | 10 | # Service PostgreSQL should be started before use 11 | brew services start postgresql 12 | 13 | # Verify PostgreSQL is ready for accept incoming connections 14 | echo "Check PostgreSQL service is running" 15 | i=10 16 | COMMAND='pg_isready' 17 | while [ $i -gt 0 ]; do 18 | echo "Check PostgreSQL service status" 19 | eval $COMMAND && break 20 | ((i--)) 21 | if [ $i == 0 ]; then 22 | echo "PostgreSQL service not ready, all attempts exhausted" 23 | exit 1 24 | fi 25 | echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i" 26 | sleep 10 27 | done 28 | 29 | # Stop PostgreSQL 30 | brew services stop postgresql 31 | 32 | invoke_tests "Databases" "PostgreSQL" 33 | -------------------------------------------------------------------------------- /images/macos/tests/Rust.Tests.ps1: -------------------------------------------------------------------------------- 1 | $os = Get-OSVersion 2 | 3 | Describe "Rust" { 4 | Context "Rust" { 5 | It "Rustup is installed" { 6 | "rustup --version" | Should -ReturnZeroExitCode 7 | } 8 | 9 | It "Rustc is installed" { 10 | "rustc --version" | Should -ReturnZeroExitCode 11 | } 12 | } 13 | 14 | Context "Cargo" { 15 | It "Cargo is installed" { 16 | "cargo --version" | Should -ReturnZeroExitCode 17 | } 18 | } 19 | 20 | Context "Cargo dependencies" { 21 | It "bindgen" { 22 | "bindgen --version" | Should -ReturnZeroExitCode 23 | } 24 | 25 | It "cbindgen" { 26 | "cbindgen --version" | Should -ReturnZeroExitCode 27 | } 28 | 29 | It "Cargo audit" { 30 | "cargo audit --version" | Should -ReturnZeroExitCode 31 | } 32 | 33 | It "Cargo outdated" { 34 | "cargo outdated --version" | Should -ReturnZeroExitCode 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-CloudFoundryCli.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-CloudFoundryCli.ps1 3 | ## Desc: Install Cloud Foundry CLI 4 | ################################################################################ 5 | 6 | # Download the latest cf cli exe 7 | $CloudFoundryCliName = "cf-cli.zip" 8 | $CloudFoundryCliUrl = "https://packages.cloudfoundry.org/stable?release=windows64-exe&source=github" 9 | 10 | $CloudFoundryArchPath = Start-DownloadWithRetry -Url $CloudFoundryCliUrl -Name $CloudFoundryCliName 11 | 12 | # Create directory for cf cli 13 | $CloudFoundryCliPath = "C:\cf-cli" 14 | New-Item -Path $CloudFoundryCliPath -ItemType Directory -Force 15 | 16 | # Extract the zip archive 17 | Write-Host "Extracting cf cli..." 18 | Extract-7Zip -Path $CloudFoundryArchPath -DestinationPath $CloudFoundryCliPath 19 | 20 | # Add cf to path 21 | Add-MachinePathItem $CloudFoundryCliPath 22 | 23 | Invoke-PesterTests -TestFile "CLI.Tools" -TestName "CloudFoundry CLI" -------------------------------------------------------------------------------- /images/win/post-generation/InternetExplorerConfiguration.ps1: -------------------------------------------------------------------------------- 1 | # https://docs.microsoft.com/en-us/troubleshoot/browsers/enhanced-security-configuration-faq#how-to-disable-internet-explorer-esc-by-using-a-script 2 | # turn off the Internet Explorer Enhanced Security feature 3 | Rundll32 iesetup.dll, IEHardenLMSettings, 1, True 4 | Rundll32 iesetup.dll, IEHardenUser, 1, True 5 | Rundll32 iesetup.dll, IEHardenAdmin, 1, True 6 | $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" 7 | $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" 8 | Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force 9 | Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force 10 | # restart Explorer process 11 | $ieProcess = Get-Process -Name Explorer -ErrorAction Ignore 12 | if ($ieProcess) { 13 | Stop-Process -Name Explorer -Force -ErrorAction Ignore 14 | } 15 | Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." 16 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-SQLPowerShellTools.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-SQLPowerShellTools.ps1 3 | ## Desc: Install SQL PowerShell tool 4 | ################################################################################ 5 | 6 | $BaseUrl = "https://download.microsoft.com/download/B/1/7/B1783FE9-717B-4F78-A39A-A2E27E3D679D/ENU/x64" 7 | 8 | # install required MSIs 9 | $SQLSysClrTypesName = "SQLSysClrTypes.msi" 10 | $SQLSysClrTypesUrl = "${BaseUrl}/${SQLSysClrTypesName}" 11 | Install-Binary -Url $SQLSysClrTypesUrl -Name $SQLSysClrTypesName 12 | 13 | $SharedManagementObjectsName = "SharedManagementObjects.msi" 14 | $SharedManagementObjectsUrl = "${BaseUrl}/${SharedManagementObjectsName}" 15 | Install-Binary -Url $SharedManagementObjectsUrl -Name $SharedManagementObjectsName 16 | 17 | $PowerShellToolsName = "PowerShellTools.msi" 18 | $PowerShellToolsUrl = "${BaseUrl}/${PowerShellToolsName}" 19 | Install-Binary -Url $PowerShellToolsUrl -Name $PowerShellToolsName 20 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-AWS.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-AWS.ps1 3 | ## Desc: Install AWS tools(AWS CLI, Session Manager Plugin for the AWS CLI, AWS SAM CLI) 4 | ################################################################################ 5 | 6 | # Install AWS CLI 7 | Choco-Install -PackageName awscli 8 | 9 | # Install Session Manager Plugin for the AWS CLI 10 | $sessionManagerName = "SessionManagerPluginSetup.exe" 11 | $sessionManagerUrl = "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/windows/$sessionManagerName" 12 | Install-Binary -Url $sessionManagerUrl -Name $sessionManagerName -ArgumentList ("/silent", "/install") 13 | $env:Path = $env:Path + ";$env:ProgramFiles\Amazon\SessionManagerPlugin\bin" 14 | 15 | # Install AWS SAM CLI 16 | Install-Binary -Url "https://github.com/awslabs/aws-sam-cli/releases/latest/download/AWS_SAM_CLI_64_PY3.msi" -Name "AWS_SAM_CLI_64_PY3.msi" 17 | 18 | Invoke-PesterTests -TestFile "CLI.Tools" -TestName "AWS" -------------------------------------------------------------------------------- /images/linux/scripts/installers/dpkg-config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # This is the anti-frontend. It never interacts with you at all, 4 | # and makes the default answers be used for all questions. It 5 | # might mail error messages to root, but that's it; otherwise it 6 | # is completely silent and unobtrusive, a perfect frontend for 7 | # automatic installs. If you are using this front-end, and require 8 | # non-default answers to questions, you will need to preseed the 9 | # debconf database 10 | echo 'DEBIAN_FRONTEND=noninteractive' | tee -a /etc/environment 11 | 12 | # dpkg can be instructed not to ask for confirmation 13 | # when replacing a configuration file (with the --force-confdef --force-confold options) 14 | cat <> /etc/apt/apt.conf.d/10dpkg-options 15 | Dpkg::Options { 16 | "--force-confdef"; 17 | "--force-confold"; 18 | } 19 | EOF 20 | 21 | # hide information about packages that are no longer required 22 | cat <> /etc/apt/apt.conf.d/10apt-autoremove 23 | APT::Get::AutomaticRemove "0"; 24 | APT::Get::HideAutoRemove "1"; 25 | EOF 26 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # before cleanup 4 | before=$(df / -Pm | awk 'NR==2{print $4}') 5 | 6 | # clears out the local repository of retrieved package files 7 | # It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial 8 | apt-get clean 9 | rm -rf /tmp/* 10 | rm -rf /root/.cache 11 | 12 | if [[ ! -f /run/systemd/container ]]; then 13 | # journalctl 14 | if command -v journalctl; then 15 | journalctl --rotate 16 | journalctl --vacuum-time=1s 17 | fi 18 | fi 19 | 20 | # delete all .gz and rotated file 21 | find /var/log -type f -regex ".*\.gz$" -delete 22 | find /var/log -type f -regex ".*\.[0-9]$" -delete 23 | 24 | # wipe log files 25 | find /var/log/ -type f -exec cp /dev/null {} \; 26 | 27 | # after cleanup 28 | after=$(df / -Pm | awk 'NR==2{print $4}') 29 | 30 | # display size 31 | echo "Before: $before MB" 32 | echo "After : $after MB" 33 | echo "Delta : $(($after - $before)) MB" 34 | 35 | # delete symlink for tests running 36 | rm -f /usr/local/bin/invoke_tests 37 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/google-cloud-sdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: google-cloud-sdk.sh 4 | ## Desc: Installs the Google Cloud SDK 5 | ################################################################################ 6 | 7 | REPO_URL="https://packages.cloud.google.com/apt" 8 | 9 | # Install the Google Cloud SDK 10 | echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] $REPO_URL cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list 11 | wget -q https://packages.cloud.google.com/apt/doc/apt-key.gpg -O /usr/share/keyrings/cloud.google.gpg 12 | apt-get update -y 13 | # temporary downgrade google-cloud-sdk as python component has linking bugs 14 | apt-get install -y google-cloud-sdk=369.0.0-0 15 | 16 | # remove apt 17 | rm /etc/apt/sources.list.d/google-cloud-sdk.list 18 | rm /usr/share/keyrings/cloud.google.gpg 19 | 20 | # add repo to the apt-sources.txt 21 | echo "google-cloud-sdk $REPO_URL" >> $HELPER_SCRIPTS/apt-sources.txt 22 | 23 | invoke_tests "CLI.Tools" "Google Cloud SDK" 24 | -------------------------------------------------------------------------------- /images/macos/provision/core/build-xcode-symlinks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | source ~/utils/utils.sh 4 | 5 | # Link the existing Xcodes into the correct location for provisionator. 6 | 7 | # These symlinks are necessary for Xamarin team to make sure that xamarin-provisionator can find them. 8 | 9 | # Old style provisionator directories. This is maintained for 10 | # backwards compatibility only. Do not add new xcodes here. 11 | ln -sf /Applications/Xcode_8.app /Applications/Xcode8.app 12 | ln -sf /Applications/Xcode_8.1.app /Applications/Xcode81.app 13 | ln -sf /Applications/Xcode_9.app /Applications/Xcode9.app 14 | ln -sf /Applications/Xcode_9.1.app /Applications/Xcode91.app 15 | ln -sf /Applications/Xcode_9.2.app /Applications/Xcode92.app 16 | ln -sf /Applications/Xcode_9.3.app /Applications/Xcode93.app 17 | ln -sf /Applications/Xcode_9.3.app /Applications/Xcode_9.3_beta.app 18 | ln -sf /Applications/Xcode_9.4.app /Applications/Xcode_9.4-beta.app 19 | ln -sf /Applications/Xcode_9.4.app /Applications/Xcode_9.4_beta.app 20 | ln -sf /Applications/Xcode_9.4.app /Applications/Xcode_9.4_beta_2.app -------------------------------------------------------------------------------- /images/linux/scripts/installers/post-deployment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: post-deployment.sh 4 | ## Desc: Post deployment actions 5 | ################################################################################ 6 | 7 | mv -f /imagegeneration/post-generation /opt 8 | 9 | echo "chmod -R 777 /opt" 10 | chmod -R 777 /opt 11 | echo "chmod -R 777 /usr/share" 12 | chmod -R 777 /usr/share 13 | 14 | # remove installer and helper folders 15 | rm -rf "$HELPER_SCRIPT_FOLDER" 16 | rm -rf "$INSTALLER_SCRIPT_FOLDER" 17 | chmod 755 "$IMAGE_FOLDER" 18 | 19 | # Remove quotes around PATH 20 | # ENVPATH=$(grep 'PATH=' /etc/environment | head -n 1 | sed -z 's/^PATH=*//') 21 | # ENVPATH=${ENVPATH#"\""} 22 | # ENVPATH=${ENVPATH%"\""} 23 | # echo "PATH=$ENVPATH" | sudo tee -a /etc/environment 24 | sed 's|"||g' -i "/etc/environment" 25 | sed "s|\$HOME|/home/runner|g" -i "/etc/environment" 26 | echo "Updated /etc/environment: $(cat /etc/environment)" 27 | 28 | # Clean yarn and npm cache 29 | yarn cache clean 30 | npm cache clean --force 31 | -------------------------------------------------------------------------------- /images/linux/scripts/tests/Haskell.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Haskell" { 2 | $GHCCommonPath = "/usr/local/.ghcup/ghc" 3 | $GHCVersions = Get-ChildItem -Path $GHCCommonPath | Where-Object { $_.Name -match "\d+\.\d+" } 4 | 5 | $testCase = @{ GHCVersions = $GHCVersions } 6 | 7 | It "GHC directory contains two version of GHC" -TestCases $testCase { 8 | param ([object] $GHCVersions) 9 | $GHCVersions.Count | Should -Be 2 10 | } 11 | 12 | $testCases = $GHCVersions | ForEach-Object { @{ GHCPath = "${_}/bin/ghc" } } 13 | 14 | It "GHC version " -TestCases $testCases { 15 | param ([string] $GHCPath) 16 | "$GHCPath --version" | Should -ReturnZeroExitCode 17 | } 18 | 19 | It "GHCup" { 20 | "ghcup --version" | Should -ReturnZeroExitCode 21 | } 22 | 23 | It "Default GHC" { 24 | "ghc --version" | Should -ReturnZeroExitCode 25 | } 26 | 27 | It "Cabal" { 28 | "cabal --version" | Should -ReturnZeroExitCode 29 | } 30 | 31 | It "Stack" { 32 | "stack --version" | Should -ReturnZeroExitCode 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /images/macos/provision/core/nvm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | ########################################################################### 3 | # The script installs node version manager with node versions 10,12 and 14 4 | # 5 | ########################################################################### 6 | source ~/utils/utils.sh 7 | 8 | [ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}") 9 | VERSION=$(curl "${authString[@]}" -s https://api.github.com/repos/nvm-sh/nvm/releases/latest | jq -r '.tag_name') 10 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION/install.sh | bash 11 | 12 | if [ $? -eq 0 ]; then 13 | . ~/.bashrc 14 | nvm --version 15 | nodeVersions=$(get_toolset_value '.node.nvm_versions[]') 16 | for version in ${nodeVersions[@]} 17 | do 18 | nvm install v${version} 19 | done 20 | 21 | # set system node as default 22 | nvm alias default system 23 | else 24 | echo error 25 | fi 26 | 27 | echo "Node version manager has been installed successfully" 28 | 29 | invoke_tests "Node" "nvm" 30 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-WindowsFeatures.ps1: -------------------------------------------------------------------------------- 1 | $windowsFeatures = (Get-ToolsetContent).windowsFeatures 2 | 3 | foreach ($feature in $windowsFeatures) { 4 | if ($feature.optionalFeature) { 5 | Write-Host "Activating Windows Optional Feature '$($feature.name)'..." 6 | Enable-WindowsOptionalFeature -Online -FeatureName $feature.name -NoRestart 7 | 8 | $resultSuccess = $? 9 | } else { 10 | Write-Host "Activating Windows Feature '$($feature.name)'..." 11 | $Arguments = @{ 12 | Name = $feature.name 13 | IncludeAllSubFeature = [System.Convert]::ToBoolean($feature.includeAllSubFeatures) 14 | IncludeManagementTools = [System.Convert]::ToBoolean($feature.includeManagementTools) 15 | } 16 | $result = Install-WindowsFeature @Arguments 17 | 18 | $resultSuccess = $result.Success 19 | } 20 | 21 | if ($resultSuccess) { 22 | Write-Host "Windows Feature '$($feature.name)' was activated successfully" 23 | } else { 24 | throw "Failed to activate Windows Feature '$($feature.name)'" 25 | } 26 | } -------------------------------------------------------------------------------- /images/linux/scripts/installers/mysql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: mysql.sh 4 | ## Desc: Installs MySQL Client 5 | ################################################################################ 6 | 7 | source /etc/os-release 8 | # shellcheck source=/images/linux/scripts/helpers/os.sh 9 | source "$HELPER_SCRIPTS"/os.sh 10 | 11 | # Mysql setting up root password 12 | MYSQL_ROOT_PASSWORD=root 13 | echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections 14 | echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections 15 | 16 | export ACCEPT_EULA=Y 17 | 18 | # Install MySQL Client 19 | apt-get install mysql-client -y 20 | 21 | # Install MySQL Server 22 | apt-get install -y mysql-server 23 | 24 | #Install MySQL Dev tools 25 | apt install libmysqlclient-dev -y 26 | 27 | # Disable mysql.service 28 | systemctl is-active --quiet mysql.service && systemctl stop mysql.service 29 | systemctl disable mysql.service 30 | 31 | invoke_tests "Databases" "MySQL" 32 | -------------------------------------------------------------------------------- /images/macos/tests/RubyGem.Tests.ps1: -------------------------------------------------------------------------------- 1 | $os = Get-OSVersion 2 | 3 | Describe "RubyGems" { 4 | $gemTestCases = Get-ToolsetValue -KeyPath "ruby.rubygems" | ForEach-Object { 5 | @{gemName = $_} 6 | } 7 | 8 | if ($gemTestCases) 9 | { 10 | It "Gem is installed" -TestCases $gemTestCases { 11 | "gem list -i '^$gemName$'" | Should -MatchCommandOutput "true" 12 | } 13 | } 14 | } 15 | 16 | Describe "Bundler" { 17 | It "Bundler" { 18 | "bundler --version" | Should -ReturnZeroExitCode 19 | } 20 | } 21 | 22 | Describe "Nomad shenzhen CLI" -Skip:($os.IsMonterey) { 23 | It "Nomad shenzhen CLI" { 24 | "ipa --version" | Should -ReturnZeroExitCode 25 | } 26 | } 27 | 28 | Describe "Fastlane" { 29 | It "Fastlane" { 30 | "fastlane --version" | Should -ReturnZeroExitCode 31 | } 32 | } 33 | 34 | Describe "xcpretty" { 35 | It "xcpretty" { 36 | "xcpretty --version" | Should -ReturnZeroExitCode 37 | } 38 | } 39 | 40 | Describe "jazzy" { 41 | It "jazzy" { 42 | "jazzy --version" | Should -ReturnZeroExitCode 43 | } 44 | } -------------------------------------------------------------------------------- /images/linux/scripts/installers/sqlpackage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: sqlpackage.sh 4 | ## Desc: Install SqlPackage CLI to DacFx (https://docs.microsoft.com/sql/tools/sqlpackage/sqlpackage-download#get-sqlpackage-net-core-for-linux) 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | source $HELPER_SCRIPTS/install.sh 9 | source $HELPER_SCRIPTS/os.sh 10 | 11 | # Install libssl1.1 dependency 12 | if isUbuntu22; then 13 | download_with_retries "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb" "/tmp" 14 | dpkg -i /tmp/libssl1.1_1.1.1l-1ubuntu1.3_amd64.deb 15 | fi 16 | 17 | # Install SqlPackage 18 | download_with_retries "https://aka.ms/sqlpackage-linux" "." "sqlpackage.zip" 19 | 20 | unzip -qq sqlpackage.zip -d /usr/local/sqlpackage 21 | rm -f sqlpackage.zip 22 | chmod +x /usr/local/sqlpackage/sqlpackage 23 | ln -sf /usr/local/sqlpackage/sqlpackage /usr/local/bin 24 | 25 | invoke_tests "Tools" "SqlPackage" 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 GitHub 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /images/macos/provision/configuration/max-files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | Launch_Daemons="/Library/LaunchDaemons" 4 | 5 | # EOF in quotes to disable variable expansion 6 | echo "Creating limit.maxfiles.plist" 7 | cat > "${Launch_Daemons}/limit.maxfiles.plist" << EOF 8 | 9 | 11 | 12 | 13 | Label 14 | limit.maxfiles 15 | ProgramArguments 16 | 17 | launchctl 18 | limit 19 | maxfiles 20 | 65536 21 | 524288 22 | 23 | RunAtLoad 24 | 25 | ServiceIPC 26 | 27 | 28 | 29 | EOF 30 | 31 | echo "limit.maxfiles.plist permissions changing" 32 | chown root:wheel "${Launch_Daemons}/limit.maxfiles.plist" 33 | chmod 0644 "${Launch_Daemons}/limit.maxfiles.plist" 34 | 35 | 36 | echo "Done, limit.maxfiles has been updated" 37 | 38 | -------------------------------------------------------------------------------- /images/win/scripts/SoftwareReport/SoftwareReport.Java.psm1: -------------------------------------------------------------------------------- 1 | function Get-JavaVersions { 2 | $defaultJavaPath = $env:JAVA_HOME 3 | $javaVersions = Get-Item env:JAVA_HOME_*_X64 4 | $sortRules = @{ 5 | Expression = { [Int32]$_.Name.Split("_")[2] } 6 | Descending = $false 7 | } 8 | 9 | return $javaVersions | Sort-Object $sortRules | ForEach-Object { 10 | $javaPath = $_.Value 11 | # Take semver from the java path 12 | # The path contains '-' sign in the version number instead of '+' due to the following issue, need to substitute it back https://github.com/actions/virtual-environments/issues/3014 13 | $versionInPath = (Split-Path $javaPath) -replace "\w:\\.*\\" 14 | $version = $versionInPath -replace '-', '+' 15 | $defaultPostfix = ($javaPath -eq $defaultJavaPath) ? " (default)" : "" 16 | $VendorName = ($javaPath -like '*Java_Adopt_jdk*') ? "Adopt OpenJDK" : "Eclipse Temurin" 17 | 18 | [PSCustomObject] @{ 19 | "Version" = $version + $defaultPostfix 20 | "Vendor" = $VendorName 21 | "Environment Variable" = $_.Name 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-KubernetesTools.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-KubernetesTools.ps1 3 | ## Desc: Install tools for K8s. 4 | ################################################################################ 5 | 6 | Write-Host "Install Kind" 7 | # Choco installation can't be used because it depends on docker-desktop 8 | $url = 'https://api.github.com/repos/kubernetes-sigs/kind/releases/latest' 9 | [System.String] $kindDownloadLink = (Invoke-RestMethod -Uri $url).assets.browser_download_url -match "kind-windows-amd64$" 10 | $destFilePath = "C:\ProgramData\kind" 11 | $null = New-Item -Path $destFilePath -ItemType Directory -Force 12 | Start-DownloadWithRetry -Url $kindDownloadLink -Name "kind.exe" -DownloadPath $destFilePath 13 | Add-MachinePathItem $destFilePath 14 | 15 | Write-Host "Install Kubectl" 16 | Choco-Install -PackageName kubernetes-cli 17 | 18 | Write-Host "Install Helm" 19 | Choco-Install -PackageName kubernetes-helm 20 | 21 | Write-Host "Install Minikube" 22 | Choco-Install -PackageName minikube 23 | 24 | Invoke-PesterTests -TestFile "Tools" -TestName "KubernetesTools" -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-PowerShellModules.ps1: -------------------------------------------------------------------------------- 1 | # Set TLS1.2 2 | [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" 3 | 4 | Write-Host "Setup PowerShellGet" 5 | Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force 6 | 7 | # Specifies the installation policy 8 | Set-PSRepository -InstallationPolicy Trusted -Name PSGallery 9 | 10 | # Install PowerShell modules 11 | $modules = (Get-ToolsetContent).powershellModules 12 | 13 | foreach($module in $modules) 14 | { 15 | $moduleName = $module.name 16 | Write-Host "Installing ${moduleName} module" 17 | 18 | if ($module.versions) 19 | { 20 | foreach ($version in $module.versions) 21 | { 22 | Write-Host " - $version" 23 | Install-Module -Name $moduleName -RequiredVersion $version -Scope AllUsers -SkipPublisherCheck -Force 24 | } 25 | continue 26 | } 27 | 28 | Install-Module -Name $moduleName -Scope AllUsers -SkipPublisherCheck -Force 29 | } 30 | 31 | Import-Module Pester 32 | Invoke-PesterTests -TestFile "PowerShellModules" -TestName "PowerShellModules" -------------------------------------------------------------------------------- /images/linux/scripts/installers/nodejs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: nodejs.sh 4 | ## Desc: Installs Node.js LTS and related tooling (Gulp, Grunt) 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/install.sh 9 | source "$HELPER_SCRIPTS"/install.sh 10 | 11 | # Install default Node.js 12 | defaultVersion=$(get_toolset_value '.node.default') 13 | curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o ~/n 14 | bash ~/n $defaultVersion 15 | 16 | # Install node modules 17 | node_modules=$(get_toolset_value '.node_modules[].name') 18 | npm install -g $node_modules 19 | 20 | echo "Creating the symlink for [now] command to vercel CLI" 21 | ln -s /usr/local/bin/vercel /usr/local/bin/now 22 | 23 | # fix global modules installation as regular user 24 | # related issue https://github.com/actions/virtual-environments/issues/3727 25 | sudo chmod -R 777 /usr/local/lib/node_modules 26 | sudo chmod -R 777 /usr/local/bin 27 | 28 | rm -rf ~/n 29 | 30 | invoke_tests "Node" "Node.js" 31 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/mono.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: cmake.sh 4 | ## Desc: Installs Mono 5 | ################################################################################ 6 | 7 | LSB_CODENAME=$(lsb_release -cs) 8 | 9 | # Test to see if the software in question is already installed, if not install it 10 | # wget "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -O out && sudo apt-key add out && rm out 11 | 12 | apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF 13 | echo "deb https://download.mono-project.com/repo/ubuntu stable-$LSB_CODENAME main" | tee /etc/apt/sources.list.d/mono-official-stable.list 14 | apt-get update 15 | apt-get install -y --no-install-recommends apt-transport-https mono-complete nuget 16 | 17 | rm /etc/apt/sources.list.d/mono-official-stable.list 18 | rm -f /etc/apt/sources.list.d/mono-official-stable.list.save 19 | echo "mono https://download.mono-project.com/repo/ubuntu stable-$LSB_CODENAME main" >> "$HELPER_SCRIPTS"/apt-sources.txt 20 | 21 | invoke_tests "Tools" "Mono" 22 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/erlang.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: erlang.sh 4 | ## Desc: Installs erlang 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/install.sh 9 | source "$HELPER_SCRIPTS"/install.sh 10 | 11 | source_list=/etc/apt/sources.list.d/eslerlang.list 12 | source_key=/usr/share/keyrings/eslerlang.gpg 13 | 14 | # Install Erlang 15 | wget -q -O - https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | gpg --dearmor > $source_key 16 | echo "deb [signed-by=$source_key] https://packages.erlang-solutions.com/ubuntu $(lsb_release -cs) contrib" > $source_list 17 | apt-get update 18 | apt-get install -y --no-install-recommends esl-erlang 19 | 20 | # Install rebar3 21 | rebar3_url="https://github.com/erlang/rebar3/releases/latest/download/rebar3" 22 | download_with_retries $rebar3_url "/usr/local/bin" "rebar3" 23 | chmod +x /usr/local/bin/rebar3 24 | 25 | # Clean up source list 26 | rm $source_list 27 | rm $source_key 28 | 29 | invoke_tests "Tools" "erlang" 30 | -------------------------------------------------------------------------------- /images/linux/scripts/SoftwareReport/SoftwareReport.Java.psm1: -------------------------------------------------------------------------------- 1 | function Get-JavaVersions { 2 | $javaToolcacheVersions = Get-ChildItem $env:AGENT_TOOLSDIRECTORY/Java*/* -Directory | Sort-Object { [int]$_.Name.Split(".")[0] } 3 | 4 | $existingVersions = $javaToolcacheVersions | ForEach-Object { 5 | $majorVersion = $_.Name.split(".")[0] 6 | $fullVersion = $_.Name.Replace("-", "+") 7 | $defaultJavaPath = $env:JAVA_HOME 8 | $javaPath = Get-Item env:JAVA_HOME_${majorVersion}_X64 9 | 10 | $defaultPostfix = ($javaPath.Value -eq $defaultJavaPath) ? " (default)" : "" 11 | $vendorName = ($_.FullName -like '*Java_Adopt_jdk*') ? "Adopt OpenJDK" : "Eclipse Temurin" 12 | 13 | [PSCustomObject] @{ 14 | "Version" = $fullVersion + $defaultPostfix 15 | "Vendor" = $vendorName 16 | "Environment Variable" = $javaPath.Name 17 | } 18 | } 19 | # Return all the vendors which are not Adopt, also look for version 12 of Adopt (Eclipse Temurin does not have this version) 20 | $versionsToReturn = $existingVersions | Where-Object {$_.Vendor -notlike "Adopt*" -or $_.Version.Split(".")[0] -eq 12} 21 | return $versionsToReturn 22 | } 23 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/Install-PowerShellModules.ps1: -------------------------------------------------------------------------------- 1 | $ErrorActionPreference = 'Stop' 2 | $ProgressPreference = 'SilentlyContinue' 3 | 4 | Import-Module "$env:HELPER_SCRIPTS/Tests.Helpers.psm1" -DisableNameChecking 5 | 6 | # Specifies the installation policy 7 | Set-PSRepository -InstallationPolicy Trusted -Name PSGallery 8 | 9 | # Try to update PowerShellGet before the actual installation 10 | Install-Module -Name PowerShellGet -Force 11 | Update-Module -Name PowerShellGet -Force 12 | 13 | # Install PowerShell modules 14 | $modules = (Get-ToolsetContent).powershellModules 15 | 16 | foreach ($module in $modules) { 17 | $moduleName = $module.name 18 | Write-Host "Installing ${moduleName} module" 19 | 20 | if ($module.versions) { 21 | foreach ($version in $module.versions) { 22 | Write-Host " - $version" 23 | Install-Module -Name $moduleName -RequiredVersion $version -Scope AllUsers -SkipPublisherCheck -Force 24 | } 25 | continue 26 | } 27 | 28 | Install-Module -Name $moduleName -Scope AllUsers -SkipPublisherCheck -Force 29 | } 30 | 31 | Invoke-PesterTests -TestFile 'PowerShellModules' -TestName 'PowerShellModules' 32 | -------------------------------------------------------------------------------- /images/macos/provision/configuration/configure-hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | # Add script for changing hostname to run on startup to prevent duplicate hostnames across the environment. Hostname and Computername should contain .local in name to avoid name resolution issues 4 | tee -a /usr/local/bin/change_hostname.sh > /dev/null <<\EOF 5 | #!/bin/bash -e -o pipefail 6 | 7 | name="Mac-$(python3 -c 'from time import time; print(int(round(time() * 1000)))')" 8 | scutil --set HostName "${name}.local" 9 | scutil --set LocalHostName $name 10 | scutil --set ComputerName "${name}.local" 11 | EOF 12 | 13 | chmod +x "/usr/local/bin/change_hostname.sh" 14 | 15 | sudo tee -a /Library/LaunchDaemons/change_hostname.plist > /dev/null <<\EOF 16 | 17 | 18 | 19 | 20 | Label 21 | change-hostname 22 | Program 23 | /usr/local/bin/change_hostname.sh 24 | RunAtLoad 25 | 26 | 27 | 28 | EOF -------------------------------------------------------------------------------- /images/win/scripts/Installers/Disable-JITDebugger.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Disable Just-In-Time Debugger" 2 | 3 | # Turn off Application Error Debugger 4 | New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug" -Name Debugger -Value "-" -Type String -Force 5 | New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug" -Name Debugger -Value "-" -Type String -Force 6 | 7 | # Turn off the Debug dialog 8 | New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework" -Name DbgManagedDebugger -Value "-" -Type String -Force 9 | New-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\.NETFramework" -Name DbgManagedDebugger -Value "-" -Type String -Force 10 | 11 | # Disable the WER UI 12 | New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name DontShowUI -Value 1 -Type DWORD -Force 13 | # Send all reports to the user's queue 14 | New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting" -Name ForceQueue -Value 1 -Type DWORD -Force 15 | # Default consent choice 1 - Always ask (default) 16 | New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\Consent" -Name DefaultConsent -Value 1 -Type DWORD -Force -------------------------------------------------------------------------------- /images.CI/linux-and-win/create-release.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [UInt32] [Parameter (Mandatory)] $BuildId, 3 | [String] [Parameter (Mandatory)] $Organization, 4 | [String] [Parameter (Mandatory)] $Project, 5 | [String] [Parameter (Mandatory)] $ImageName, 6 | [String] [Parameter (Mandatory)] $DefinitionId, 7 | [String] [Parameter (Mandatory)] $AccessToken 8 | ) 9 | 10 | $Body = @{ 11 | definitionId = $DefinitionId 12 | variables = @{ 13 | ImageBuildId = @{ 14 | value = $BuildId 15 | } 16 | ImageName = @{ 17 | value = $ImageName 18 | } 19 | } 20 | isDraft = "false" 21 | } | ConvertTo-Json -Depth 3 22 | 23 | $URL = "https://vsrm.dev.azure.com/$Organization/$Project/_apis/release/releases?api-version=5.1" 24 | $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("'':${AccessToken}")) 25 | $headers = @{ 26 | Authorization = "Basic ${base64AuthInfo}" 27 | } 28 | 29 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13 30 | $NewRelease = Invoke-RestMethod $URL -Body $Body -Method "POST" -Headers $headers -ContentType "application/json" 31 | 32 | Write-Host "Created release: $($NewRelease._links.web.href)" -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Choco.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Set TLS1.2" 2 | [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" 3 | 4 | Write-Host "Install chocolatey" 5 | $chocoExePath = 'C:\ProgramData\Chocolatey\bin' 6 | 7 | # Add to system PATH 8 | $systemPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) 9 | $systemPath += ';' + $chocoExePath 10 | [Environment]::SetEnvironmentVariable("PATH", $systemPath, [System.EnvironmentVariableTarget]::Machine) 11 | 12 | # Update local process' path 13 | $userPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User) 14 | if ($userPath) { 15 | $env:Path = $systemPath + ";" + $userPath 16 | } else { 17 | $env:Path = $systemPath 18 | } 19 | 20 | # Run the installer 21 | Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) 22 | 23 | # Turn off confirmation 24 | choco feature enable -n allowGlobalConfirmation 25 | 26 | # Initialize environmental variable ChocolateyToolsLocation by invoking choco Get-ToolsLocation function 27 | Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1" -Force 28 | Get-ToolsLocation 29 | -------------------------------------------------------------------------------- /images/macos/provision/core/git.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo Installing Git... 5 | brew_smart_install "git" 6 | 7 | git config --global --add safe.directory "*" 8 | 9 | echo Installing Git LFS 10 | brew_smart_install "git-lfs" 11 | 12 | # Update global git config 13 | git lfs install 14 | # Update system git config 15 | sudo git lfs install --system 16 | 17 | echo Installing Hub 18 | brew_smart_install "hub" 19 | 20 | echo Disable all the Git help messages... 21 | git config --global advice.pushUpdateRejected false 22 | git config --global advice.pushNonFFCurrent false 23 | git config --global advice.pushNonFFMatching false 24 | git config --global advice.pushAlreadyExists false 25 | git config --global advice.pushFetchFirst false 26 | git config --global advice.pushNeedsForce false 27 | git config --global advice.statusHints false 28 | git config --global advice.statusUoption false 29 | git config --global advice.commitBeforeMerge false 30 | git config --global advice.resolveConflict false 31 | git config --global advice.implicitIdentity false 32 | git config --global advice.detachedHead false 33 | git config --global advice.amWorkDir false 34 | git config --global advice.rmHints false 35 | 36 | invoke_tests "Git" 37 | -------------------------------------------------------------------------------- /images/win/scripts/ImageHelpers/test/PathHelpers.Tests.ps1: -------------------------------------------------------------------------------- 1 | . $PSScriptRoot\..\PathHelpers.ps1 2 | 3 | Describe 'Test-MachinePath Tests' { 4 | Mock Get-MachinePath {return "C:\foo;C:\bar"} 5 | It 'Path contains item' { 6 | Test-MachinePath -PathItem "C:\foo" | Should Be $true 7 | } 8 | It 'Path does not containe item' { 9 | Test-MachinePath -PathItem "C:\baz" | Should Be $false 10 | } 11 | } 12 | 13 | Describe 'Set-MachinePath Tests' { 14 | Mock Get-MachinePath {return "C:\foo;C:\bar"} 15 | Mock Set-ItemProperty {return} 16 | It 'Set-MachinePath should return new path' { 17 | Set-MachinePath -NewPath "C:\baz" | Should Be "C:\baz" 18 | } 19 | } 20 | 21 | Describe "Add-MachinePathItem Tests"{ 22 | Mock Get-MachinePath {return "C:\foo;C:\bar"} 23 | Mock Set-ItemProperty {return} 24 | It 'Add-MachinePathItem should return complete path' { 25 | Add-MachinePathItem -PathItem 'C:\baz' | Should Be 'C:\baz;C:\foo;C:\bar' 26 | } 27 | } 28 | 29 | Describe 'Set-SystemVariable Tests' { 30 | Mock Set-ItemProperty {return} 31 | It 'Set-SystemVariable should return new path' { 32 | Set-SystemVariable -SystemVariable "NewPathVar" -Value "C:\baz" | Should Be "C:\baz" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Stack.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Stack.ps1 3 | ## Desc: Install Stack for Windows 4 | ################################################################################ 5 | 6 | Write-Host "Get the latest Stack version..." 7 | $StackReleasesJson = Invoke-RestMethod "https://api.github.com/repos/commercialhaskell/stack/releases/latest" 8 | $Version = $StackReleasesJson.name.TrimStart("v") 9 | $DownloadFilePattern = "windows-x86_64.zip" 10 | $DownloadUrl = $StackReleasesJson.assets | Where-Object { $_.name.EndsWith($DownloadFilePattern) } | Select-Object -ExpandProperty "browser_download_url" -First 1 11 | 12 | Write-Host "Download stack archive" 13 | $StackToolcachePath = Join-Path $Env:AGENT_TOOLSDIRECTORY "stack\$Version" 14 | $DestinationPath = Join-Path $StackToolcachePath "x64" 15 | $StackArchivePath = Start-DownloadWithRetry -Url $DownloadUrl 16 | 17 | Write-Host "Expand stack archive" 18 | Extract-7Zip -Path $StackArchivePath -DestinationPath $DestinationPath 19 | 20 | New-Item -Name "x64.complete" -Path $StackToolcachePath 21 | 22 | Add-MachinePathItem -PathItem $DestinationPath 23 | 24 | Invoke-PesterTests -TestFile "Tools" -TestName "Stack" 25 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-NodeLts.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-NodeLts.ps1 3 | ## Desc: Install nodejs-lts and other common node tools. 4 | ## Must run after python is configured 5 | ################################################################################ 6 | 7 | $PrefixPath = 'C:\npm\prefix' 8 | $CachePath = 'C:\npm\cache' 9 | 10 | New-Item -Path $PrefixPath -Force -ItemType Directory 11 | New-Item -Path $CachePath -Force -ItemType Directory 12 | 13 | $defaultVersion = (Get-ToolsetContent).node.default 14 | $versionToInstall = Get-LatestChocoPackageVersion -TargetVersion $defaultVersion -PackageName "nodejs" 15 | 16 | Choco-Install -PackageName nodejs -ArgumentList "--version=$versionToInstall" 17 | 18 | Add-MachinePathItem $PrefixPath 19 | $env:Path = Get-MachinePath 20 | 21 | setx npm_config_prefix $PrefixPath /M 22 | $env:npm_config_prefix = $PrefixPath 23 | 24 | npm config set cache $CachePath --global 25 | npm config set registry https://registry.npmjs.org/ 26 | 27 | $globalNpmPackages = (Get-ToolsetContent).npm.global_packages 28 | $globalNpmPackages | ForEach-Object { 29 | npm install -g $_.name 30 | } 31 | 32 | Invoke-PesterTests -TestFile "Node" 33 | -------------------------------------------------------------------------------- /images/macos/provision/bootstrap-provisioner/installNewProvisioner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | BOOTSTRAP_PATH="$1" 3 | ProvisionerPackageUri="$2" 4 | ProvisionerScriptUri="$3" 5 | ScriptName="$4" 6 | ScriptParam="$5" 7 | Username="$6" 8 | 9 | export PATH=/usr/bin:/usr/sbin:/usr/local/bin:/bin:/sbin 10 | 11 | PROVISIONER_ROOT=/usr/local/opt/${Username} 12 | mkdir -p ${PROVISIONER_ROOT} 13 | chown ${Username} ${PROVISIONER_ROOT} 14 | 15 | tee -a ${PROVISIONER_ROOT}/runprovisioner.sh > /dev/null <<\EOF 16 | #!/bin/bash 17 | 18 | . ${HOME}/.bashrc 19 | 20 | /usr/local/opt/$USER/provisioner/provisioner 21 | EOF 22 | 23 | chmod +x $PROVISIONER_ROOT/runprovisioner.sh 24 | 25 | aria2c \ 26 | --enable-color=false \ 27 | --file-allocation=none \ 28 | -d ${BOOTSTRAP_PATH} "${ProvisionerPackageUri}" >> ${BOOTSTRAP_PATH}/download.log 29 | 30 | aria2c \ 31 | --enable-color=false \ 32 | --file-allocation=none \ 33 | -d ${BOOTSTRAP_PATH} "${ProvisionerScriptUri}" >> ${BOOTSTRAP_PATH}/download.log 34 | 35 | chmod +x ${BOOTSTRAP_PATH}/${ScriptName} 36 | 37 | # Install Provisioner with provided scripts 38 | eval "$BOOTSTRAP_PATH/$ScriptName $BOOTSTRAP_PATH/$ScriptParam $Username" 2>&1 | tee "$BOOTSTRAP_PATH/install.log" 39 | # State File 40 | touch $BOOTSTRAP_PATH/provisionerDone -------------------------------------------------------------------------------- /images/linux/scripts/installers/rust.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: rust.sh 4 | ## Desc: Installs Rust 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/etc-environment.sh 9 | source "$HELPER_SCRIPTS"/etc-environment.sh 10 | # shellcheck source=/images/linux/scripts/helpers/os.sh 11 | source "$HELPER_SCRIPTS"/os.sh 12 | 13 | export RUSTUP_HOME=/etc/skel/.rustup 14 | export CARGO_HOME=/etc/skel/.cargo 15 | 16 | curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=stable --profile=minimal 17 | 18 | # Initialize environment variables 19 | source $CARGO_HOME/env 20 | 21 | # Install common tools 22 | rustup component add rustfmt clippy 23 | 24 | if isUbuntu22; then 25 | cargo install bindgen cbindgen cargo-audit cargo-outdated 26 | else 27 | cargo install --locked bindgen cbindgen cargo-audit cargo-outdated 28 | fi 29 | 30 | # Cleanup Cargo cache 31 | rm -rf ${CARGO_HOME}/registry/* 32 | 33 | # Update /etc/environemnt 34 | # shellcheck disable=SC2016 35 | prependEtcEnvironmentPath '$HOME/.cargo/bin' 36 | 37 | invoke_tests "Tools" "Rust" 38 | -------------------------------------------------------------------------------- /images/macos/provision/configuration/environment/bashrc: -------------------------------------------------------------------------------- 1 | export LC_CTYPE=en_US.UTF-8 2 | export LC_ALL=en_US.UTF-8 3 | export LANG=en_US.UTF-8 4 | 5 | export ANDROID_HOME=${HOME}/Library/Android/sdk 6 | export ANDROID_SDK_ROOT=${HOME}/Library/Android/sdk 7 | export ANDROID_NDK_HOME=${ANDROID_HOME}/ndk-bundle 8 | export ANDROID_NDK_ROOT=${ANDROID_HOME}/ndk-bundle 9 | 10 | export VM_ASSETS=/usr/local/opt/$USER/scripts 11 | 12 | export NUNIT_BASE_PATH=/Library/Developer/nunit 13 | export NUNIT3_PATH=/Library/Developer/nunit/3.6.0 14 | 15 | export AGENT_TOOLSDIRECTORY=$HOME/hostedtoolcache 16 | export RUNNER_TOOL_CACHE=$HOME/hostedtoolcache 17 | 18 | export PATH=/Library/Frameworks/Mono.framework/Versions/Current/Commands:$PATH 19 | export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK_HOME:$PATH 20 | export PATH=/usr/local/bin:/usr/local/sbin:~/bin:~/.yarn/bin:$PATH 21 | export PATH="/usr/local/opt/curl/bin:$PATH" 22 | export PATH=$HOME/.cargo/bin:$PATH 23 | 24 | export RCT_NO_LAUNCH_PACKAGER=1 25 | export DOTNET_ROOT=$HOME/.dotnet 26 | export DOTNET_MULTILEVEL_LOOKUP=0 27 | 28 | export HOMEBREW_NO_AUTO_UPDATE=1 29 | export HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=3650 30 | export HOMEBREW_CASK_OPTS="--no-quarantine" 31 | 32 | export BOOTSTRAP_HASKELL_NONINTERACTIVE=1 33 | -------------------------------------------------------------------------------- /images/macos/provision/core/python.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | source ~/utils/utils.sh 3 | 4 | echo "Installing Python Tooling" 5 | 6 | echo "Install latest Python 2" 7 | Python2Url="https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg" 8 | download_with_retries $Python2Url "/tmp" "python2.pkg" 9 | sudo installer -pkg /tmp/python2.pkg -target / 10 | pip install --upgrade pip 11 | 12 | echo "Install Python2 certificates" 13 | bash -c "/Applications/Python\ 2.7/Install\ Certificates.command" 14 | 15 | # Close Finder window 16 | if is_Veertu; then 17 | close_finder_window 18 | fi 19 | 20 | # Explicitly overwrite symlinks created by Python2 such as /usr/local/bin/2to3 since they conflict with symlinks from Python3 21 | # https://github.com/actions/virtual-environments/issues/2322 22 | echo "Brew Installing Python 3" 23 | brew_smart_install "python@3.9" || brew link --overwrite python@3.9 24 | 25 | echo "Installing pipx" 26 | export PIPX_BIN_DIR=/usr/local/opt/pipx_bin 27 | export PIPX_HOME=/usr/local/opt/pipx 28 | 29 | brew_smart_install "pipx" 30 | 31 | echo "export PIPX_BIN_DIR=${PIPX_BIN_DIR}" >> "${HOME}/.bashrc" 32 | echo "export PIPX_HOME=${PIPX_HOME}" >> "${HOME}/.bashrc" 33 | echo 'export PATH="$PIPX_BIN_DIR:$PATH"' >> "${HOME}/.bashrc" 34 | 35 | invoke_tests "Python" 36 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Zstd.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-zstd.ps1 3 | ## Desc: Install zstd 4 | ################################################################################ 5 | 6 | $url = "https://api.github.com/repos/facebook/zstd/releases/latest" 7 | # Explicitly set type to string since match returns array by default 8 | [System.String] $zstdLatest = (Invoke-RestMethod -Uri $url).assets.browser_download_url -match "zstd-.+-win64.zip$" 9 | $zstdArchivePath = Start-DownloadWithRetry -Url $zstdLatest -Name "zstd-win64.zip" 10 | 11 | $toolPath = "C:\tools" 12 | $zstdPath = Join-Path $toolPath zstd 13 | $zstdParentName = [IO.Path]::GetFileNameWithoutExtension($zstdLatest) 14 | $filesInArchive = 7z l $zstdArchivePath | Out-String 15 | 16 | if ($filesInArchive.Contains($zstdParentName)) { 17 | Extract-7Zip -Path $zstdArchivePath -DestinationPath $toolPath 18 | Invoke-SBWithRetry -Command { 19 | Move-Item -Path "${zstdPath}*" -Destination $zstdPath -ErrorAction Stop 20 | } 21 | } else { 22 | Extract-7Zip -Path $zstdArchivePath -DestinationPath $zstdPath 23 | } 24 | 25 | # Add zstd-win64 to PATH 26 | Add-MachinePathItem $zstdPath 27 | 28 | Invoke-PesterTests -TestFile "Tools" -TestName "Zstd" 29 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/VisualStudio.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Visual Studio" { 2 | Context "Basic" { 3 | It "Catalog.json" { 4 | Get-VsCatalogJsonPath | Should -Exist 5 | } 6 | 7 | It "Devenv.exe" { 8 | $vsInstallRoot = (Get-VisualStudioInstance).InstallationPath 9 | $devenvexePath = "${vsInstallRoot}\Common7\IDE\devenv.exe" 10 | $devenvexePath | Should -Exist 11 | } 12 | } 13 | 14 | Context "Visual Studio components" { 15 | $expectedComponents = Get-ToolsetContent | Select-Object -ExpandProperty visualStudio | Select-Object -ExpandProperty workloads 16 | $testCases = $expectedComponents | ForEach-Object { @{ComponentName = $_} } 17 | BeforeAll { 18 | $installedComponents = Get-VisualStudioComponents | Select-Object -ExpandProperty Package 19 | } 20 | 21 | It "" -TestCases $testCases { 22 | $installedComponents | Should -Contain $ComponentName 23 | } 24 | } 25 | } 26 | 27 | Describe "Windows 10 SDK" { 28 | It "Verifies 17763 SDK is installed" -Skip:((Test-IsWin16) -or (Test-IsWin19)) { 29 | "${env:ProgramFiles(x86)}\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.17763.0\UAP.props" | Should -Exist 30 | } 31 | } -------------------------------------------------------------------------------- /images/macos/provision/core/haskell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh 4 | export PATH="$HOME/.ghcup/bin:$PATH" 5 | echo 'export PATH="$PATH:$HOME/.ghcup/bin"' >> "$HOME/.bashrc" 6 | 7 | # ghcup output looks like this "ghc 8.6.4 base-4.12.0.0 hls-powered", need to take all the first versions only(8.6.4 in that case) and avoid pre-release ones 8 | availableVersions=$(ghcup list -t ghc -r | grep -v "prerelease" | awk '{print $2}') 9 | 10 | # Install 3 latest major versions(For instance 8.6.5, 8.8.4, 8.10.2) 11 | minorMajorVersions=$(echo "$availableVersions" | cut -d"." -f 1,2 | uniq | tail -n3) 12 | for majorMinorVersion in $minorMajorVersions; do 13 | fullVersion=$(echo "$availableVersions" | grep "$majorMinorVersion." | tail -n1) 14 | echo "install ghc version $fullVersion..." 15 | ghcup install $fullVersion 16 | ghcup set $fullVersion 17 | 18 | # remove docs and profiling libs 19 | ghc_dir="$(ghcup whereis basedir)/ghc/$fullVersion" 20 | [ -e "${ghc_dir}" ] || exit 1 21 | find "${ghc_dir}" \( -name "*_p.a" -o -name "*.p_hi" \) -type f -delete 22 | rm -r "${ghc_dir}"/share/* 23 | unset ghc_bin_dir ghc_dir 24 | done 25 | 26 | echo "install cabal..." 27 | ghcup install-cabal 28 | 29 | invoke_tests "Haskell" 30 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-PHP.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-PHP.ps1 3 | ## Desc: Install PHP 4 | ################################################################################ 5 | 6 | # Install latest PHP in chocolatey 7 | $installDir = "c:\tools\php" 8 | $phpMajorMinor = (Get-ToolsetContent).php.version 9 | $phpVersionToInstall = Get-LatestChocoPackageVersion -TargetVersion $phpMajorMinor -PackageName "php" 10 | Choco-Install -PackageName php -ArgumentList "--params", "/InstallDir:$installDir", "--version=$phpVersionToInstall" 11 | 12 | # Install latest Composer in chocolatey 13 | Choco-Install -PackageName composer -ArgumentList "--ia", "/DEV=$installDir /PHP=$installDir" 14 | 15 | # update path to extensions and enable curl and mbstring extensions, and enable php openssl extensions. 16 | ((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"' -replace ';extension=openssl','extension=openssl') | Set-Content -Path $installDir\php.ini 17 | 18 | # Set the PHPROOT environment variable. 19 | setx PHPROOT $installDir /M 20 | 21 | # Invoke Pester Tests 22 | Invoke-PesterTests -TestFile "PHP" 23 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Rust.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Rust.ps1 3 | ## Desc: Install Rust for Windows 4 | ################################################################################ 5 | 6 | # Rust Env 7 | $env:RUSTUP_HOME = "C:\Users\Default\.rustup" 8 | $env:CARGO_HOME = "C:\Users\Default\.cargo" 9 | 10 | # Download the latest rustup-init.exe for Windows x64 11 | # See https://rustup.rs/# 12 | $rustupPath = Start-DownloadWithRetry -Url "https://win.rustup.rs/x86_64" -Name "rustup-init.exe" 13 | 14 | # Install Rust by running rustup-init.exe (disabling the confirmation prompt with -y) 15 | & $rustupPath -y --default-toolchain=stable --profile=minimal 16 | 17 | # Add %USERPROFILE%\.cargo\bin to USER PATH 18 | Add-DefaultPathItem "%USERPROFILE%\.cargo\bin" 19 | # Add Rust binaries to the path 20 | $env:Path += ";$env:CARGO_HOME\bin" 21 | 22 | # Add i686 target for building 32-bit binaries 23 | rustup target add i686-pc-windows-msvc 24 | 25 | # Install common tools 26 | rustup component add rustfmt clippy 27 | cargo install --locked bindgen cbindgen cargo-audit cargo-outdated 28 | 29 | # Cleanup Cargo crates cache 30 | Remove-Item "${env:CARGO_HOME}\registry\*" -Recurse -Force 31 | 32 | Invoke-PesterTests -TestFile "Rust" 33 | -------------------------------------------------------------------------------- /images.CI/macos/helpers.psm1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | 4 | Helper functions to use in images.CI scripts 5 | #> 6 | 7 | Function Connect-VCServer 8 | { 9 | [CmdletBinding()] 10 | param( 11 | [Parameter(Mandatory)] 12 | [System.String]$VIUserName, 13 | 14 | [Parameter(Mandatory)] 15 | [System.String]$VIPassword, 16 | 17 | [Parameter(Mandatory)] 18 | [System.String]$VIServer 19 | ) 20 | 21 | try 22 | { 23 | # Preference 24 | $global:ProgressPreference = 'SilentlyContinue' 25 | $global:WarningPreference = 'SilentlyContinue' 26 | # Ignore SSL 27 | $null = Set-PowerCLIConfiguration -Scope Session -InvalidCertificateAction Ignore -ParticipateInCEIP $false -Confirm:$false -WebOperationTimeoutSeconds 600 28 | $securePassword = ConvertTo-SecureString -String $VIPassword -AsPlainText -Force 29 | $cred = New-Object System.Management.Automation.PSCredential($VIUserName, $securePassword) 30 | $null = Connect-VIServer -Server $VIServer -Credential $cred -ErrorAction Stop 31 | Write-Host "Connection to the vSphere server has been established" 32 | } 33 | catch 34 | { 35 | Write-Host "##vso[task.LogIssue type=error;]Failed to connect to the vSphere server" 36 | exit 1 37 | } 38 | } -------------------------------------------------------------------------------- /images/linux/scripts/installers/mongodb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: homebrew.sh 4 | ## Desc: Installs Mongo DB 5 | ################################################################################ 6 | 7 | # Source the helpers 8 | # shellcheck source=/images/linux/scripts/helpers/os.sh 9 | source "$HELPER_SCRIPTS"/os.sh 10 | # shellcheck source=/images/linux/scripts/helpers/install.sh 11 | source "$HELPER_SCRIPTS"/install.sh 12 | 13 | REPO_URL="https://repo.mongodb.org/apt/ubuntu" 14 | osLabel=$(getOSVersionLabel) 15 | toolsetVersion=$(get_toolset_value '.mongodb.version') 16 | latestVersion=$(curl $REPO_URL/dists/"$osLabel"/mongodb-org/ | awk -F'>|<' '{print $3}' | grep "^$toolsetVersion" | tail -1) 17 | 18 | # Install Mongo DB 19 | wget -qO - https://www.mongodb.org/static/pgp/server-"$latestVersion".asc | sudo apt-key add - 20 | 21 | echo "deb [ arch=amd64,arm64 ] $REPO_URL $osLabel/mongodb-org/$latestVersion multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-"$latestVersion".list 22 | sudo apt-get update 23 | sudo apt-get install -y mongodb-org 24 | 25 | rm /etc/apt/sources.list.d/mongodb-org-"$latestVersion".list 26 | 27 | echo "mongodb $REPO_URL" >> "$HELPER_SCRIPTS"/apt-sources.txt 28 | 29 | invoke_tests "Databases" "MongoDB" 30 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/aws.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: aws.sh 4 | ## Desc: Installs the AWS CLI, Session Manager plugin for the AWS CLI, and AWS SAM CLI 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/os.sh 9 | source "$HELPER_SCRIPTS"/os.sh 10 | # shellcheck source=/images/linux/scripts/helpers/install.sh 11 | source "$HELPER_SCRIPTS"/install.sh 12 | 13 | download_with_retries "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" "/tmp" "awscliv2.zip" 14 | unzip -qq /tmp/awscliv2.zip -d /tmp 15 | /tmp/aws/install -i /usr/local/aws-cli -b /usr/local/bin 16 | 17 | download_with_retries "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" "/tmp" "session-manager-plugin.deb" 18 | apt install /tmp/session-manager-plugin.deb 19 | 20 | # Download & install the latest aws sam cli release 21 | zipName="aws-sam-cli-linux-x86_64.zip" 22 | zipUrl="https://github.com/aws/aws-sam-cli/releases/latest/download/${zipName}" 23 | download_with_retries $zipUrl "/tmp" $zipName 24 | unzip /tmp/${zipName} -d /tmp 25 | /tmp/install 26 | 27 | invoke_tests "CLI.Tools" "AWS" 28 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/DotnetSDK.Tests.ps1: -------------------------------------------------------------------------------- 1 | $dotnetVersions = (Get-ToolsetContent).dotnet.versions 2 | $dotnetTools = (Get-ToolsetContent).dotnet.tools 3 | 4 | Describe "Dotnet SDK and tools" { 5 | 6 | Context "Default" { 7 | It "Default Dotnet SDK is available" { 8 | "dotnet --version" | Should -ReturnZeroExitCode 9 | } 10 | } 11 | 12 | foreach ($version in $dotnetVersions) { 13 | Context "Dotnet $version" { 14 | $dotnet = @{ dotnetVersion = $version } 15 | 16 | It "SDK $version is available" -TestCases $dotnet { 17 | (dotnet --list-sdks | Where-Object { $_ -match "${dotnetVersion}\.[0-9]*" }).Count | Should -BeGreaterThan 0 18 | } 19 | 20 | It "Runtime $version is available" -TestCases $dotnet { 21 | (dotnet --list-runtimes | Where-Object { $_ -match "${dotnetVersion}\.[0-9]*" }).Count | Should -BeGreaterThan 0 22 | } 23 | } 24 | } 25 | 26 | Context "Dotnet tools" { 27 | $env:Path += ";C:\Users\Default\.dotnet\tools" 28 | $testCases = $dotnetTools | ForEach-Object { @{ ToolName = $_.name; TestInstance = $_.test }} 29 | 30 | It " is available" -TestCases $testCases { 31 | "$TestInstance" | Should -ReturnZeroExitCode 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /images/macos/provision/core/xcode-postbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | source ~/utils/utils.sh 4 | XCODE_LIST=($(get_toolset_value '.xcode.versions | reverse | .[].link')) 5 | DEFAULT_XCODE_VERSION=$(get_toolset_value '.xcode.default') 6 | 7 | # https://github.com/microsoft/appcenter/issues/847 8 | # Assets.xcassets : error : CoreData: error: (6922) I/O error for database 9 | # at $HOME/Library/Developer/Xcode/UserData/IB Support/Simulator Devices/{GUID} 10 | echo "Erase a device's contents and settings:" 11 | for XCODE_VERSION in "${XCODE_LIST[@]}" 12 | do 13 | echo " Xcode Version: ${XCODE_VERSION}" 14 | launchctl remove com.apple.CoreSimulator.CoreSimulatorService || true 15 | #add sleep to let CoreSimulatorService to exit 16 | sleep 3 17 | 18 | # Select xcode version by default 19 | sudo xcode-select -s "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer" 20 | 21 | # Erase a device's contents and settings 22 | xcrun simctl erase all 23 | 24 | #add sleep due to sometimes "xcrun simctl list" takes more than a few moments and script fails when trying to remove CoreSimulatorSerivce 25 | sleep 10 26 | done 27 | 28 | # Select xcode version by default 29 | echo "Setting Xcode ${DEFAULT_XCODE_VERSION} as default" 30 | sudo xcode-select -s "/Applications/Xcode_${DEFAULT_XCODE_VERSION}.app/Contents/Developer" 31 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/CLI.Tools.Tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | Describe "Azure CLI" { 3 | It "Azure CLI" { 4 | "az --version" | Should -ReturnZeroExitCode 5 | } 6 | } 7 | 8 | Describe "Azure DevOps CLI" { 9 | It "az devops" { 10 | "az devops -h" | Should -ReturnZeroExitCode 11 | } 12 | } 13 | 14 | Describe "Aliyun CLI" { 15 | It "Aliyun CLI" { 16 | "aliyun version" | Should -ReturnZeroExitCode 17 | } 18 | } 19 | 20 | 21 | Describe "AWS" { 22 | It "AWS CLI" { 23 | "aws --version" | Should -ReturnZeroExitCode 24 | } 25 | 26 | It "Session Manager Plugin for the AWS CLI" { 27 | session-manager-plugin | Out-String | Should -Match "plugin was installed successfully" 28 | } 29 | 30 | It "AWS SAM CLI" { 31 | "sam --version" | Should -ReturnZeroExitCode 32 | } 33 | } 34 | 35 | 36 | Describe "GitHub CLI" { 37 | It "gh" { 38 | "gh --version" | Should -ReturnZeroExitCode 39 | } 40 | } 41 | 42 | Describe "CloudFoundry CLI" -Skip:(Test-IsWin22) { 43 | It "cf is located in C:\cf-cli" { 44 | "C:\cf-cli\cf.exe" | Should -Exist 45 | } 46 | 47 | It "cf" { 48 | "cf --version" | Should -ReturnZeroExitCode 49 | } 50 | } 51 | 52 | Describe "Hub CLI" { 53 | It "hub is installed" { 54 | "hub --version" | Should -ReturnZeroExitCode 55 | } 56 | } -------------------------------------------------------------------------------- /images/linux/scripts/tests/Apt.Tests.ps1: -------------------------------------------------------------------------------- 1 | Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" 2 | 3 | $cmd = (Get-ToolsetContent).apt.cmd_packages 4 | 5 | Describe "Apt" { 6 | 7 | $testCases = $cmd | ForEach-Object { 8 | @{ toolName = $_ } 9 | } 10 | 11 | It " is available" -TestCases $testCases { 12 | if ($toolName -eq "acl") { 13 | $toolName = "getfacl" 14 | } 15 | 16 | if ($toolName -eq "aria2") 17 | { 18 | $toolName = "aria2c" 19 | } 20 | 21 | if ($toolName -eq "p7zip-full") 22 | { 23 | $toolName = "p7zip" 24 | } 25 | 26 | if ($toolName -eq "subversion") { 27 | $toolName = "svn" 28 | } 29 | 30 | if ($toolName -eq "sphinxsearch") { 31 | $toolName = "searchd" 32 | } 33 | 34 | if ($toolName -eq "binutils") { 35 | $toolName = "strings" 36 | } 37 | 38 | if ($toolName -eq "coreutils") { 39 | $toolName = "tr" 40 | } 41 | 42 | if ($toolName -eq "net-tools") { 43 | $toolName = "netstat" 44 | } 45 | 46 | if ($toolName -eq "mercurial") 47 | { 48 | $toolName = "hg" 49 | } 50 | 51 | (Get-Command -Name $toolName).CommandType | Should -BeExactly "Application" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/kubernetes-tools.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: kubernetes-tools.sh 4 | ## Desc: Installs kubectl, helm, kustomize 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | source $HELPER_SCRIPTS/install.sh 9 | 10 | # Install KIND 11 | URL=$(get_github_package_download_url "kubernetes-sigs/kind" "contains(\"kind-linux-amd64\")") 12 | curl -L -o /usr/local/bin/kind $URL 13 | chmod +x /usr/local/bin/kind 14 | 15 | ## Install kubectl 16 | KUBECTL_VERSION=$(curl -L -s "https://dl.k8s.io/release/stable.txt") 17 | curl -o /usr/local/bin/kubectl -LO "https://dl.k8s.io/release/$KUBECTL_VERSION/bin/linux/amd64/kubectl" 18 | chmod +x /usr/local/bin/kubectl 19 | 20 | # Install Helm 21 | curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash 22 | 23 | # Install minikube 24 | curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 25 | sudo install minikube-linux-amd64 /usr/local/bin/minikube 26 | 27 | # Install kustomize 28 | download_url="https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" 29 | curl -s "$download_url" | bash 30 | mv kustomize /usr/local/bin 31 | 32 | invoke_tests "Tools" "Kubernetes tools" 33 | -------------------------------------------------------------------------------- /images/macos/software-report/SoftwareReport.WebServers.psm1: -------------------------------------------------------------------------------- 1 | function Get-ApacheVersion { 2 | $name = "httpd" 3 | $port = 80 4 | $version = brew list $name --versions | Take-Part -Part 1 5 | $serviceStatus = (brew services list) -match $name | Take-Part -Part 1 6 | $configFile = "$(brew --prefix)/etc/httpd/httpd.conf" 7 | return [PsCustomObject]@{ 8 | "Name" = $name 9 | "Version" = $version 10 | "ConfigFile" = $configFile 11 | "ServiceStatus" = $serviceStatus 12 | "ListenPort" = $port 13 | } 14 | } 15 | 16 | function Get-NginxVersion { 17 | $name = "nginx" 18 | $port = 80 19 | $version = brew list $name --versions | Take-Part -Part 1 20 | $serviceStatus = (brew services list) -match $name | Take-Part -Part 1 21 | $configFile = "$(brew --prefix)/etc/nginx/nginx.conf" 22 | return [PsCustomObject]@{ 23 | "Name" = $name 24 | "Version" = $version 25 | "ConfigFile" = $configFile 26 | "ServiceStatus" = $serviceStatus 27 | "ListenPort" = $port 28 | } 29 | } 30 | 31 | function Build-WebServersSection { 32 | $output = "" 33 | $output += New-MDHeader "Web Servers" -Level 3 34 | $output += @( 35 | (Get-ApacheVersion), 36 | (Get-NginxVersion) 37 | ) | Sort-Object Name | New-MDTable 38 | 39 | $output += New-MDNewLine 40 | return $output 41 | } 42 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/selenium.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: selenium.sh 4 | ## Desc: Installs selenium server 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/install.sh 9 | source "$HELPER_SCRIPTS"/install.sh 10 | 11 | # Download Selenium server 12 | SELENIUM_MAJOR_VERSION=$(get_toolset_value '.selenium.version') 13 | SELENIUM_BINARY_NAME=$(get_toolset_value '.selenium.binary_name') 14 | SELENIUM_JAR_PATH="/usr/share/java" 15 | SELENIUM_JAR_NAME="$SELENIUM_BINARY_NAME.jar" 16 | SELENIUM_DOWNLOAD_URL=$(get_github_package_download_url "SeleniumHQ/selenium" "contains(\"${SELENIUM_BINARY_NAME}-${SELENIUM_MAJOR_VERSION}\") and endswith(\".jar\")") 17 | download_with_retries "$SELENIUM_DOWNLOAD_URL" $SELENIUM_JAR_PATH "$SELENIUM_JAR_NAME" 18 | 19 | # Create an epmty file to retrive selenium version 20 | SELENIUM_FULL_VERSION=$(echo "$SELENIUM_DOWNLOAD_URL" | awk -F"${SELENIUM_BINARY_NAME}-|.jar" '{print $2}') 21 | touch "$SELENIUM_JAR_PATH/$SELENIUM_BINARY_NAME-$SELENIUM_FULL_VERSION" 22 | 23 | # Add SELENIUM_JAR_PATH environment variable 24 | echo "SELENIUM_JAR_PATH=$SELENIUM_JAR_PATH/$SELENIUM_JAR_NAME" | tee -a /etc/environment 25 | 26 | invoke_tests "Tools" "Selenium" 27 | -------------------------------------------------------------------------------- /images.CI/linux-and-win/cleanup.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [String] [Parameter (Mandatory=$true)] $Image, 3 | [String] [Parameter (Mandatory=$true)] $ResourcesNamePrefix, 4 | [String] [Parameter (Mandatory=$true)] $StorageAccount, 5 | [String] [Parameter (Mandatory=$true)] $ClientId, 6 | [String] [Parameter (Mandatory=$true)] $ClientSecret, 7 | [String] [Parameter (Mandatory=$true)] $SubscriptionId, 8 | [String] [Parameter (Mandatory=$true)] $TenantId 9 | ) 10 | 11 | az login --service-principal --username $ClientId --password $ClientSecret --tenant $TenantId | Out-Null 12 | 13 | $TempResourceGroupName = "${ResourcesNamePrefix}_${Image}" 14 | 15 | $groupExist = az group exists --name $TempResourceGroupName --subscription $SubscriptionId 16 | if ($groupExist -eq "true") { 17 | $osDiskName = az group deployment list --resource-group $TempResourceGroupName --query "[].properties.parameters.osDiskName.value" -o tsv 18 | Write-Host "Found a match, deleting temporary files" 19 | az group delete --name $TempResourceGroupName --subscription $SubscriptionId --yes | Out-Null 20 | Write-Host "Temporary group was deleted successfully" 21 | Write-Host "Deleting OS disk" 22 | az storage remove --account-name $StorageAccount -c "images" -n "$osDiskName.vhd" --only-show-errors | Out-Null 23 | Write-Host "OS disk deleted" 24 | } else { 25 | Write-Host "No temporary groups found" 26 | } -------------------------------------------------------------------------------- /images/macos/provision/configuration/preimagedata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e -o pipefail 2 | 3 | source ~/utils/utils.sh 4 | 5 | imagedata_file="$HOME/imagedata.json" 6 | image_version=$(echo $IMAGE_VERSION | cut -d _ -f 2) 7 | os_name=$(sw_vers -productName) 8 | os_version=$(sw_vers -productVersion) 9 | os_build=$(sw_vers -buildVersion) 10 | label_version=$(echo $os_version | cut -d. -f1,2) 11 | if is_Catalina; then 12 | label_version=$(echo $os_version | cut -d. -f1,2) 13 | else 14 | label_version=$(echo $os_version | cut -d. -f1) 15 | fi 16 | image_label="macos-${label_version}" 17 | release_label="macOS-${label_version}" 18 | software_url="https://github.com/actions/virtual-environments/blob/${release_label}/${image_version}/images/macos/${image_label}-Readme.md" 19 | releaseUrl="https://github.com/actions/virtual-environments/releases/tag/${release_label}%2F${image_version}" 20 | 21 | cat < $imagedata_file 22 | [ 23 | { 24 | "group": "Operating System", 25 | "detail": "${os_name}\n${os_version}\n${os_build}" 26 | }, 27 | { 28 | "group": "Virtual Environment", 29 | "detail": "Environment: ${image_label}\nVersion: ${image_version}\nIncluded Software: ${software_url}\nImage Release: ${releaseUrl}" 30 | } 31 | ] 32 | EOF 33 | 34 | echo "export ImageVersion=$image_version" >> $HOME/.bashrc 35 | echo "export ImageOS=$IMAGE_OS" >> $HOME/.bashrc 36 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/firefox.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: firefox.sh 4 | ## Desc: Installs Firefox 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/install.sh 9 | source "$HELPER_SCRIPTS"/install.sh 10 | 11 | # Install Firefox 12 | apt-get install -y firefox 13 | 14 | # add to gloabl system preferences for firefox locale en_US, because other browsers have en_US local. 15 | # Default firefox local is en_GB 16 | echo 'pref("intl.locale.requested","en_US");' >> "/usr/lib/firefox/browser/defaults/preferences/syspref.js" 17 | 18 | # Download and unpack latest release of geckodriver 19 | downloadUrl=$(get_github_package_download_url "mozilla/geckodriver" "test(\"linux64.tar.gz$\")") 20 | echo "Downloading geckodriver $downloadUrl" 21 | download_with_retries "$downloadUrl" "/tmp" geckodriver.tar.gz 22 | 23 | GECKODRIVER_DIR="/usr/local/share/gecko_driver" 24 | GECKODRIVER_BIN="$GECKODRIVER_DIR/geckodriver" 25 | 26 | mkdir -p $GECKODRIVER_DIR 27 | tar -xzf /tmp/geckodriver.tar.gz -C $GECKODRIVER_DIR 28 | 29 | chmod +x $GECKODRIVER_BIN 30 | ln -s "$GECKODRIVER_BIN" /usr/bin/ 31 | echo "GECKOWEBDRIVER=$GECKODRIVER_DIR" | tee -a /etc/environment 32 | 33 | invoke_tests "Browsers" "Firefox" 34 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/julia.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: julia.sh 4 | ## Desc: Installs Julia, and adds Julia to the path 5 | ################################################################################ 6 | 7 | # Source the helpers for use with the script 8 | # shellcheck source=/images/linux/scripts/helpers/install.sh 9 | source "$HELPER_SCRIPTS"/install.sh 10 | 11 | # get the latest julia version 12 | json=$(curl -sL "https://julialang-s3.julialang.org/bin/versions.json") 13 | julia_version=$(echo $json | jq -r '.[].files[] | select(.triplet=="x86_64-linux-gnu" and (.version | contains("-") | not)).version' | sort -V | tail -n1) 14 | 15 | # download julia archive 16 | julia_tar_url=$(echo $json | jq -r ".[].files[].url | select(endswith(\"julia-${julia_version}-linux-x86_64.tar.gz\"))") 17 | julia_tar_name="julia-${julia_version}-linux-x86_64.tar.gz" 18 | download_with_retries $julia_tar_url "/tmp" "${julia_tar_name}" 19 | 20 | # extract files and make symlink 21 | julia_tar_tmp="/tmp/${julia_tar_name}" 22 | julia_installation_path="/usr/local/julia${julia_version}" 23 | mkdir -p "${julia_installation_path}" 24 | tar -C "${julia_installation_path}" -xzf "${julia_tar_tmp}" --strip-components=1 25 | ln -s "${julia_installation_path}/bin/julia" /usr/bin/julia 26 | rm "${julia_tar_tmp}" 27 | 28 | invoke_tests "Tools" "Julia" 29 | -------------------------------------------------------------------------------- /images/win/scripts/Installers/Install-Git.ps1: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## File: Install-Git.ps1 3 | ## Desc: Install Git for Windows 4 | ################################################################################ 5 | Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" 6 | 7 | # Install git 8 | Choco-Install -PackageName git -ArgumentList '--installargs="/VERYSILENT /NORESTART /NOCANCEL /SP- /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /o:PathOption=CmdTools /o:BashTerminalOption=ConHost /o:EnableSymlinks=Enabled /COMPONENTS=gitlfs"' 9 | 10 | Update-SessionEnvironment 11 | 12 | git config --system --add safe.directory "*" 13 | 14 | # Install hub 15 | Choco-Install -PackageName hub 16 | 17 | # Disable GCM machine-wide 18 | [Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine) 19 | 20 | # Add to PATH 21 | Add-MachinePathItem "C:\Program Files\Git\bin" 22 | 23 | if (Test-IsWin16) { 24 | $env:Path += ";$env:ProgramFiles\Git\usr\bin\" 25 | } 26 | 27 | # Add well-known SSH host keys to ssh_known_hosts 28 | ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" 29 | ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts" 30 | 31 | Invoke-PesterTests -TestFile "Git" 32 | Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Hub CLI" 33 | -------------------------------------------------------------------------------- /docs/debugging-failed-builds.md: -------------------------------------------------------------------------------- 1 | # Debugging Failed Packer Builds 2 | 3 | ## Step 1: Run packer build `-on-error=ask` 4 | When you run the `packer build` command, give it the `-on-error=ask` flag. 5 | By default, `packer build` will delete the resource group as soon as the build fails. 6 | `-on-error=ask` will pause it and wait for your input so you have time to remote in to the VM and diagnose the failure. 7 | 8 | When the build fails, you will see this: 9 | 10 | ![Ask on error screenshot](/docs/resources/askOnError.png "Ask on error screenshot") 11 | 12 | ## Step 2: Find the resource group name in the build log 13 | At the beginning of the build log (written to console), find the resource group name for the VM: 14 | 15 | ![Resource group from log screenshot](/docs/resources/resourceGroupName.png "Resource group from log screenshot") 16 | 17 | Log into the Azure Portal. Find that resource group under `Resource groups`. You should see the resources for the Packer build: 18 | 19 | ![Packer resource group in Azure screenshot](/docs/resources/packerResourceGroup.png "Packer resource group in Azure screenshot") 20 | 21 | ## Step 3: Connect to the VM 22 | Select the VM in the resource group. Click `Connect:` 23 | 24 | This will download an RDP file. Open that and enter the credentials found in the JSON file you pass to `packer build`: 25 | 26 | ![VM credentials screenshot](/docs/resources/vmCredentials.png "VM credentials screenshot") 27 | 28 | -------------------------------------------------------------------------------- /images/linux/scripts/installers/pipx-packages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | ################################################################################ 3 | ## File: pipx-packages.sh 4 | ## Desc: Install tools via pipx 5 | ################################################################################ 6 | 7 | # shellcheck source=/images/linux/scripts/helpers/install.sh 8 | source "$HELPER_SCRIPTS"/install.sh 9 | 10 | export PATH="$PATH:/opt/pipx_bin" 11 | export LANG="C.UTF-8" 12 | export LC_ALL="C.UTF-8" 13 | 14 | pipx_packages=$(get_toolset_value ".pipx[] .package") 15 | 16 | for package in $pipx_packages; do 17 | python_version=$(get_toolset_value ".pipx[] | select(.package == \"$package\") .python") 18 | if [ "$python_version" != "null" ]; then 19 | python_path="/opt/hostedtoolcache/Python/$python_version*/x64/bin/python$python_version" 20 | echo "Install $package into python $python_path" 21 | pipx install $package --python $python_path 22 | else 23 | echo "Install $package into default python" 24 | pipx install $package 25 | 26 | # https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html 27 | # Install ansible into an existing ansible-core Virtual Environment 28 | if [[ $package == "ansible-core" ]]; then 29 | pipx inject $package ansible 30 | fi 31 | fi 32 | 33 | done 34 | 35 | invoke_tests "Common" "PipxPackages" 36 | -------------------------------------------------------------------------------- /images/macos/tests/XamarinNDK.Tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" 3 | Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking 4 | Import-Module "$PSScriptRoot/../software-report/SoftwareReport.Android.psm1" -DisableNameChecking 5 | 6 | $os = Get-OSVersion 7 | 8 | Describe "Xamarin NDK" { 9 | BeforeAll { 10 | $androidNdkToolchains = @("mips64el-linux-android-4.9", "mipsel-linux-android-4.9") 11 | $ANDROID_SDK_DIR = Join-Path $env:HOME "Library" "Android" "sdk" 12 | } 13 | 14 | Context "Xamarin NDK toolchains" -Skip:($os.IsHigherThanCatalina) { 15 | $testCases = $androidNdkToolchains | ForEach-Object { @{AndroidNdkToolchain = $_} } 16 | 17 | It "" -TestCases $testCases { 18 | param ([string] $AndroidNdkToolchain) 19 | 20 | $toolchainPath = Join-Path $ANDROID_SDK_DIR "ndk-bundle" "toolchains" $AndroidNdkToolchain 21 | $toolchainPath | Should -Exist 22 | } 23 | } 24 | 25 | Context "Xamarin Legacy NDK versions" -Skip:($os.IsHigherThanCatalina) { 26 | It "Android NDK version r18b is installed" { 27 | $ndk18BundlePath = Join-Path $ANDROID_SDK_DIR "ndk" "18.1.5063045" "source.properties" 28 | $rawContent = Get-Content $ndk18BundlePath -Raw 29 | $rawContent | Should -BeLikeExactly "*Revision = 18.*" 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /images/linux/scripts/tests/CLI.Tools.Tests.ps1: -------------------------------------------------------------------------------- 1 | 2 | Describe "Azure CLI" { 3 | It "Azure CLI" { 4 | "az --version" | Should -ReturnZeroExitCode 5 | } 6 | } 7 | 8 | Describe "Azure DevOps CLI" { 9 | It "az devops" { 10 | "az devops -h" | Should -ReturnZeroExitCode 11 | } 12 | } 13 | 14 | Describe "Aliyun CLI" { 15 | It "Aliyun CLI" { 16 | "aliyun version" | Should -ReturnZeroExitCode 17 | } 18 | } 19 | 20 | Describe "AWS" { 21 | It "AWS CLI" { 22 | "aws --version" | Should -ReturnZeroExitCode 23 | } 24 | 25 | It "Session Manager Plugin for the AWS CLI" { 26 | session-manager-plugin | Out-String | Should -Match "plugin was installed successfully" 27 | } 28 | 29 | It "AWS SAM CLI" { 30 | "sam --version" | Should -ReturnZeroExitCode 31 | } 32 | } 33 | 34 | Describe "GitHub CLI" { 35 | It "gh cli" { 36 | "gh --version" | Should -ReturnZeroExitCode 37 | } 38 | 39 | It "hub is installed" { 40 | "hub --version" | Should -ReturnZeroExitCode 41 | } 42 | } 43 | 44 | Describe "Google Cloud SDK" { 45 | It "Google Cloud SDK" { 46 | "gcloud --version" | Should -ReturnZeroExitCode 47 | } 48 | } 49 | 50 | Describe "OC CLI" { 51 | It "OC CLI" { 52 | "oc version" | Should -ReturnZeroExitCode 53 | } 54 | } 55 | 56 | Describe "Oras CLI" { 57 | It "Oras CLI" { 58 | "oras version" | Should -ReturnZeroExitCode 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /images/win/scripts/Tests/Rust.Tests.ps1: -------------------------------------------------------------------------------- 1 | Describe "Rust" { 2 | BeforeAll { 3 | $env:RUSTUP_HOME = "C:\Users\Default\.rustup" 4 | $env:CARGO_HOME = "C:\Users\Default\.cargo" 5 | $env:Path += ";$env:CARGO_HOME\bin" 6 | } 7 | 8 | $rustTools = @( 9 | @{ToolName = "rustup"; binPath = "C:\Users\Default\.cargo\bin\rustup.exe"} 10 | @{ToolName = "rustc"; binPath = "C:\Users\Default\.cargo\bin\rustc.exe"} 11 | @{ToolName = "cargo"; binPath = "C:\Users\Default\.cargo\bin\cargo.exe"} 12 | @{ToolName = "cargo audit"; binPath = "C:\Users\Default\.cargo\bin\cargo-audit.exe"} 13 | @{ToolName = "cargo outdated"; binPath = "C:\Users\Default\.cargo\bin\cargo-outdated.exe"} 14 | ) 15 | 16 | $rustEnvNotExists = @( 17 | @{envVar = "RUSTUP_HOME"} 18 | @{envVar = "CARGO_HOME"} 19 | ) 20 | 21 | It "C:\Users\Default\.rustup and C:\Users\Default\.cargo folders exist" { 22 | "C:\Users\Default\.rustup", "C:\Users\Default\.cargo" | Should -Exist 23 | } 24 | 25 | It " environment variable does not exist" -TestCases $rustEnvNotExists { 26 | [Environment]::GetEnvironmentVariables("Machine").ContainsKey($envVar) | Should -BeFalse 27 | } 28 | 29 | It " is installed to the '' folder" -TestCases $rustTools { 30 | "$ToolName --version" | Should -ReturnZeroExitCode 31 | $binPath | Should -Exist 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /images/linux/scripts/base/apt-mock.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # A temporary workaround for https://github.com/Azure/azure-linux-extensions/issues/1238 4 | 5 | prefix=/usr/local/bin 6 | 7 | for real_tool in /usr/bin/apt /usr/bin/apt-get /usr/bin/apt-fast /usr/bin/apt-key;do 8 | tool=`basename $real_tool` 9 | cat >$prefix/$tool <\$err 16 | 17 | # no errors, break the loop and continue normal flow 18 | test -f \$err || break 19 | cat \$err >&2 20 | 21 | retry=false 22 | 23 | if grep -q 'Could not get lock' \$err;then 24 | # apt db locked needs retry 25 | retry=true 26 | elif grep -q 'Could not open file /var/lib/apt/lists' \$err;then 27 | # apt update is not completed, needs retry 28 | retry=true 29 | elif grep -q 'IPC connect call failed' \$err;then 30 | # the delay should help with gpg-agent not ready 31 | retry=true 32 | elif grep -q 'Temporary failure in name resolution' \$err;then 33 | # It looks like DNS is not updated with random generated hostname yet 34 | retry=true 35 | elif grep -q 'dpkg frontend is locked by another process' \$err;then 36 | # dpkg process is busy by another process 37 | retry=true 38 | fi 39 | 40 | rm \$err 41 | if [ \$retry = false ]; then 42 | break 43 | fi 44 | 45 | sleep 5 46 | echo "...retry \$i" 47 | i=\$((i + 1)) 48 | done 49 | EOT 50 | chmod +x $prefix/$tool 51 | done 52 | -------------------------------------------------------------------------------- /images/linux/scripts/tests/DotnetSDK.Tests.ps1: -------------------------------------------------------------------------------- 1 | Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" 2 | 3 | Describe "Dotnet and tools" { 4 | 5 | BeforeAll { 6 | $env:PATH = "/etc/skel/.dotnet/tools:$($env:PATH)" 7 | $dotnetSDKs = dotnet --list-sdks | ConvertTo-Json 8 | $dotnetRuntimes = dotnet --list-runtimes | ConvertTo-Json 9 | } 10 | 11 | $dotnetVersions = (Get-ToolsetContent).dotnet.versions 12 | 13 | Context "Default" { 14 | It "Default Dotnet SDK is available" { 15 | "dotnet --version" | Should -ReturnZeroExitCode 16 | } 17 | } 18 | 19 | foreach ($version in $dotnetVersions) { 20 | Context "Dotnet $version" { 21 | $dotnet = @{ dotnetVersion = $version } 22 | 23 | It "SDK $version is available" -TestCases $dotnet { 24 | $dotnetSDKs | Should -Match "$dotnetVersion.[1-9]*" 25 | } 26 | 27 | It "Runtime $version is available" -TestCases $dotnet { 28 | $dotnetRuntimes | Should -Match "$dotnetVersion.[1-9]*" 29 | } 30 | } 31 | } 32 | 33 | Context "Dotnet tools" { 34 | $dotnetTools = (Get-ToolsetContent).dotnet.tools 35 | $testCases = $dotnetTools | ForEach-Object { @{ ToolName = $_.name; TestInstance = $_.test }} 36 | 37 | It " is available" -TestCases $testCases { 38 | "$TestInstance" | Should -ReturnZeroExitCode 39 | } 40 | } 41 | 42 | } 43 | --------------------------------------------------------------------------------