diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..957a75d08 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Do not normalize line endings +* -text \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index b43b1e71c..0694dbabd 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -1,28 +1,28 @@ ---- -name: Bug report -about: Submit a bug report -title: '' -labels: t:Bug report -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is, and why you consider it to be a bug. - -**Virtual environments affected** -- [ ] macOS 10.15 -- [ ] Ubuntu 16.04 LTS -- [ ] Ubuntu 18.04 LTS -- [ ] Windows Server 2016 R2 -- [ ] Windows Server 2019 - -**Expected behavior** -A description of what you expected to happen. - -**Actual behavior** -A description with steps to reproduce the issue. If your have a public example or repo to share, -please provide the link. - -1. Step 1 -2. Step 2 +--- +name: Bug report +about: Submit a bug report +title: '' +labels: t:Bug report +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is, and why you consider it to be a bug. + +**Virtual environments affected** +- [ ] macOS 10.15 +- [ ] Ubuntu 16.04 LTS +- [ ] Ubuntu 18.04 LTS +- [ ] Windows Server 2016 R2 +- [ ] Windows Server 2019 + +**Expected behavior** +A description of what you expected to happen. + +**Actual behavior** +A description with steps to reproduce the issue. If your have a public example or repo to share, +please provide the link. + +1. Step 1 +2. Step 2 diff --git a/.github/ISSUE_TEMPLATE/tool-request.md b/.github/ISSUE_TEMPLATE/tool-request.md index ba9140bd5..fcf42b2bf 100644 --- a/.github/ISSUE_TEMPLATE/tool-request.md +++ b/.github/ISSUE_TEMPLATE/tool-request.md @@ -1,30 +1,30 @@ ---- -name: Tool request -about: Request a new tool or update to a tool -title: Update/Add [tool name] -labels: t:Enhancement -assignees: '' - ---- - -**Tool information** -- Tool name: -- Add or update? -- Desired version: -- Approximate size: -- If this is an add request: - - Brief description of tool: - - URL for tool's homepage: - -**Virtual environments affected** -- [ ] macOS 10.15 -- [ ] Ubuntu 16.04 LTS -- [ ] Ubuntu 18.04 LTS -- [ ] Windows Server 2016 R2 -- [ ] Windows Server 2019 - -**Can this tool be installed during the build?** - - -**Are you willing to submit a PR?** - +--- +name: Tool request +about: Request a new tool or update to a tool +title: Update/Add [tool name] +labels: t:Enhancement +assignees: '' + +--- + +**Tool information** +- Tool name: +- Add or update? +- Desired version: +- Approximate size: +- If this is an add request: + - Brief description of tool: + - URL for tool's homepage: + +**Virtual environments affected** +- [ ] macOS 10.15 +- [ ] Ubuntu 16.04 LTS +- [ ] Ubuntu 18.04 LTS +- [ ] Windows Server 2016 R2 +- [ ] Windows Server 2019 + +**Can this tool be installed during the build?** + + +**Are you willing to submit a PR?** + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..a327f4562 --- /dev/null +++ b/.gitignore @@ -0,0 +1,390 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Typescript v1 declaration files +typings/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# Ignore files generated by packer +InstalledSoftware.md + +# Desktop Service Store +.DS_Store + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# gatsby files +.cache/ +public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# visual studio code launch configuration +launch.json \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..470eddc06 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + // When enabled, will trim trailing whitespace when you save a file. + "files.trimTrailingWhitespace": true +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..da6002dd0 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +// Available variables which can be used inside of strings. +// ${workspaceRoot}: the root folder of the team +// ${file}: the current opened file +// ${relativeFile}: the current opened file relative to workspaceRoot +// ${fileBasename}: the current opened file's basename +// ${fileDirname}: the current opened file's dirname +// ${fileExtname}: the current opened file's extension +// ${cwd}: the current working directory of the spawned process +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + + // Start PowerShell + "windows": { + "command": "${env:windir}/System32/WindowsPowerShell/v1.0/powershell.exe", + //"command": "${env:ProgramFiles}/PowerShell/6.0.0/powershell.exe", + "args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ] + }, + "linux": { + "command": "/usr/bin/powershell", + "args": [ "-NoProfile" ] + }, + "osx": { + "command": "/usr/local/bin/powershell", + "args": [ "-NoProfile" ] + }, + + // Associate with test task runner + "tasks": [ + { + "taskName": "Test", + "suppressTaskName": true, + "isTestCommand": true, + "args": [ + "Write-Host 'Invoking Pester...'; $ProgressPreference = 'SilentlyContinue'; Invoke-Pester -Script test -PesterOption @{IncludeVSCodeMarker=$true};", + "Invoke-Command { Write-Host 'Completed Test task in task runner.' }" + ], + "problemMatcher": "$pester" + } + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..2e287d1be --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,32 @@ +## Contributing + +[fork]: https://github.com/actions/virtual-environments/fork +[pr]: https://github.com//actions/virtual-environments/compare +[code-of-conduct]: CODE_OF_CONDUCT.md + +Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. + +Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [MIT](LICENSE.md). + +Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. + +## Submitting a pull request + +1. [Fork][fork] and clone the repository +1. Create a new branch: `git checkout -b my-branch-name` +1. Make your changes, ensure that they include steps to install and validate post-install (e.g. [kind.sh](images/linux/scripts/installers/kind.sh)). +1. Test your changes by [creating VHD and deploying a VM](help/CreateImageAndAzureResources.md). +1. Push to your fork and [submit a pull request][pr] + +Here are a few things you can do that will increase the likelihood of your pull request being accepted: + +- Follow the style guide for [Powershell](https://github.com/PoshCode/PowerShellPracticeAndStyle) when writing Windows scripts. There is currently no set style for the Shell scripts that run Linux installs :soon:. +- Include complete details of why this is needed in the PR description. If it's a new piece tool being installed, consider cross-platform. If the tool is available in other platforms (MacOS, Windows, Linux), make sure you include it in as many as possible. +- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. +- Write [good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). + +## Resources + +- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) +- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) +- [GitHub Help](https://help.github.com) diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..331b241b3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 GitHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 95949233f..3e43177e1 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,36 @@ -# GitHub Actions Virtual Environments -This repository will contain the code that we use to create the GitHub Actions [virtual environments](https://help.github.com/en/articles/software-in-virtual-environments-for-github-actions). -We're not quite ready to share the code and accept contributions yet. However, we want to gather your software requests and bug reports. -Please use the issue templates to submit requests and bug reports related to the installed software. - -If you need help with how to set up your workflow file or use a specific tool, -check out the [GitHub Actions Community Forum](https://github.community/t5/GitHub-Actions/bd-p/actions). - -## OS's offered -We currently offer Linux, macOS, and Windows virtual environments: - -- **Linux**. We offer Ubuntu 16.04 and Ubuntu 18.04. We do not plan to offer other Linux distributions. If you want to build using other distributions with the hosted virtual environments, we suggest you use Docker. Alternatively, you can host your own VMs and make use of self-hosted runners. -- **macOS**. We offer macOS Catalina 10.15. -- **Windows**. We offer Windows Server 2016 and Windows Server 2019. However, we plan to offer only Windows Server 2019 starting on November 7, 2019. We plan to add Visual Studio 2017 to the Windows Server 2019 virtual environment, but do not yet have a firm ETA. - -## Guidelines for what's installed -We follow these rough guidelines when deciding what to pre-install: - -- Tools and ecosystems that are more popular and widely-used will be given priority. -- More recent versions of tools will be given priority over older versions. -- Tools and versions that are deprecated or have reached end-of-life will not be added. -- Tools and versions will be removed 6 months after they are deprecated or have reached end-of-life. -- If a tool can be installed during the build, we will evaluate how much time is saved -and how much space is used by having the tool pre-installed. - -## Updates to the virtual environments -_Cadence_ - -You can expect approximately weekly updates to the software on the virtual environments. -For some tools, we always install the latest at the time of the deployment; for others, -we pin the tool to specific version(s). - -_Notifications_ - -Right now, we don't have a great way for you to know when updates to the images are coming. -When we have the code available here, you can watch the Releases for when we generate -candidate environments, and when we deploy new ones. +# GitHub Actions Virtual Environments +This repository contains the code that we use to create the GitHub Actions [virtual environments](https://help.github.com/en/articles/software-in-virtual-environments-for-github-actions). +Please use the issue templates to submit requests and bug reports related to the installed software. + +If you need help with how to set up your workflow file or use a specific tool, +check out the [GitHub Actions Community Forum](https://github.community/t5/GitHub-Actions/bd-p/actions). + +## OS's offered +We currently offer Linux, macOS, and Windows virtual environments: + +- **Linux**. We offer Ubuntu 16.04 and Ubuntu 18.04. We do not plan to offer other Linux distributions. If you want to build using other distributions with the hosted virtual environments, we suggest you use Docker. Alternatively, you can host your own VMs and make use of self-hosted runners. +- **macOS**. We offer macOS Catalina 10.15. +- **Windows**. We offer Windows Server 2019. + +## Guidelines for what's installed +We follow these rough guidelines when deciding what to pre-install: + +- Tools and ecosystems that are more popular and widely-used will be given priority. +- More recent versions of tools will be given priority over older versions. +- Tools and versions that are deprecated or have reached end-of-life will not be added. +- Tools and versions will be removed 6 months after they are deprecated or have reached end-of-life. +- If a tool can be installed during the build, we will evaluate how much time is saved +and how much space is used by having the tool pre-installed. + +## Updates to the virtual environments +_Cadence_ + +You can expect approximately weekly updates to the software on the virtual environments. +For some tools, we always install the latest at the time of the deployment; for others, +we pin the tool to specific version(s). + +_Notifications_ + +Right now, we don't have a great way for you to know when updates to the images are coming. +When we have the code available here, you can watch the Releases for when we generate +candidate environments, and when we deploy new ones. \ No newline at end of file diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..f0b196fb7 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,3 @@ +If you discover a security issue in this repo, please submit it through the [GitHub Security Bug Bounty](https://hackerone.com/github) + +Thanks for helping make GitHub Actions safe for everyone. diff --git a/_config.yml b/_config.yml new file mode 100644 index 000000000..c74188174 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-slate \ No newline at end of file diff --git a/help/debuggingFailedBuilds.md b/help/debuggingFailedBuilds.md new file mode 100644 index 000000000..756531d25 --- /dev/null +++ b/help/debuggingFailedBuilds.md @@ -0,0 +1,27 @@ +# Debugging Failed Packer Builds + +## Step 1: Run packer build `-on-error=ask` +When you run the `packer build` command, give it the `-on-error=ask` flag. +By default, `packer build` will delete the resource group as soon as the build fails. +`-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. + +When the build fails, you will see this: + +![Ask on error screenshot](/help/resources/askOnError.png "Ask on error screenshot") + +## Step 2: Find the resource group name in the build log +At the beginning of the build log (written to console), find the resource group name for the VM: + +![Resource group from log screenshot](/help/resources/resourceGroupName.png "Resource group from log screenshot") + +Log into the Azure Portal. Find that resource group under `Resource groups`. You should see the resources for the Packer build: + +![Packer resource group in Azure screenshot](/help/resources/packerResourceGroup.png "Packer resource group in Azure screenshot") + +## Step 3: Connect to the VM +Select the VM in the resource group. Click `Connect:` + +This will download an RDP file. Open that and enter the credentials found in the JSON file you pass to `packer build`: + +![VM credentials screenshot](/help/resources/vmCredentials.png "VM credentials screenshot") + diff --git a/help/resources/askOnError.png b/help/resources/askOnError.png new file mode 100644 index 000000000..fff463b49 Binary files /dev/null and b/help/resources/askOnError.png differ diff --git a/help/resources/packerResourceGroup.png b/help/resources/packerResourceGroup.png new file mode 100644 index 000000000..e06c53517 Binary files /dev/null and b/help/resources/packerResourceGroup.png differ diff --git a/help/resources/resourceGroupName.png b/help/resources/resourceGroupName.png new file mode 100644 index 000000000..366f0dcad Binary files /dev/null and b/help/resources/resourceGroupName.png differ diff --git a/help/resources/vmCredentials.png b/help/resources/vmCredentials.png new file mode 100644 index 000000000..8ede9bdaf Binary files /dev/null and b/help/resources/vmCredentials.png differ diff --git a/helpers/CreateAzureVMFromPackerTemplate.ps1 b/helpers/CreateAzureVMFromPackerTemplate.ps1 new file mode 100644 index 000000000..5abd5742d --- /dev/null +++ b/helpers/CreateAzureVMFromPackerTemplate.ps1 @@ -0,0 +1,72 @@ +Function CreateAzureVMFromPackerTemplate { + <# + .SYNOPSIS + Creates an Azure VM from a template. Also generates network resources in Azure to make the VM accessible. + + .DESCRIPTION + Creates Azure resources and kicks off a packer image generation for the selected image type. + + .PARAMETER SubscriptionId + The Azure subscription Id where resources will be created. + + .PARAMETER ResourceGroupName + The Azure resource group name where the Azure virtual machine will be created. + + .PARAMETER TemplatFilePath + The path for the json template generated by packer during image generation locally. + + .PARAMETER VirtualMachineName + The name of the virtual machine to be generated. + + .PARAMETER AdminUserName + The administrator username for the virtual machine to be created. + + .PARAMETER AdminPassword + The administrator password for the virtual machine to be created. + + .PARAMETER AzureLocation + The location where the Azure virtual machine will be provisioned. Example: "eastus" + + .EXAMPLE + CreateAzureVMFromPackerTemplate -SubscriptionId {YourSubscriptionId} -ResourceGroupName {ResourceGroupName} -TemplateFile "C:\BuildVmImages\temporaryTemplate.json" -VirtualMachineName "testvm1" -AdminUsername "shady1" -AdminPassword "SomeSecurePassword1" -AzureLocation "eastus" + #> + param ( + [Parameter(Mandatory = $True)] + [string] $SubscriptionId, + [Parameter(Mandatory = $True)] + [string] $ResourceGroupName, + [Parameter(Mandatory = $True)] + [string] $TemplateFilePath, + [Parameter(Mandatory = $True)] + [string] $VirtualMachineName, + [Parameter(Mandatory = $True)] + [string] $AdminUsername, + [Parameter(Mandatory = $True)] + [string] $AdminPassword, + [Parameter(Mandatory = $True)] + [string] $AzureLocation + ) + + $vmSize = "Standard_DS2_v2" + $vnetName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() + $subnetName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() + $nicName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() + $publicIpName = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper() + + Write-Host "Creating a Vnet and a Subnet" + az network vnet create -g $ResourceGroupName -l $AzureLocation --name $vnetName --address-prefix 10.0.0.0/16 --subscription $subscriptionId + az network vnet subnet create -g $ResourceGroupName --vnet-name $vnetName -n $subnetName --address-prefix 10.0.1.0/24 --subscription $subscriptionId + + Write-Host "Creating a network interface card (NIC)." + $nic = az network nic create -g $ResourceGroupName --vnet-name $vnetName --subnet $subnetName -n $nicName --subscription $subscriptionId + $networkId = ($nic | ConvertFrom-Json).NewNIC.id + + Write-Host "create public IP." + az network public-ip create -g $ResourceGroupName -n $publicIpName --subscription $subscriptionId --allocation-method Static --location $AzureLocation --sku Standard --version IPv4 + + Write-Host "Adding the public IP to the NIC." + az network nic ip-config update --name ipconfig1 --nic-name $nicName --resource-group $ResourceGroupName --subscription $subscriptionId --public-ip-address $publicIpName + + Write-Host "Creating the VM" + az group deployment create --resource-group $ResourceGroupName --subscription $subscriptionId --name $VirtualMachineName --template-file $templateFilePath --parameters vmSize=$vmSize vmName=$VirtualMachineName adminUserName=$AdminUsername adminPassword=$AdminPassword networkInterfaceId=$networkId +} diff --git a/helpers/GenerateResourcesAndImage.ps1 b/helpers/GenerateResourcesAndImage.ps1 new file mode 100644 index 000000000..4dc2ed532 --- /dev/null +++ b/helpers/GenerateResourcesAndImage.ps1 @@ -0,0 +1,155 @@ +$ErrorActionPreference = 'Stop' + +enum ImageType { + Windows2019 = 0 + Ubuntu1604 = 1 + Ubuntu1804 = 2 +} + +Function Get-PackerTemplatePath { + param ( + [Parameter(Mandatory = $True)] + [string] $RepositoryRoot, + [Parameter(Mandatory = $True)] + [ImageType] $ImageType + ) + + $relativePath = "N/A" + + switch ($ImageType) { + ([ImageType]::WindowsLatest) { + $relativePath = "\images\win\Windows2019-Azure.json" + } + ([ImageType]::Ubuntu1604) { + $relativePath = "\images\linux\ubuntu1604.json" + } + ([ImageType]::Ubuntu1804) { + $relativePath = "\images\linux\ubuntu1804.json" + } + } + + return $RepositoryRoot + $relativePath; +} + +Function GenerateResourcesAndImage { + <# + .SYNOPSIS + A helper function to help generate an image. + + .DESCRIPTION + Creates Azure resources and kicks off a packer image generation for the selected image type. + + .PARAMETER SubscriptionId + The Azure subscription Id where resources will be created. + + .PARAMETER ResourceGroupName + The Azure resource group name where the Azure resources will be created. + + .PARAMETER ImageGenerationRepositoryRoot + The root path of the image generation repository source. + + .PARAMETER ImageType + The type of the image being generated. Valid options are: {"WindowsLatest", "Ubuntu1604", "Ubuntu1804"}. + + .PARAMETER AzureLocation + The location of the resources being created in Azure. For example "East US". + + .PARAMETER Force + Delete the resource group if it exists without user confirmation. + + .EXAMPLE + GenerateResourcesAndImage -SubscriptionId {YourSubscriptionId} -ResourceGroupName "shsamytest1" -ImageGenerationRepositoryRoot "C:\azure-pipelines-image-generation" -ImageType Ubuntu1604 -AzureLocation "East US" + #> + param ( + [Parameter(Mandatory = $True)] + [string] $SubscriptionId, + [Parameter(Mandatory = $True)] + [string] $ResourceGroupName, + [Parameter(Mandatory = $True)] + [string] $ImageGenerationRepositoryRoot, + [Parameter(Mandatory = $True)] + [ImageType] $ImageType, + [Parameter(Mandatory = $True)] + [string] $AzureLocation, + [Parameter(Mandatory = $False)] + [int] $SecondsToWaitForServicePrincipalSetup = 30, + [Parameter(Mandatory = $False)] + [Switch] $Force + ) + + $builderScriptPath = Get-PackerTemplatePath -RepositoryRoot $ImageGenerationRepositoryRoot -ImageType $ImageType + $ServicePrincipalClientSecret = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper(); + $InstallPassword = $env:UserName + [System.GUID]::NewGuid().ToString().ToUpper(); + + Login-AzureRmAccount + Set-AzureRmContext -SubscriptionId $SubscriptionId + + $alreadyExists = $true; + try { + Get-AzureRmResourceGroup -Name $ResourceGroupName + Write-Verbose "Resource group was found, will delete and recreate it." + } + catch { + Write-Verbose "Resource group was not found, will create it." + $alreadyExists = $false; + } + + if ($alreadyExists) { + if($Force -eq $true) { + # Cleanup the resource group if it already exitsted before + Remove-AzureRmResourceGroup -Name $ResourceGroupName -Force + New-AzureRmResourceGroup -Name $ResourceGroupName -Location $AzureLocation + } else { + $title = "Delete Resource Group" + $message = "The resource group you specified already exists. Do you want to clean it up?" + + $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", ` + "Delete the resource group including all resources." + + $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", ` + "Keep the resource group and continue." + + $stop = New-Object System.Management.Automation.Host.ChoiceDescription "&Stop", ` + "Stop the current action." + + $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no, $stop) + $result = $host.ui.PromptForChoice($title, $message, $options, 0) + + switch ($result) + { + 0 { Remove-AzureRmResourceGroup -Name $ResourceGroupName -Force; New-AzureRmResourceGroup -Name $ResourceGroupName -Location $AzureLocation } + 1 { <# Do nothing #> } + 2 { exit } + } + } + } else { + New-AzureRmResourceGroup -Name $ResourceGroupName -Location $AzureLocation + } + + # This script should follow the recommended naming conventions for azure resources + $storageAccountName = if($ResourceGroupName.EndsWith("-rg")) { + $ResourceGroupName.Substring(0, $ResourceGroupName.Length -3) + } else { $ResourceGroupName } + + # Resource group names may contain special characters, that are not allowed in the storage account name + $storageAccountName = $storageAccountName.Replace("-", "").Replace("_", "").Replace("(", "").Replace(")", "").ToLower() + $storageAccountName += "001" + + New-AzureRmStorageAccount -ResourceGroupName $ResourceGroupName -AccountName $storageAccountName -Location $AzureLocation -SkuName "Standard_LRS" + + $spDisplayName = [System.GUID]::NewGuid().ToString().ToUpper() + $sp = New-AzureRmADServicePrincipal -DisplayName $spDisplayName -Password (ConvertTo-SecureString $ServicePrincipalClientSecret -AsPlainText -Force) + + $spAppId = $sp.ApplicationId + $spClientId = $sp.ApplicationId + $spObjectId = $sp.Id + Start-Sleep -Seconds $SecondsToWaitForServicePrincipalSetup + + New-AzureRmRoleAssignment -RoleDefinitionName Contributor -ServicePrincipalName $spAppId + Start-Sleep -Seconds $SecondsToWaitForServicePrincipalSetup + $sub = Get-AzureRmSubscription -SubscriptionId $SubscriptionId + $tenantId = $sub.TenantId + # "", "Note this variable-setting script for running Packer with these Azure resources in the future:", "==============================================================================================", "`$spClientId = `"$spClientId`"", "`$ServicePrincipalClientSecret = `"$ServicePrincipalClientSecret`"", "`$SubscriptionId = `"$SubscriptionId`"", "`$tenantId = `"$tenantId`"", "`$spObjectId = `"$spObjectId`"", "`$AzureLocation = `"$AzureLocation`"", "`$ResourceGroupName = `"$ResourceGroupName`"", "`$storageAccountName = `"$storageAccountName`"", "`$install_password = `"$install_password`"", "" + + packer.exe build -on-error=ask -var "client_id=$($spClientId)" -var "client_secret=$($ServicePrincipalClientSecret)" -var "subscription_id=$($SubscriptionId)" -var "tenant_id=$($tenantId)" -var "object_id=$($spObjectId)" -var "location=$($AzureLocation)" -var "resource_group=$($ResourceGroupName)" -var "storage_account=$($storageAccountName)" -var "install_password=$($InstallPassword)" $builderScriptPath +} diff --git a/images/linux/Ubuntu1604-README.md b/images/linux/Ubuntu1604-README.md new file mode 100644 index 000000000..3c592fa00 --- /dev/null +++ b/images/linux/Ubuntu1604-README.md @@ -0,0 +1,260 @@ +# Hosted Ubuntu 1604 Image (Ubuntu 16.04.6 LTS) +The following software is installed on machines in the Hosted Ubuntu 1604 (20190930.2) pool +*** +- 7-Zip 9.20 +- Ansible (ansible 2.8.5) +- AzCopy (azcopy 7.3.0-netcore) +- Azure CLI (azure-cli 2.0.74) +- Azure CLI (azure-devops 0.12.0) +- Basic CLI: + - curl + - dnsutils + - file + - ftp + - iproute2 + - iputils-ping + - jq + - libcurl3 + - libicu55 + - libunwind8 + - locales + - netcat + - openssh-client + - rsync + - shellcheck + - sudo + - telnet + - time + - unzip + - wget + - zip + - tzdata +- AWS CLI (aws-cli/1.16.248 Python/2.7.12 Linux/4.15.0-1057-azure botocore/1.12.238) +- build-essential +- Clang 6.0 (clang version 6.0.1-svn334776-1~exp1~20190309042730.123 (branches/release_60)) +- CMake (cmake version 3.12.4) +- Docker Compose (docker-compose version 1.22.0, build f46880fe) +- Docker (Docker version 3.0.6, build a63faebc) +- Docker (Docker version 3.0.6, build a63faebc) +- .NET Core SDK 1.0.1 +- .NET Core SDK 1.0.4 +- .NET Core SDK 1.1.10 +- .NET Core SDK 1.1.11 +- .NET Core SDK 1.1.12 +- .NET Core SDK 1.1.13 +- .NET Core SDK 1.1.4 +- .NET Core SDK 1.1.5 +- .NET Core SDK 1.1.7 +- .NET Core SDK 1.1.8 +- .NET Core SDK 1.1.9 +- .NET Core SDK 2.0.0 +- .NET Core SDK 2.0.3 +- .NET Core SDK 2.1.100 +- .NET Core SDK 2.1.101 +- .NET Core SDK 2.1.102 +- .NET Core SDK 2.1.103 +- .NET Core SDK 2.1.104 +- .NET Core SDK 2.1.105 +- .NET Core SDK 2.1.2 +- .NET Core SDK 2.1.200 +- .NET Core SDK 2.1.201 +- .NET Core SDK 2.1.202 +- .NET Core SDK 2.1.300 +- .NET Core SDK 2.1.301 +- .NET Core SDK 2.1.302 +- .NET Core SDK 2.1.4 +- .NET Core SDK 2.1.400 +- .NET Core SDK 2.1.401 +- .NET Core SDK 2.1.402 +- .NET Core SDK 2.1.403 +- .NET Core SDK 2.1.500 +- .NET Core SDK 2.1.502 +- .NET Core SDK 2.1.503 +- .NET Core SDK 2.1.504 +- .NET Core SDK 2.1.505 +- .NET Core SDK 2.2.100 +- .NET Core SDK 2.2.101 +- .NET Core SDK 2.2.102 +- .NET Core SDK 2.2.103 +- .NET Core SDK 2.2.104 +- .NET Core SDK 2.2.105 +- .NET Core SDK 3.0 +- Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 10.5) +- Firefox (Mozilla Firefox 69.0.1) +- GNU C++ 7.4.0 +- Git (2.23.0) +- Git Large File Storage (LFS) (2.8.0) +- Go 1.9 (go version go1.9.7 linux/amd64) +- Go 1.10 (go version go1.10.8 linux/amd64) +- Go 1.11 (go version go1.11.12 linux/amd64) +- Go 1.12 (go version go1.12.7 linux/amd64) +- Go 1.13 (go version go1.13 linux/amd64) +- Google Chrome (Google Chrome 77.0.3865.90 ) +- Google Cloud SDK (264.0.0) +- Haskell Cabal (cabal-install version 2.0.0.1 +compiled using version 2.0.1.1 of the Cabal library ) +- Haskell Cabal (cabal-install version 2.2.0.0 +compiled using version 2.2.0.1 of the Cabal library ) +- Haskell Cabal (cabal-install version 2.4.1.0 +compiled using version 2.4.1.0 of the Cabal library ) +- Haskell Cabal (cabal-install version 3.0.0.0 +compiled using version 3.0.0.0 of the Cabal library ) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.0.2) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.2.2) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.4.4) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.6.2) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.6.3) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.6.4) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.6.5) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.8.1) +- Haskell Stack (Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2) +- Heroku (heroku/7.31.0 linux-x64 node-v11.14.0) +- HHVM (HipHop VM 4.24.0 (rel)) +- ImageMagick +- Azul Zulu OpenJDK (7) (openjdk version "1.7.0_232") +- Azul Zulu OpenJDK (8) (openjdk version "1.8.0_222") +- Azul Zulu OpenJDK (11) (openjdk version "11.0.4" 2019-07-16 LTS) +- Azul Zulu OpenJDK (12) (openjdk version "12.0.2" 2019-07-16) +- Ant (Apache Ant(TM) version 1.9.6 compiled on July 20 2018) +- Gradle 5.6.2 +- Maven (Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T19:00:29Z)) +- kubectl (Client Version: v1.16.0) +- helm (Client: v2.14.3+g0e7f3b6) +- Leiningen (Leiningen 2.9.1 on Java 1.8.0_222 OpenJDK 64-Bit Server VM) +- Mercurial (Mercurial Distributed SCM (version 4.4.1)) +- Miniconda (conda 4.7.10) +- Mono (Mono JIT compiler version 6.4.0.198 (tarball Tue Sep 24 01:20:30 UTC 2019)) +- MySQL (mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using EditLine wrapper) +- MySQL Server (user:root password:root) +- MS SQL Server Client Tools +- Node.js (v10.16.3) +- Bower (1.8.8) +- Grunt (grunt-cli v1.2.0) +- Gulp (CLI version: 2.2.0 +Local version: Unknown) +- n (6.0.1) +- Parcel (1.12.3) +- TypeScript (Version 3.6.3) +- Webpack (4.41.0) +- Webpack CLI (3.3.9) +- Yarn (1.19.0) +- PhantomJS (2.1.1) +- PHP 5.6 (PHP 5.6.40-12+ubuntu16.04.1+deb.sury.org+1 (cli) ) +- PHP 7.0 (PHP 7.0.33-11+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 13:30:45) ( NTS )) +- PHP 7.1 (PHP 7.1.32-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 13:28:17) ( NTS )) +- PHP 7.2 (PHP 7.2.22-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 12:54:12) ( NTS )) +- PHP 7.3 (PHP 7.3.9-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 12:54:04) ( NTS )) +- Composer (Composer version 1.9.0 2019-08-02 20:55:32) +- PHPUnit (PHPUnit 7.5.16 by Sebastian Bergmann and contributors.) +- Pollinate +- Powershell (PowerShell 6.2.3) +- rustup (1.19.0) +- rust (1.38.0) +- cargo (1.38.0) +- rustfmt (1.4.4-stable) +- clippy (0.0.212) +- rustdoc (1.38.0) +- bindgen (execute +the +0.51.1) +- cbindgen (0.9.1) +- Scala +- Sphinx Open Source Search Server +- Subversion (svn, version 1.9.3 (r1718519)) +- Terraform (Terraform v0.12.9) +- Vcpkg 2019.09.12-unknownhash +- Zeit Now CLI (16.3.0) +- Google Repository 58 +- Google Play services 49 +- Google APIs 24 +- Google APIs 23 +- Google APIs 22 +- Google APIs 21 +- CMake 3.6.4111459 +- Android Support Repository 47.0.0 +- Android Solver for ConstraintLayout 1.0.2 +- Android Solver for ConstraintLayout 1.0.1 +- Android SDK Platform-Tools 29.0.4 +- Android SDK Platform 29 +- Android SDK Platform 28 +- Android SDK Platform 27 +- Android SDK Platform 26 +- Android SDK Platform 25 +- Android SDK Platform 24 +- Android SDK Platform 23 +- Android SDK Platform 22 +- Android SDK Platform 21 +- Android SDK Platform 19 +- Android SDK Platform 17 +- Android SDK Platform 15 +- Android SDK Platform 10 +- Android SDK Patch Applier v4 +- Android SDK Build-Tools 29.0.2 +- Android SDK Build-Tools 29.0.0 +- Android SDK Build-Tools 28.0.3 +- Android SDK Build-Tools 28.0.2 +- Android SDK Build-Tools 28.0.1 +- Android SDK Build-Tools 28.0.0 +- Android SDK Build-Tools 27.0.3 +- Android SDK Build-Tools 27.0.2 +- Android SDK Build-Tools 27.0.1 +- Android SDK Build-Tools 27.0.0 +- Android SDK Build-Tools 26.0.3 +- Android SDK Build-Tools 26.0.2 +- Android SDK Build-Tools 26.0.1 +- Android SDK Build-Tools 26.0.0 +- Android SDK Build-Tools 25.0.3 +- Android SDK Build-Tools 25.0.2 +- Android SDK Build-Tools 25.0.1 +- Android SDK Build-Tools 25.0.0 +- Android SDK Build-Tools 24.0.3 +- Android SDK Build-Tools 24.0.2 +- Android SDK Build-Tools 24.0.1 +- Android SDK Build-Tools 24.0.0 +- Android SDK Build-Tools 23.0.3 +- Android SDK Build-Tools 23.0.2 +- Android SDK Build-Tools 23.0.1 +- Android SDK Build-Tools 22.0.1 +- Android SDK Build-Tools 21.1.2 +- Android SDK Build-Tools 20.0.0 +- Android SDK Build-Tools 19.1.0 +- Android SDK Build-Tools 17.0.0 +- Android NDK 20.0.5594570 +- Android ConstraintLayout 1.0.2 +- Android ConstraintLayout 1.0.1 +- Az Module (1.0.0) +- Az Module (1.6.0) +- Az Module (2.3.2) +- Az Module (2.6.0) +- Cached container images + - jekyll/builder:latest (Digest: sha256:9182fe84c46f8c196fc89d5c960839053a31e246c39994f30498fbcf70cd4b04) + - node:10 (Digest: sha256:a2bc0489b71f88b358d2ed66efe0025b1896032ca6fd52df780426ce1acd18be) + - node:12 (Digest: sha256:cda22332e2dd46807a14d3268ee3fb298651386ad1f03cfd58772a7dc65f89c7) + - buildpack-deps:stretch (Digest: sha256:9e704902086098039b91927801b84925fbc29bd79133b582bcbea6a19f0362ca) + - debian:9 (Digest: sha256:5fb93ce7a427b7c1c2374d5c29d68a159de7d5e781deeda422f8d51a1a9b6480) + - debian:8 (Digest: sha256:a97db35fa665312803a229cb97fd921a884d0ef3be8cca008e958a7c936c2e7f) + - node:12-alpine (Digest: sha256:744b156ec2dca0ad8291f80f9093273d45eb85378b6290b2fbbada861cc3ed01) + - alpine:3.10 (Digest: sha256:72c42ed48c3a2db31b7dafe17d275b634664a708d901ec9fd57b1529280f01fb) + - node:10-alpine (Digest: sha256:77c898d0da5e7bfb6e05c9a64de136ba4e03889a72f3c298e95df822a38f450d) + - alpine:3.9 (Digest: sha256:7746df395af22f04212cd25a92c1d6dbc5a06a0ca9579a229ef43008d4d1302a) + - alpine:3.7 (Digest: sha256:8421d9a84432575381bfabd248f1eb56f3aa21d9d7cd2511583c68c9b7511d10) + - alpine:3.8 (Digest: sha256:04696b491e0cc3c58a75bace8941c14c924b9f313b03ce5029ebbc040ed9dcd9) + - mcr.microsoft.com/azure-pipelines/node8-typescript:latest (Digest: sha256:e52e60b9f71183969830a3664279b5d8c799b4b0ec2c25a0686f7c02f6a9669a) +- Python (available through the [setup-python](https://github.com/actions/setup-python/blob/master/README.md) task) + - Python 2.7.16 + - Python 3.4.10 + - Python 3.5.7 + - Python 3.6.9 + - Python 3.7.4 +- Ruby (available through the [setup-ruby](https://github.com/actions/setup-ruby/blob/master/README.md) task) + - Ruby 2.3.7 + - Ruby 2.4.6 + - Ruby 2.5.5 + - Ruby 2.6.3 +- Python (Python 2.7.12) +- pip (pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)) +- Python3 (Python 3.5.2) +- pip3 (pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)) +- PyPy2 ([PyPy 7.1.0 with GCC 6.2.0 20160901]) +- PyPy3 ([PyPy 7.0.0 with GCC 6.2.0 20160901]) +- Boost C++ Libraries 1.69.0 \ No newline at end of file diff --git a/images/linux/Ubuntu1804-README.md b/images/linux/Ubuntu1804-README.md new file mode 100644 index 000000000..43ad1a004 --- /dev/null +++ b/images/linux/Ubuntu1804-README.md @@ -0,0 +1,250 @@ +# Hosted Ubuntu 1804 Image (Ubuntu 18.04.3 LTS) +The following software is installed on machines in the Hosted Ubuntu 1804 (v20190930.2) pool +*** +- 7-Zip 16.02 +- Ansible (ansible 2.8.5) +- AzCopy (azcopy 7.3.0-netcore) +- Azure CLI (azure-cli 2.0.74) +- Azure CLI (azure-devops 0.12.0) +- Basic CLI: + - curl + - dnsutils + - file + - ftp + - iproute2 + - iputils-ping + - jq + - libcurl3 + - libicu55 + - libunwind8 + - locales + - netcat + - openssh-client + - rsync + - shellcheck + - sudo + - telnet + - time + - unzip + - wget + - zip + - tzdata +- AWS CLI (aws-cli/1.16.248 Python/2.7.15+ Linux/5.0.0-1018-azure botocore/1.12.238) +- build-essential +- Clang 6.0 (clang version 6.0.1-svn334776-1~exp1~20190309042703.125 (branches/release_60)) +- CMake (cmake version 3.12.4) +- Docker Compose (docker-compose version 1.22.0, build f46880fe) +- Docker (Docker version 3.0.6, build a63faebc) +- Docker (Docker version 3.0.6, build a63faebc) +- .NET Core SDK: + - 2.2.402 + - 2.2.401 + - 2.2.301 + - 2.2.300 + - 2.2.206 + - 2.2.205 + - 2.2.204 + - 2.2.203 + - 2.2.202 + - 2.2.109 + - 2.2.108 + - 2.2.107 + - 2.2.106 + - 2.2.105 + - 2.2.104 + - 2.2.103 + - 2.2.102 + - 2.2.101 + - 2.2.100 + - 2.1.802 + - 2.1.801 + - 2.1.701 + - 2.1.700 + - 2.1.606 + - 2.1.605 + - 2.1.604 + - 2.1.603 + - 2.1.602 + - 2.1.509 + - 2.1.508 + - 2.1.507 + - 2.1.506 + - 2.1.505 + - 2.1.504 + - 2.1.503 + - 2.1.502 + - 2.1.500 + - 2.1.403 + - 2.1.402 + - 2.1.401 + - 2.1.302 + - 2.1.301 + - 2.1.300 +- Erlang (Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 10.5) +- Firefox (Mozilla Firefox 69.0.1) +- GNU C++ 7.4.0 +- Git (2.23.0) +- Git Large File Storage (LFS) (2.8.0) +- Go 1.11 (go version go1.11.12 linux/amd64) +- Go 1.12 (go version go1.12.7 linux/amd64) +- Go 1.13 (go version go1.13 linux/amd64) +- Google Chrome (Google Chrome 77.0.3865.90 ) +- Google Cloud SDK (264.0.0) +- Haskell Cabal (cabal-install version 2.0.0.1 +compiled using version 2.0.1.1 of the Cabal library ) +- Haskell Cabal (cabal-install version 2.2.0.0 +compiled using version 2.2.0.1 of the Cabal library ) +- Haskell Cabal (cabal-install version 2.4.1.0 +compiled using version 2.4.1.0 of the Cabal library ) +- Haskell Cabal (cabal-install version 3.0.0.0 +compiled using version 3.0.0.0 of the Cabal library ) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.0.2) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.2.2) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.4.4) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.6.2) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.6.3) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.6.4) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.6.5) +- GHC (The Glorious Glasgow Haskell Compilation System, version 8.8.1) +- Haskell Stack (Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2) +- Heroku (heroku/7.31.0 linux-x64 node-v11.14.0) +- HHVM (HipHop VM 4.24.0 (rel)) +- ImageMagick +- Azul Zulu OpenJDK (7) (openjdk version "1.7.0_232") +- Azul Zulu OpenJDK (8) (openjdk version "1.8.0_222") +- Azul Zulu OpenJDK (11) (openjdk version "11.0.4" 2019-07-16 LTS) +- Azul Zulu OpenJDK (12) (openjdk version "12.0.2" 2019-07-16) +- Ant (Apache Ant(TM) version 1.10.5 compiled on March 28 2019) +- Gradle 5.6.2 +- Maven (Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T19:00:29Z)) +- kubectl (Client Version: v1.16.0) +- helm (Client: v2.14.3+g0e7f3b6) +- Leiningen (Leiningen 2.9.1 on Java 1.8.0_222 OpenJDK 64-Bit Server VM) +- Mercurial (Mercurial Distributed SCM (version 4.5.3)) +- Miniconda (conda 4.7.10) +- Mono (Mono JIT compiler version 6.4.0.198 (tarball Tue Sep 24 01:21:28 UTC 2019)) +- MySQL (mysql Ver 14.14 Distrib 5.7.27, for Linux (x86_64) using EditLine wrapper) +- MySQL Server (user:root password:root) +- MS SQL Server Client Tools +- Node.js (v10.16.3) +- Bower (1.8.8) +- Grunt (grunt-cli v1.2.0) +- Gulp (CLI version: 2.2.0 +Local version: Unknown) +- n (6.0.1) +- Parcel (1.12.3) +- TypeScript (Version 3.6.3) +- Webpack (4.41.0) +- Webpack CLI (3.3.9) +- Yarn (1.19.0) +- PhantomJS (2.1.1) +- PHP 7.1 (PHP 7.1.32-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 13:28:37) ( NTS )) +- PHP 7.2 (PHP 7.2.22-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 12:54:33) ( NTS )) +- PHP 7.3 (PHP 7.3.9-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Sep 2 2019 12:54:24) ( NTS )) +- Composer (Composer version 1.9.0 2019-08-02 20:55:32) +- PHPUnit (PHPUnit 7.5.16 by Sebastian Bergmann and contributors.) +- Pollinate +- Powershell (PowerShell 6.2.3) +- rustup (1.19.0) +- rust (1.38.0) +- cargo (1.38.0) +- rustfmt (1.4.4-stable) +- clippy (0.0.212) +- rustdoc (1.38.0) +- bindgen (execute +the +0.51.1) +- cbindgen (0.9.1) +- Scala +- Sphinx Open Source Search Server +- Subversion (svn, version 1.9.7 (r1800392)) +- Terraform (Terraform v0.12.9) +- Vcpkg 2019.09.12-unknownhash +- Zeit Now CLI (16.3.0) +- Google Repository 58 +- Google Play services 49 +- Google APIs 24 +- Google APIs 23 +- Google APIs 22 +- Google APIs 21 +- CMake 3.6.4111459 +- Android Support Repository 47.0.0 +- Android SDK Platform-Tools 29.0.4 +- Android SDK Platform 29 +- Android SDK Platform 28 +- Android SDK Platform 27 +- Android SDK Platform 26 +- Android SDK Platform 25 +- Android SDK Platform 24 +- Android SDK Platform 23 +- Android SDK Platform 22 +- Android SDK Platform 21 +- Android SDK Platform 19 +- Android SDK Platform 17 +- Android SDK Patch Applier v4 +- Android SDK Build-Tools 29.0.2 +- Android SDK Build-Tools 29.0.0 +- Android SDK Build-Tools 28.0.3 +- Android SDK Build-Tools 28.0.2 +- Android SDK Build-Tools 28.0.1 +- Android SDK Build-Tools 28.0.0 +- Android SDK Build-Tools 27.0.3 +- Android SDK Build-Tools 27.0.2 +- Android SDK Build-Tools 27.0.1 +- Android SDK Build-Tools 27.0.0 +- Android SDK Build-Tools 26.0.3 +- Android SDK Build-Tools 26.0.2 +- Android SDK Build-Tools 26.0.1 +- Android SDK Build-Tools 26.0.0 +- Android SDK Build-Tools 25.0.3 +- Android SDK Build-Tools 25.0.2 +- Android SDK Build-Tools 25.0.1 +- Android SDK Build-Tools 25.0.0 +- Android SDK Build-Tools 24.0.3 +- Android SDK Build-Tools 24.0.2 +- Android SDK Build-Tools 24.0.1 +- Android SDK Build-Tools 24.0.0 +- Android SDK Build-Tools 23.0.3 +- Android SDK Build-Tools 23.0.2 +- Android SDK Build-Tools 23.0.1 +- Android SDK Build-Tools 22.0.1 +- Android SDK Build-Tools 21.1.2 +- Android SDK Build-Tools 20.0.0 +- Android SDK Build-Tools 19.1.0 +- Android SDK Build-Tools 17.0.0 +- Android NDK 20.0.5594570 +- Az Module (1.0.0) +- Az Module (1.6.0) +- Az Module (2.3.2) +- Az Module (2.6.0) +- Cached container images + - jekyll/builder:latest (Digest: sha256:9182fe84c46f8c196fc89d5c960839053a31e246c39994f30498fbcf70cd4b04) + - node:10 (Digest: sha256:a2bc0489b71f88b358d2ed66efe0025b1896032ca6fd52df780426ce1acd18be) + - node:12 (Digest: sha256:cda22332e2dd46807a14d3268ee3fb298651386ad1f03cfd58772a7dc65f89c7) + - buildpack-deps:stretch (Digest: sha256:9e704902086098039b91927801b84925fbc29bd79133b582bcbea6a19f0362ca) + - debian:9 (Digest: sha256:5fb93ce7a427b7c1c2374d5c29d68a159de7d5e781deeda422f8d51a1a9b6480) + - debian:8 (Digest: sha256:a97db35fa665312803a229cb97fd921a884d0ef3be8cca008e958a7c936c2e7f) + - node:12-alpine (Digest: sha256:744b156ec2dca0ad8291f80f9093273d45eb85378b6290b2fbbada861cc3ed01) + - alpine:3.10 (Digest: sha256:72c42ed48c3a2db31b7dafe17d275b634664a708d901ec9fd57b1529280f01fb) + - node:10-alpine (Digest: sha256:77c898d0da5e7bfb6e05c9a64de136ba4e03889a72f3c298e95df822a38f450d) + - alpine:3.9 (Digest: sha256:7746df395af22f04212cd25a92c1d6dbc5a06a0ca9579a229ef43008d4d1302a) + - alpine:3.7 (Digest: sha256:8421d9a84432575381bfabd248f1eb56f3aa21d9d7cd2511583c68c9b7511d10) + - alpine:3.8 (Digest: sha256:04696b491e0cc3c58a75bace8941c14c924b9f313b03ce5029ebbc040ed9dcd9) + - mcr.microsoft.com/azure-pipelines/node8-typescript:latest (Digest: sha256:e52e60b9f71183969830a3664279b5d8c799b4b0ec2c25a0686f7c02f6a9669a) +- Python (available through the [Use Python Version](https://go.microsoft.com/fwlink/?linkid=871498) task) + - Python 2.7.16 + - Python 3.5.7 + - Python 3.6.9 + - Python 3.7.4 +- Ruby (available through the [Use Ruby Version](https://go.microsoft.com/fwlink/?linkid=2005989) task) + - Ruby 2.3.7 + - Ruby 2.4.6 + - Ruby 2.5.5 + - Ruby 2.6.3 +- Python (Python 2.7.15+) +- pip (pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)) +- Python3 (Python 3.6.8) +- pip3 (pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)) +- PyPy2 ([PyPy 7.1.0 with GCC 6.2.0 20160901]) +- PyPy3 ([PyPy 7.0.0 with GCC 6.2.0 20160901]) +- Boost C++ Libraries 1.69.0 diff --git a/images/linux/config/ubuntu1604.conf b/images/linux/config/ubuntu1604.conf new file mode 100644 index 000000000..e9fbaed22 --- /dev/null +++ b/images/linux/config/ubuntu1604.conf @@ -0,0 +1,2 @@ +# Name of the hosted pool this image will support +POOL_NAME="Hosted Ubuntu 1604" diff --git a/images/linux/config/ubuntu1804.conf b/images/linux/config/ubuntu1804.conf new file mode 100644 index 000000000..375a9382b --- /dev/null +++ b/images/linux/config/ubuntu1804.conf @@ -0,0 +1,2 @@ +# Name of the hosted pool this image will support +POOL_NAME="Hosted Ubuntu 1804" diff --git a/images/linux/scripts/base/repos.sh b/images/linux/scripts/base/repos.sh new file mode 100644 index 000000000..f8280cc06 --- /dev/null +++ b/images/linux/scripts/base/repos.sh @@ -0,0 +1,15 @@ +#!/bin/bash +################################################################################ +## File: repos.sh +## Desc: Installs official Microsoft package repos for the distribution +################################################################################ + +LSB_RELEASE=$(lsb_release -rs) + +# Install Microsoft repository +wget https://packages.microsoft.com/config/ubuntu/$LSB_RELEASE/packages-microsoft-prod.deb +dpkg -i packages-microsoft-prod.deb +apt-get update + +# Install Microsoft GPG public key +curl -L https://packages.microsoft.com/keys/microsoft.asc | apt-key add - diff --git a/images/linux/scripts/helpers/apt.sh b/images/linux/scripts/helpers/apt.sh new file mode 100644 index 000000000..e95a2160f --- /dev/null +++ b/images/linux/scripts/helpers/apt.sh @@ -0,0 +1,23 @@ +#!/bin/bash +################################################################################ +## File: apt.sh +## Desc: This script contains helper functions for using dpkg and apt +################################################################################ + +## Use dpkg to figure out if a package has already been installed +## Example use: +## if ! IsInstalled packageName; then +## echo "packageName is not installed!" +## fi +function IsInstalled { + dpkg -S $1 &> /dev/null +} + +# Configure apt to always assume Y +echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes + +# Use apt-fast for parallel downloads +apt-get install aria2 +add-apt-repository -y ppa:apt-fast/stable +apt-get update +apt-get -y install apt-fast diff --git a/images/linux/scripts/helpers/containercache.sh b/images/linux/scripts/helpers/containercache.sh new file mode 100644 index 000000000..bdf3a83f6 --- /dev/null +++ b/images/linux/scripts/helpers/containercache.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +# Check prereqs +echo "Checking prereqs for image pulls" +if ! command -v docker; then + echo "Docker is not installed, cant pull images" + exit 1 +fi + +# Information output +systemctl status docker --no-pager + +# Pull images +images=( + docker.io/jekyll/builder + mcr.microsoft.com/azure-pipelines/node8-typescript +) + +for image in "${images[@]}"; do + docker pull "$image" +done + +## Add container information to the metadata file + DocumentInstalledItem "Cached container images" + +while read -r line; do + DocumentInstalledItemIndent "$line" +done <<< "$(docker images --digests --format '{{.Repository}}:{{.Tag}} (Digest: {{.Digest}})')" diff --git a/images/linux/scripts/helpers/document.sh b/images/linux/scripts/helpers/document.sh new file mode 100644 index 000000000..86217160f --- /dev/null +++ b/images/linux/scripts/helpers/document.sh @@ -0,0 +1,30 @@ +#!/bin/bash +################################################################################ +## File: document.sh +## Desc: Helper functions for writing information to the metadata document +################################################################################ + +function WriteItem { + if [ -z "$METADATA_FILE" ]; then + echo "METADATA_FILE environment variable must be set to output to Metadata Document!" + return 1; + else + echo -e "$1" >> "$METADATA_FILE" + fi +} + +function AddTitle { + WriteItem "# $1" +} + +function AddSubTitle { + WriteItem "## $1" +} + +function DocumentInstalledItem { + WriteItem "- $1" +} + +function DocumentInstalledItemIndent { + WriteItem " - $1" +} diff --git a/images/linux/scripts/installers/1604/android.sh b/images/linux/scripts/installers/1604/android.sh new file mode 100644 index 000000000..a2017cc3b --- /dev/null +++ b/images/linux/scripts/installers/1604/android.sh @@ -0,0 +1,145 @@ +#!/bin/bash +################################################################################ +## File: android.sh +## Desc: Installs Android SDK +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables) + ANDROID_ROOT=/usr/local/lib/android + ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk + echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" | tee -a /etc/environment + +# ANDROID_HOME is deprecated, but older versions of Gradle rely on it +echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" | tee -a /etc/environment + +# Download the latest command line tools so that we can accept all of the licenses. +# See https://developer.android.com/studio/#command-tools +wget -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip +unzip android-sdk.zip -d ${ANDROID_ROOT} +rm -f android-sdk.zip + +# Install the following SDKs and build tools, passing in "y" to accept licenses. +echo "y" | ${ANDROID_ROOT}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} \ + "ndk-bundle" \ + "platform-tools" \ + "platforms;android-29" \ + "platforms;android-28" \ + "platforms;android-27" \ + "platforms;android-26" \ + "platforms;android-25" \ + "platforms;android-24" \ + "platforms;android-23" \ + "platforms;android-22" \ + "platforms;android-21" \ + "platforms;android-19" \ + "platforms;android-17" \ + "platforms;android-15" \ + "platforms;android-10" \ + "build-tools;29.0.2" \ + "build-tools;29.0.0" \ + "build-tools;28.0.3" \ + "build-tools;28.0.2" \ + "build-tools;28.0.1" \ + "build-tools;28.0.0" \ + "build-tools;27.0.3" \ + "build-tools;27.0.2" \ + "build-tools;27.0.1" \ + "build-tools;27.0.0" \ + "build-tools;26.0.3" \ + "build-tools;26.0.2" \ + "build-tools;26.0.1" \ + "build-tools;26.0.0" \ + "build-tools;25.0.3" \ + "build-tools;25.0.2" \ + "build-tools;25.0.1" \ + "build-tools;25.0.0" \ + "build-tools;24.0.3" \ + "build-tools;24.0.2" \ + "build-tools;24.0.1" \ + "build-tools;24.0.0" \ + "build-tools;23.0.3" \ + "build-tools;23.0.2" \ + "build-tools;23.0.1" \ + "build-tools;22.0.1" \ + "build-tools;21.1.2" \ + "build-tools;20.0.0" \ + "build-tools;19.1.0" \ + "build-tools;17.0.0" \ + "extras;android;m2repository" \ + "extras;google;m2repository" \ + "extras;google;google_play_services" \ + "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2" \ + "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1" \ + "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" \ + "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" \ + "add-ons;addon-google_apis-google-24" \ + "add-ons;addon-google_apis-google-23" \ + "add-ons;addon-google_apis-google-22" \ + "add-ons;addon-google_apis-google-21" \ + "cmake;3.6.4111459" \ + "patcher;v4" + +# Document what was added to the image +echo "Lastly, document what was added to the metadata file" +DocumentInstalledItem "Google Repository $(cat ${ANDROID_SDK_ROOT}/extras/google/m2repository/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/google/google_play_services/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Google APIs 24" +DocumentInstalledItem "Google APIs 23" +DocumentInstalledItem "Google APIs 22" +DocumentInstalledItem "Google APIs 21" +DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)" +DocumentInstalledItem "Android Support Repository 47.0.0" +DocumentInstalledItem "Android Solver for ConstraintLayout 1.0.2" +DocumentInstalledItem "Android Solver for ConstraintLayout 1.0.1" +DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Android SDK Platform 29" +DocumentInstalledItem "Android SDK Platform 28" +DocumentInstalledItem "Android SDK Platform 27" +DocumentInstalledItem "Android SDK Platform 26" +DocumentInstalledItem "Android SDK Platform 25" +DocumentInstalledItem "Android SDK Platform 24" +DocumentInstalledItem "Android SDK Platform 23" +DocumentInstalledItem "Android SDK Platform 22" +DocumentInstalledItem "Android SDK Platform 21" +DocumentInstalledItem "Android SDK Platform 19" +DocumentInstalledItem "Android SDK Platform 17" +DocumentInstalledItem "Android SDK Platform 15" +DocumentInstalledItem "Android SDK Platform 10" +DocumentInstalledItem "Android SDK Patch Applier v4" +DocumentInstalledItem "Android SDK Build-Tools 29.0.2" +DocumentInstalledItem "Android SDK Build-Tools 29.0.0" +DocumentInstalledItem "Android SDK Build-Tools 28.0.3" +DocumentInstalledItem "Android SDK Build-Tools 28.0.2" +DocumentInstalledItem "Android SDK Build-Tools 28.0.1" +DocumentInstalledItem "Android SDK Build-Tools 28.0.0" +DocumentInstalledItem "Android SDK Build-Tools 27.0.3" +DocumentInstalledItem "Android SDK Build-Tools 27.0.2" +DocumentInstalledItem "Android SDK Build-Tools 27.0.1" +DocumentInstalledItem "Android SDK Build-Tools 27.0.0" +DocumentInstalledItem "Android SDK Build-Tools 26.0.3" +DocumentInstalledItem "Android SDK Build-Tools 26.0.2" +DocumentInstalledItem "Android SDK Build-Tools 26.0.1" +DocumentInstalledItem "Android SDK Build-Tools 26.0.0" +DocumentInstalledItem "Android SDK Build-Tools 25.0.3" +DocumentInstalledItem "Android SDK Build-Tools 25.0.2" +DocumentInstalledItem "Android SDK Build-Tools 25.0.1" +DocumentInstalledItem "Android SDK Build-Tools 25.0.0" +DocumentInstalledItem "Android SDK Build-Tools 24.0.3" +DocumentInstalledItem "Android SDK Build-Tools 24.0.2" +DocumentInstalledItem "Android SDK Build-Tools 24.0.1" +DocumentInstalledItem "Android SDK Build-Tools 24.0.0" +DocumentInstalledItem "Android SDK Build-Tools 23.0.3" +DocumentInstalledItem "Android SDK Build-Tools 23.0.2" +DocumentInstalledItem "Android SDK Build-Tools 23.0.1" +DocumentInstalledItem "Android SDK Build-Tools 22.0.1" +DocumentInstalledItem "Android SDK Build-Tools 21.1.2" +DocumentInstalledItem "Android SDK Build-Tools 20.0.0" +DocumentInstalledItem "Android SDK Build-Tools 19.1.0" +DocumentInstalledItem "Android SDK Build-Tools 17.0.0" +DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)" +DocumentInstalledItem "Android ConstraintLayout 1.0.2" +DocumentInstalledItem "Android ConstraintLayout 1.0.1" diff --git a/images/linux/scripts/installers/1604/azpowershell.sh b/images/linux/scripts/installers/1604/azpowershell.sh new file mode 100644 index 000000000..1886e8de7 --- /dev/null +++ b/images/linux/scripts/installers/1604/azpowershell.sh @@ -0,0 +1,46 @@ +#!/bin/bash +################################################################################ +## File: azpowershell.sh +## Desc: Installed Azure PowerShell +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) +sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.0.0 -RequiredVersion 1.0.0 -Force' +sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.6.0 -RequiredVersion 1.6.0 -Force' +sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.3.2 -RequiredVersion 2.3.2 -Force' +sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.6.0 -RequiredVersion 2.6.0 -Force' + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! pwsh -Command '$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.0.0:" + $env:PSModulePath; + if (!(get-module -listavailable -name Az.accounts)) { + Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1 + } + $env:PSModulePath = $actualPSModulePath + $actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.6.0:" + $env:PSModulePath; + if (!(get-module -listavailable -name Az.accounts)) { + Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1 + } + $env:PSModulePath = $actualPSModulePath + $actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.3.2:" + $env:PSModulePath; + if (!(get-module -listavailable -name Az.accounts)) { + Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1 + } + $env:PSModulePath = $actualPSModulePath + $actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.6.0:" + $env:PSModulePath; + if (!(get-module -listavailable -name Az.accounts)) { + Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1 + } + $env:PSModulePath = $actualPSModulePath'; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Az Module (1.0.0)" +DocumentInstalledItem "Az Module (1.6.0)" +DocumentInstalledItem "Az Module (2.3.2)" +DocumentInstalledItem "Az Module (2.6.0)" \ No newline at end of file diff --git a/images/linux/scripts/installers/1604/basic.sh b/images/linux/scripts/installers/1604/basic.sh new file mode 100644 index 000000000..b437f048b --- /dev/null +++ b/images/linux/scripts/installers/1604/basic.sh @@ -0,0 +1,88 @@ +#!/bin/bash +################################################################################ +## File: basic.sh +## Desc: Installs basic command line utilities and dev packages +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +set -e + +# Install basic command-line utilities +apt-fast install -y --no-install-recommends \ + curl \ + dnsutils \ + file \ + ftp \ + iproute2 \ + iputils-ping \ + jq \ + libcurl3 \ + libicu55 \ + libunwind8 \ + locales \ + netcat \ + openssh-client \ + rsync \ + shellcheck \ + sudo \ + telnet \ + time \ + unzip \ + wget \ + zip \ + tzdata + +# Electron / VSCode / GitHub Desktop prereqs +apt-fast install -y --no-install-recommends \ + libxkbfile-dev \ + pkg-config \ + libsecret-1-dev \ + libxss1 \ + libgconf-2-4 \ + dbus \ + xvfb \ + libgtk-3-0 \ + fakeroot \ + dpkg \ + rpm \ + xz-utils \ + xorriso \ + zsync + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in curl file ftp jq netcat ssh rsync shellcheck sudo telnet time unzip wget zip; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Basic CLI:" +DocumentInstalledItemIndent "curl" +DocumentInstalledItemIndent "dnsutils" +DocumentInstalledItemIndent "file" +DocumentInstalledItemIndent "ftp" +DocumentInstalledItemIndent "iproute2" +DocumentInstalledItemIndent "iputils-ping" +DocumentInstalledItemIndent "jq" +DocumentInstalledItemIndent "libcurl3" +DocumentInstalledItemIndent "libicu55" +DocumentInstalledItemIndent "libunwind8" +DocumentInstalledItemIndent "locales" +DocumentInstalledItemIndent "netcat" +DocumentInstalledItemIndent "openssh-client" +DocumentInstalledItemIndent "rsync" +DocumentInstalledItemIndent "shellcheck" +DocumentInstalledItemIndent "sudo" +DocumentInstalledItemIndent "telnet" +DocumentInstalledItemIndent "time" +DocumentInstalledItemIndent "unzip" +DocumentInstalledItemIndent "wget" +DocumentInstalledItemIndent "zip" +DocumentInstalledItemIndent "tzdata" \ No newline at end of file diff --git a/images/linux/scripts/installers/1604/dotnetcore-sdk.sh b/images/linux/scripts/installers/1604/dotnetcore-sdk.sh new file mode 100644 index 000000000..b2f1bc0d3 --- /dev/null +++ b/images/linux/scripts/installers/1604/dotnetcore-sdk.sh @@ -0,0 +1,94 @@ +#!/bin/bash +################################################################################ +## File: dotnetcore-sdk.sh +## Desc: Installs .NET Core SDK +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +LATEST_DOTNET_PACKAGE=dotnet-sdk-3.0 + +LSB_RELEASE=$(lsb_release -rs) + +mksamples() +{ + sdk=$1 + sample=$2 + mkdir "$sdk" + cd "$sdk" || exit + set -e + dotnet help + dotnet new globaljson --sdk-version "$sdk" + dotnet new "$sample" + dotnet restore + dotnet build + set +e + cd .. || exit + rm -rf "$sdk" +} + +set -e + +echo "Determing if .NET Core ($LATEST_DOTNET_PACKAGE) is installed" +if ! IsInstalled $LATEST_DOTNET_PACKAGE; then + echo "Could not find .NET Core ($LATEST_DOTNET_PACKAGE), installing..." + wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb + dpkg -i packages-microsoft-prod.deb + apt-get update + apt-get install apt-transport-https + apt-get update + apt-get install $LATEST_DOTNET_PACKAGE +else + echo ".NET Core ($LATEST_DOTNET_PACKAGE) is already installed" +fi + +# Get list of all released SDKs from channels which are not end-of-life or preview +release_urls=("https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json") +sdks=() +for release_url in ${release_urls[@]}; do + echo "${release_url}" + releases=$(curl "${release_url}") + sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdk.version')) + sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version')) +done + +sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r) + +for sdk in $sortedSdks; do + url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz" + echo "$url" >> urls + echo "Adding $url to list to download later" +done + +# Download additional SDKs +echo "Downloading release tarballs..." +cat urls | xargs -n 1 -P 16 wget -q +for tarball in *.tar.gz; do + dest="./tmp-$(basename -s .tar.gz $tarball)" + echo "Extracting $tarball to $dest" + mkdir "$dest" && tar -C "$dest" -xzf "$tarball" + rsync -qav "$dest/shared/" /usr/share/dotnet/shared/ + rsync -qav "$dest/host/" /usr/share/dotnet/host/ + rsync -qav "$dest/sdk/" /usr/share/dotnet/sdk/ + rm -rf "$dest" + rm "$tarball" +done +rm urls + +DocumentInstalledItem ".NET Core SDK:" +# Smoke test each SDK +for sdk in $sortedSdks; do + mksamples "$sdk" "console" + mksamples "$sdk" "mstest" + mksamples "$sdk" "xunit" + mksamples "$sdk" "web" + mksamples "$sdk" "mvc" + mksamples "$sdk" "webapi" + DocumentInstalledItemIndent "$sdk" +done + +# NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test +# Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine +echo "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" | tee -a /etc/environment +echo "PATH=\"\$HOME/.dotnet/tools:\$PATH\"" | tee -a /etc/skel/.profile diff --git a/images/linux/scripts/installers/1604/go.sh b/images/linux/scripts/installers/1604/go.sh new file mode 100644 index 000000000..69c7afbe8 --- /dev/null +++ b/images/linux/scripts/installers/1604/go.sh @@ -0,0 +1,36 @@ +#!/bin/bash +################################################################################ +## File: go.sh +## Desc: Installs go, configures GOROOT, and adds go to the path +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# This function installs Go using the specified arguments: +# $1=MajorVersion (1.11) +# $2=MajorAndMinorVersion (1.11.1) +# $3=IsDefaultVersion (true or false) +function InstallGo () { + curl -sL https://dl.google.com/go/go$2.linux-amd64.tar.gz -o go$2.linux-amd64.tar.gz + mkdir -p /usr/local/go$1 + tar -C /usr/local/go$1 -xzf go$2.linux-amd64.tar.gz --strip-components=1 go + rm go$2.linux-amd64.tar.gz + echo "GOROOT_${1//./_}_X64=/usr/local/go$1" | tee -a /etc/environment + DocumentInstalledItem "Go $1 ($(/usr/local/go$1/bin/go version))" + + # If this version of Go is to be the default version, + # symlink it into the path and point GOROOT to it. + if [ $3 = true ] + then + ln -s /usr/local/go$1/bin/* /usr/bin/ + echo "GOROOT=/usr/local/go$1" | tee -a /etc/environment + fi +} + +# Install Go versions +InstallGo 1.9 1.9.7 false +InstallGo 1.10 1.10.8 false +InstallGo 1.11 1.11.12 false +InstallGo 1.12 1.12.7 true +InstallGo 1.13 1.13 false diff --git a/images/linux/scripts/installers/1604/hosted-tool-cache.sh b/images/linux/scripts/installers/1604/hosted-tool-cache.sh new file mode 100644 index 000000000..f49cffd66 --- /dev/null +++ b/images/linux/scripts/installers/1604/hosted-tool-cache.sh @@ -0,0 +1,40 @@ +#!/bin/bash +################################################################################ +## File: hosted-tool-cache.sh +## Desc: Downloads and installs hosted tools cache +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Fail out if any setups fail +set -e + +# Download hosted tool cache +AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache +echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment +azcopy --recursive \ + --source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/linux \ + --destination $AGENT_TOOLSDIRECTORY + +# Install tools from hosted tool cache +original_directory=$PWD +setups=$(find $AGENT_TOOLSDIRECTORY -name setup.sh) +for setup in $setups; do + chmod +x $setup; + cd $(dirname $setup); + ./$(basename $setup); + cd $original_directory; +done; + +DocumentInstalledItem "Python (available through the [setup-python](https://github.com/actions/setup-python/blob/master/README.md) task)" +pythons=$(ls $AGENT_TOOLSDIRECTORY/Python) +for python in $pythons; do + DocumentInstalledItemIndent "Python $python" +done; + +DocumentInstalledItem "Ruby (available through the [setup-ruby](https://github.com/actions/setup-ruby/blob/master/README.md) task)" +rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby) +for ruby in $rubys; do + DocumentInstalledItemIndent "Ruby $ruby" +done; diff --git a/images/linux/scripts/installers/1604/kubernetes-tools.sh b/images/linux/scripts/installers/1604/kubernetes-tools.sh new file mode 100644 index 000000000..e4b8fd252 --- /dev/null +++ b/images/linux/scripts/installers/1604/kubernetes-tools.sh @@ -0,0 +1,40 @@ +#!/bin/bash +################################################################################ +## File: kubernetes-tools.sh +## Desc: Installs kubectl, helm +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +## Install kubectl +apt-get install -y apt-transport-https +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - +touch /etc/apt/sources.list.d/kubernetes.list +echo "deb http://apt.kubernetes.io/ kubernetes-$(lsb_release -cs) main" | tee -a /etc/apt/sources.list.d/kubernetes.list +apt-get update +apt-get install -y kubectl + +# Install Helm +curl -L https://git.io/get_helm.sh | bash + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v kubectl; then + echo "kubectl was not installed" + exit 1 +fi + +if ! command -v helm; then + echo "helm was not installed" + exit 1 +fi + +echo "Initializing helm" +helm init --client-only + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "kubectl ($(kubectl version --short |& head -n 1))" +DocumentInstalledItem "helm ($(helm version --short |& head -n 1))" diff --git a/images/linux/scripts/installers/1604/mercurial.sh b/images/linux/scripts/installers/1604/mercurial.sh new file mode 100644 index 000000000..5c45a95c5 --- /dev/null +++ b/images/linux/scripts/installers/1604/mercurial.sh @@ -0,0 +1,25 @@ +#!/bin/bash +################################################################################ +## File: mercurial.sh +## Desc: Installs Mercurial +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Mercurial from the mercurial-ppa/releases repository for the latest version. +# https://www.mercurial-scm.org/wiki/Download +add-apt-repository ppa:mercurial-ppa/releases -y +apt-get update +apt-get install -y --no-install-recommends mercurial + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v hg; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))" diff --git a/images/linux/scripts/installers/1604/php.sh b/images/linux/scripts/installers/1604/php.sh new file mode 100644 index 000000000..45c5fe039 --- /dev/null +++ b/images/linux/scripts/installers/1604/php.sh @@ -0,0 +1,268 @@ +#!/bin/bash +################################################################################ +## File: php.sh +## Desc: Installs php +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +set -e + +apt-add-repository ppa:ondrej/php -y + +# Install php5.6 +apt-get update +apt-fast install -y --no-install-recommends \ + php5.6 \ + php5.6-amqp \ + php5.6-bcmath \ + php5.6-bz2 \ + php5.6-cgi \ + php5.6-cli \ + php5.6-common \ + php5.6-curl \ + php5.6-dba \ + php5.6-dev \ + php5.6-enchant \ + php5.6-fpm \ + php5.6-gd \ + php5.6-gmp \ + php5.6-imap \ + php5.6-interbase \ + php5.6-intl \ + php5.6-json \ + php5.6-ldap \ + php5.6-mbstring \ + php5.6-mcrypt \ + php5.6-mysql \ + php5.6-odbc \ + php5.6-opcache \ + php5.6-pgsql \ + php5.6-phpdbg \ + php5.6-pspell \ + php5.6-readline \ + php5.6-recode \ + php5.6-snmp \ + php5.6-soap \ + php5.6-sqlite3 \ + php5.6-sybase \ + php5.6-tidy \ + php5.6-xml \ + php5.6-xmlrpc \ + php5.6-xsl \ + php5.6-zip +apt-get remove --purge -yq php5.6-dev + +# Install php7.0 +apt-fast install -y --no-install-recommends \ + php7.0 \ + php7.0-amqp \ + php7.0-bcmath \ + php7.0-bz2 \ + php7.0-cgi \ + php7.0-cli \ + php7.0-common \ + php7.0-curl \ + php7.0-dba \ + php7.0-dev \ + php7.0-enchant \ + php7.0-fpm \ + php7.0-gd \ + php7.0-gmp \ + php7.0-imap \ + php7.0-interbase \ + php7.0-intl \ + php7.0-json \ + php7.0-ldap \ + php7.0-mbstring \ + php7.0-mcrypt \ + php7.0-mysql \ + php7.0-odbc \ + php7.0-opcache \ + php7.0-pgsql \ + php7.0-phpdbg \ + php7.0-pspell \ + php7.0-readline \ + php7.0-recode \ + php7.0-snmp \ + php7.0-soap \ + php7.0-sqlite3 \ + php7.0-sybase \ + php7.0-tidy \ + php7.0-xml \ + php7.0-xmlrpc \ + php7.0-xsl \ + php7.0-zip +apt-get remove --purge -yq php7.0-dev + +# Install php7.1 +apt-fast install -y --no-install-recommends \ + php7.1 \ + php7.1-amqp \ + php7.1-bcmath \ + php7.1-bz2 \ + php7.1-cgi \ + php7.1-cli \ + php7.1-common \ + php7.1-curl \ + php7.1-dba \ + php7.1-dev \ + php7.1-enchant \ + php7.1-fpm \ + php7.1-gd \ + php7.1-gmp \ + php7.1-imap \ + php7.1-interbase \ + php7.1-intl \ + php7.1-json \ + php7.1-ldap \ + php7.1-mbstring \ + php7.1-mcrypt \ + php7.1-mysql \ + php7.1-odbc \ + php7.1-opcache \ + php7.1-pgsql \ + php7.1-phpdbg \ + php7.1-pspell \ + php7.1-readline \ + php7.1-recode \ + php7.1-snmp \ + php7.1-soap \ + php7.1-sqlite3 \ + php7.1-sybase \ + php7.1-tidy \ + php7.1-xml \ + php7.1-xmlrpc \ + php7.1-xsl \ + php7.1-zip +apt-get remove --purge -yq php7.1-dev + +# Install php7.2 +apt-fast install -y --no-install-recommends \ + php7.2 \ + php7.2-apcu \ + php7.2-amqp \ + php7.2-bcmath \ + php7.2-bz2 \ + php7.2-cgi \ + php7.2-cli \ + php7.2-common \ + php7.2-curl \ + php7.2-dba \ + php7.2-dev \ + php7.2-enchant \ + php7.2-fpm \ + php7.2-gd \ + php7.2-gmp \ + php7.2-imap \ + php7.2-interbase \ + php7.2-intl \ + php7.2-json \ + php7.2-ldap \ + php7.2-mbstring \ + php7.2-mysql \ + php7.2-odbc \ + php7.2-opcache \ + php7.2-pgsql \ + php7.2-phpdbg \ + php7.2-pspell \ + php7.2-readline \ + php7.2-recode \ + php7.2-snmp \ + php7.2-soap \ + php7.2-sqlite3 \ + php7.2-sybase \ + php7.2-tidy \ + php7.2-xml \ + php7.2-xmlrpc \ + php7.2-xsl \ + php7.2-zip + +# Install php7.3 +apt-fast install -y --no-install-recommends \ + php7.3 \ + php7.3-apcu \ + php7.3-amqp \ + php7.3-bcmath \ + php7.3-bz2 \ + php7.3-cgi \ + php7.3-cli \ + php7.3-common \ + php7.3-curl \ + php7.3-dba \ + php7.3-dev \ + php7.3-enchant \ + php7.3-fpm \ + php7.3-gd \ + php7.3-gmp \ + php7.3-imap \ + php7.3-interbase \ + php7.3-intl \ + php7.3-json \ + php7.3-ldap \ + php7.3-mbstring \ + php7.3-mysql \ + php7.3-odbc \ + php7.3-opcache \ + php7.3-pgsql \ + php7.3-phpdbg \ + php7.3-pspell \ + php7.3-readline \ + php7.3-recode \ + php7.3-snmp \ + php7.3-soap \ + php7.3-sqlite3 \ + php7.3-sybase \ + php7.3-tidy \ + php7.3-xml \ + php7.3-xmlrpc \ + php7.3-xsl \ + php7.3-zip + +apt-fast install -y --no-install-recommends \ + php-igbinary \ + php-memcache \ + php-memcached \ + php-mongodb \ + php-redis \ + php-xdebug \ + php-yaml \ + php-zmq + +apt-get remove --purge -yq php7.2-dev + +apt-fast install -y --no-install-recommends snmp + +# Install composer +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +php composer-setup.php +sudo mv composer.phar /usr/bin/composer +php -r "unlink('composer-setup.php');" + +# Install phpunit (for PHP) +wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar +chmod +x phpunit +mv phpunit /usr/local/bin/phpunit + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in php php5.6 php7.0 php7.1 php7.2 php7.3 composer phpunit; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "PHP 5.6 ($(php5.6 --version | head -n 1))" +DocumentInstalledItem "PHP 7.0 ($(php7.0 --version | head -n 1))" +DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))" +DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))" +DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))" +DocumentInstalledItem "Composer ($(composer --version))" +DocumentInstalledItem "PHPUnit ($(phpunit --version))" diff --git a/images/linux/scripts/installers/1604/powershellcore.sh b/images/linux/scripts/installers/1604/powershellcore.sh new file mode 100644 index 000000000..8b8278151 --- /dev/null +++ b/images/linux/scripts/installers/1604/powershellcore.sh @@ -0,0 +1,28 @@ +#!/bin/bash +################################################################################ +## File: powershellcore.sh +## Desc: Installs powershellcore +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +# Install Powershell +apt-get install -y powershell + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v pwsh; then + echo "pwsh was not installed" + exit 1 +fi +if ! pwsh -c 'Write-Host Hello world'; then + echo "pwsh failed to run" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Powershell ($(pwsh --version))" diff --git a/images/linux/scripts/installers/1604/preparemetadata.sh b/images/linux/scripts/installers/1604/preparemetadata.sh new file mode 100644 index 000000000..be102d839 --- /dev/null +++ b/images/linux/scripts/installers/1604/preparemetadata.sh @@ -0,0 +1,12 @@ +#!/bin/bash +################################################################################ +## File: preparemetadata.sh +## Desc: This script adds a image title information to the metadata +## document +################################################################################ + +source $HELPER_SCRIPTS/document.sh + +AddTitle "Hosted Ubuntu 1604 Image ($(lsb_release -ds))" +WriteItem "The following software is installed on machines in the Hosted Ubuntu 1604 ($IMAGE_VERSION) pool" +WriteItem "***" diff --git a/images/linux/scripts/installers/1804/android.sh b/images/linux/scripts/installers/1804/android.sh new file mode 100644 index 000000000..df83a73e0 --- /dev/null +++ b/images/linux/scripts/installers/1804/android.sh @@ -0,0 +1,133 @@ +#!/bin/bash +################################################################################ +## File: android.sh +## Desc: Installs Android SDK +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Set env variable for SDK Root (https://developer.android.com/studio/command-line/variables) +ANDROID_ROOT=/usr/local/lib/android +ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk +echo "ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT}" | tee -a /etc/environment + +# ANDROID_HOME is deprecated, but older versions of Gradle rely on it +echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" | tee -a /etc/environment + +# Download the latest command line tools so that we can accept all of the licenses. +# See https://developer.android.com/studio/#command-tools +wget -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip +unzip android-sdk.zip -d ${ANDROID_ROOT} +rm -f android-sdk.zip + +# Install the following SDKs and build tools, passing in "y" to accept licenses. +echo "y" | ${ANDROID_ROOT}/tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} \ + "ndk-bundle" \ + "platform-tools" \ + "platforms;android-29" \ + "platforms;android-28" \ + "platforms;android-27" \ + "platforms;android-26" \ + "platforms;android-25" \ + "platforms;android-24" \ + "platforms;android-23" \ + "platforms;android-22" \ + "platforms;android-21" \ + "platforms;android-19" \ + "platforms;android-17" \ + "build-tools;29.0.2" \ + "build-tools;29.0.0" \ + "build-tools;28.0.3" \ + "build-tools;28.0.2" \ + "build-tools;28.0.1" \ + "build-tools;28.0.0" \ + "build-tools;27.0.3" \ + "build-tools;27.0.2" \ + "build-tools;27.0.1" \ + "build-tools;27.0.0" \ + "build-tools;26.0.3" \ + "build-tools;26.0.2" \ + "build-tools;26.0.1" \ + "build-tools;26.0.0" \ + "build-tools;25.0.3" \ + "build-tools;25.0.2" \ + "build-tools;25.0.1" \ + "build-tools;25.0.0" \ + "build-tools;24.0.3" \ + "build-tools;24.0.2" \ + "build-tools;24.0.1" \ + "build-tools;24.0.0" \ + "build-tools;23.0.3" \ + "build-tools;23.0.2" \ + "build-tools;23.0.1" \ + "build-tools;22.0.1" \ + "build-tools;21.1.2" \ + "build-tools;20.0.0" \ + "build-tools;19.1.0" \ + "build-tools;17.0.0" \ + "extras;android;m2repository" \ + "extras;google;m2repository" \ + "extras;google;google_play_services" \ + "add-ons;addon-google_apis-google-24" \ + "add-ons;addon-google_apis-google-23" \ + "add-ons;addon-google_apis-google-22" \ + "add-ons;addon-google_apis-google-21" \ + "cmake;3.6.4111459" \ + "patcher;v4" + +# Document what was added to the image +echo "Lastly, document what was added to the metadata file" +DocumentInstalledItem "Google Repository $(cat ${ANDROID_SDK_ROOT}/extras/google/m2repository/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Google Play services $(cat ${ANDROID_SDK_ROOT}/extras/google/google_play_services/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Google APIs 24" +DocumentInstalledItem "Google APIs 23" +DocumentInstalledItem "Google APIs 22" +DocumentInstalledItem "Google APIs 21" +DocumentInstalledItem "CMake $(ls ${ANDROID_SDK_ROOT}/cmake 2>&1)" +DocumentInstalledItem "Android Support Repository 47.0.0" +DocumentInstalledItem "Android SDK Platform-Tools $(cat ${ANDROID_SDK_ROOT}/platform-tools/source.properties 2>&1 | grep Pkg.Revision | cut -d '=' -f 2)" +DocumentInstalledItem "Android SDK Platform 29" +DocumentInstalledItem "Android SDK Platform 28" +DocumentInstalledItem "Android SDK Platform 27" +DocumentInstalledItem "Android SDK Platform 26" +DocumentInstalledItem "Android SDK Platform 25" +DocumentInstalledItem "Android SDK Platform 24" +DocumentInstalledItem "Android SDK Platform 23" +DocumentInstalledItem "Android SDK Platform 22" +DocumentInstalledItem "Android SDK Platform 21" +DocumentInstalledItem "Android SDK Platform 19" +DocumentInstalledItem "Android SDK Platform 17" +DocumentInstalledItem "Android SDK Patch Applier v4" +DocumentInstalledItem "Android SDK Build-Tools 29.0.2" +DocumentInstalledItem "Android SDK Build-Tools 29.0.0" +DocumentInstalledItem "Android SDK Build-Tools 28.0.3" +DocumentInstalledItem "Android SDK Build-Tools 28.0.2" +DocumentInstalledItem "Android SDK Build-Tools 28.0.1" +DocumentInstalledItem "Android SDK Build-Tools 28.0.0" +DocumentInstalledItem "Android SDK Build-Tools 27.0.3" +DocumentInstalledItem "Android SDK Build-Tools 27.0.2" +DocumentInstalledItem "Android SDK Build-Tools 27.0.1" +DocumentInstalledItem "Android SDK Build-Tools 27.0.0" +DocumentInstalledItem "Android SDK Build-Tools 26.0.3" +DocumentInstalledItem "Android SDK Build-Tools 26.0.2" +DocumentInstalledItem "Android SDK Build-Tools 26.0.1" +DocumentInstalledItem "Android SDK Build-Tools 26.0.0" +DocumentInstalledItem "Android SDK Build-Tools 25.0.3" +DocumentInstalledItem "Android SDK Build-Tools 25.0.2" +DocumentInstalledItem "Android SDK Build-Tools 25.0.1" +DocumentInstalledItem "Android SDK Build-Tools 25.0.0" +DocumentInstalledItem "Android SDK Build-Tools 24.0.3" +DocumentInstalledItem "Android SDK Build-Tools 24.0.2" +DocumentInstalledItem "Android SDK Build-Tools 24.0.1" +DocumentInstalledItem "Android SDK Build-Tools 24.0.0" +DocumentInstalledItem "Android SDK Build-Tools 23.0.3" +DocumentInstalledItem "Android SDK Build-Tools 23.0.2" +DocumentInstalledItem "Android SDK Build-Tools 23.0.1" +DocumentInstalledItem "Android SDK Build-Tools 22.0.1" +DocumentInstalledItem "Android SDK Build-Tools 21.1.2" +DocumentInstalledItem "Android SDK Build-Tools 20.0.0" +DocumentInstalledItem "Android SDK Build-Tools 19.1.0" +DocumentInstalledItem "Android SDK Build-Tools 17.0.0" +DocumentInstalledItem "Android NDK $(cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | cut -d ' ' -f 3)" diff --git a/images/linux/scripts/installers/1804/azpowershell.sh b/images/linux/scripts/installers/1804/azpowershell.sh new file mode 100644 index 000000000..c843aa583 --- /dev/null +++ b/images/linux/scripts/installers/1804/azpowershell.sh @@ -0,0 +1,46 @@ +#!/bin/bash +################################################################################ +## File: azpowershell.sh +## Desc: Installed Azure PowerShell +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) +sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.0.0 -RequiredVersion 1.0.0 -Force' +sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_1.6.0 -RequiredVersion 1.6.0 -Force' +sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.3.2 -RequiredVersion 2.3.2 -Force' +sudo pwsh -Command 'Save-Module -Name Az -LiteralPath /usr/share/az_2.6.0 -RequiredVersion 2.6.0 -Force' + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! pwsh -Command '$actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.0.0:" + $env:PSModulePath; + if (!(get-module -listavailable -name Az.accounts)) { + Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1 + } + $env:PSModulePath = $actualPSModulePath + $actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_1.6.0:" + $env:PSModulePath; + if (!(get-module -listavailable -name Az.accounts)) { + Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1 + } + $env:PSModulePath = $actualPSModulePath + $actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.3.2:" + $env:PSModulePath; + if (!(get-module -listavailable -name Az.accounts)) { + Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1 + } + $env:PSModulePath = $actualPSModulePath + $actualPSModulePath = $env:PSModulePath ; $env:PSModulePath = "/usr/share/az_2.6.0:" + $env:PSModulePath; + if (!(get-module -listavailable -name Az.accounts)) { + Write-Host "Az Module was not installed"; $env:PSModulePath = $actualPSModulePath; exit 1 + } + $env:PSModulePath = $actualPSModulePath'; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Az Module (1.0.0)" +DocumentInstalledItem "Az Module (1.6.0)" +DocumentInstalledItem "Az Module (2.3.2)" +DocumentInstalledItem "Az Module (2.6.0)" diff --git a/images/linux/scripts/installers/1804/basic.sh b/images/linux/scripts/installers/1804/basic.sh new file mode 100644 index 000000000..baf3eea45 --- /dev/null +++ b/images/linux/scripts/installers/1804/basic.sh @@ -0,0 +1,154 @@ +#!/bin/bash +################################################################################ +## File: basic.sh +## Desc: Installs basic command line utilities and dev packages +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +set -e + +echo "Install curl" +apt-get install -y --no-install-recommends curl + +echo "Install dnsutils" +apt-get install -y --no-install-recommends dnsutils + +echo "Install file" +apt-get install -y --no-install-recommends file + +echo "Install ftp" +apt-get install -y --no-install-recommends ftp + +echo "Install iproute2" +apt-get install -y --no-install-recommends iproute2 + +echo "Install iputils-ping" +apt-get install -y --no-install-recommends iputils-ping + +echo "Install jq" +apt-get install -y --no-install-recommends jq + +echo "Install libcurl3" +apt-get install -y --no-install-recommends libcurl3 + +echo "Install libunwind8" +apt-get install -y --no-install-recommends libunwind8 + +echo "Install locales" +apt-get install -y --no-install-recommends locales + +echo "Install netcat" +apt-get install -y --no-install-recommends netcat + +echo "Install openssh-client" +apt-get install -y --no-install-recommends openssh-client + +echo "Install rsync" +apt-get install -y --no-install-recommends rsync + +echo "Install shellcheck" +apt-get install -y --no-install-recommends shellcheck + +echo "Install sudo" +apt-get install -y --no-install-recommends sudo + +echo "Install telnet" +apt-get install -y --no-install-recommends telnet + +echo "Install time" +apt-get install -y --no-install-recommends time + +echo "Install unzip" +apt-get install -y --no-install-recommends unzip + +echo "Install wget" +apt-get install -y --no-install-recommends wget + +echo "Install zip" +apt-get install -y --no-install-recommends zip + +echo "Install tzdata" +apt-get install -y --no-install-recommends tzdata + +echo "Install libxkbfile" +apt-get install -y --no-install-recommends libxkbfile-dev + +echo "Install pkg-config" +apt-get install -y --no-install-recommends pkg-config + +echo "Install libsecret-1-dev" +apt-get install -y --no-install-recommends libsecret-1-dev + +echo "Install libxss1" +apt-get install -y --no-install-recommends libxss1 + +echo "Install libgconf-2-4" +apt-get install -y --no-install-recommends libgconf-2-4 + +echo "Install dbus" +apt-get install -y --no-install-recommends dbus + +echo "Install xvfb" +apt-get install -y --no-install-recommends xvfb + +echo "Install libgtk" +apt-get install -y --no-install-recommends libgtk-3-0 + +echo "Install fakeroot" +apt-get install -y --no-install-recommends fakeroot + +echo "Install dpkg" +apt-get install -y --no-install-recommends dpkg + +echo "Install rpm" +apt-get install -y --no-install-recommends rpm + +echo "Install xz-utils" +apt-get install -y --no-install-recommends xz-utils + +echo "Install xorriso" +apt-get install -y --no-install-recommends xorriso + +echo "Install zsync" +apt-get install -y --no-install-recommends zsync + +echo "Install curl" +apt-get install -y --no-install-recommends curl + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in curl file ftp jq netcat ssh rsync shellcheck sudo telnet time unzip wget zip; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Basic CLI:" +DocumentInstalledItemIndent "curl" +DocumentInstalledItemIndent "dnsutils" +DocumentInstalledItemIndent "file" +DocumentInstalledItemIndent "ftp" +DocumentInstalledItemIndent "iproute2" +DocumentInstalledItemIndent "iputils-ping" +DocumentInstalledItemIndent "jq" +DocumentInstalledItemIndent "libcurl3" +DocumentInstalledItemIndent "libicu55" +DocumentInstalledItemIndent "libunwind8" +DocumentInstalledItemIndent "locales" +DocumentInstalledItemIndent "netcat" +DocumentInstalledItemIndent "openssh-client" +DocumentInstalledItemIndent "rsync" +DocumentInstalledItemIndent "shellcheck" +DocumentInstalledItemIndent "sudo" +DocumentInstalledItemIndent "telnet" +DocumentInstalledItemIndent "time" +DocumentInstalledItemIndent "unzip" +DocumentInstalledItemIndent "wget" +DocumentInstalledItemIndent "zip" +DocumentInstalledItemIndent "tzdata" diff --git a/images/linux/scripts/installers/1804/dotnetcore-sdk.sh b/images/linux/scripts/installers/1804/dotnetcore-sdk.sh new file mode 100644 index 000000000..f779ff5ca --- /dev/null +++ b/images/linux/scripts/installers/1804/dotnetcore-sdk.sh @@ -0,0 +1,95 @@ +#!/bin/bash +################################################################################ +## File: dotnetcore-sdk.sh +## Team: CI-Platform +## Desc: Installs .NET Core SDK +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +LATEST_DOTNET_PACKAGE=dotnet-sdk-3.0 + +LSB_RELEASE=$(lsb_release -rs) + +mksamples() +{ + sdk=$1 + sample=$2 + mkdir "$sdk" + cd "$sdk" || exit + set -e + dotnet help + dotnet new globaljson --sdk-version "$sdk" + dotnet new "$sample" + dotnet restore + dotnet build + set +e + cd .. || exit + rm -rf "$sdk" +} + +set -e + +echo "Determing if .NET Core ($LATEST_DOTNET_PACKAGE) is installed" +if ! IsInstalled $LATEST_DOTNET_PACKAGE; then + echo "Could not find .NET Core ($LATEST_DOTNET_PACKAGE), installing..." + curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg + mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg + sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list' + apt-get install apt-transport-https + apt-get update + apt-get install $LATEST_DOTNET_PACKAGE -y +else + echo ".NET Core ($LATEST_DOTNET_PACKAGE) is already installed" +fi + +# Get list of all released SDKs from channels which are not end-of-life or preview +release_urls=("https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.1/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json" "https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/3.0/releases.json") +sdks=() +for release_url in ${release_urls[@]}; do + echo "${release_url}" + releases=$(curl "${release_url}") + sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdk.version')) + sdks=("${sdks[@]}" $(echo "${releases}" | jq '.releases[]' | jq '.sdks[]?' | jq '.version')) +done + +sortedSdks=$(echo ${sdks[@]} | tr ' ' '\n' | grep -v preview | grep -v rc | grep -v display | cut -d\" -f2 | sort -u -r) + +for sdk in $sortedSdks; do + url="https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$sdk/dotnet-sdk-$sdk-linux-x64.tar.gz" + echo "$url" >> urls + echo "Adding $url to list to download later" +done + +# Download additional SDKs +echo "Downloading release tarballs..." +cat urls | xargs -n 1 -P 16 wget -q +for tarball in *.tar.gz; do + dest="./tmp-$(basename -s .tar.gz $tarball)" + echo "Extracting $tarball to $dest" + mkdir "$dest" && tar -C "$dest" -xzf "$tarball" + rsync -qav "$dest/shared/" /usr/share/dotnet/shared/ + rsync -qav "$dest/host/" /usr/share/dotnet/host/ + rsync -qav "$dest/sdk/" /usr/share/dotnet/sdk/ + rm -rf "$dest" + rm "$tarball" +done +rm urls + +DocumentInstalledItem ".NET Core SDK:" +# Smoke test each SDK +for sdk in $sortedSdks; do + mksamples "$sdk" "console" + mksamples "$sdk" "mstest" + mksamples "$sdk" "xunit" + mksamples "$sdk" "web" + mksamples "$sdk" "mvc" + mksamples "$sdk" "webapi" + DocumentInstalledItemIndent "$sdk" +done + +# NuGetFallbackFolder at /usr/share/dotnet/sdk/NuGetFallbackFolder is warmed up by smoke test +# Additional FTE will just copy to ~/.dotnet/NuGet which provides no benefit on a fungible machine +echo "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" | tee -a /etc/environment +echo "PATH=\"\$HOME/.dotnet/tools:\$PATH\"" | tee -a /etc/skel/.profile diff --git a/images/linux/scripts/installers/1804/go.sh b/images/linux/scripts/installers/1804/go.sh new file mode 100644 index 000000000..2b1dde0be --- /dev/null +++ b/images/linux/scripts/installers/1804/go.sh @@ -0,0 +1,34 @@ +#!/bin/bash +################################################################################ +## File: go.sh +## Desc: Installs go, configures GOROOT, and adds go to the path +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# This function installs Go using the specified arguments: +# $1=MajorVersion (1.11) +# $2=MajorAndMinorVersion (1.11.1) +# $3=IsDefaultVersion (true or false) +function InstallGo () { + curl -sL https://dl.google.com/go/go$2.linux-amd64.tar.gz -o go$2.linux-amd64.tar.gz + mkdir -p /usr/local/go$1 + tar -C /usr/local/go$1 -xzf go$2.linux-amd64.tar.gz --strip-components=1 go + rm go$2.linux-amd64.tar.gz + echo "GOROOT_${1//./_}_X64=/usr/local/go$1" | tee -a /etc/environment + DocumentInstalledItem "Go $1 ($(/usr/local/go$1/bin/go version))" + + # If this version of Go is to be the default version, + # symlink it into the path and point GOROOT to it. + if [ $3 = true ] + then + ln -s /usr/local/go$1/bin/* /usr/bin/ + echo "GOROOT=/usr/local/go$1" | tee -a /etc/environment + fi +} + +# Install Go versions +InstallGo 1.11 1.11.12 false +InstallGo 1.12 1.12.7 true +InstallGo 1.13 1.13 false diff --git a/images/linux/scripts/installers/1804/hosted-tool-cache.sh b/images/linux/scripts/installers/1804/hosted-tool-cache.sh new file mode 100644 index 000000000..0fb87013a --- /dev/null +++ b/images/linux/scripts/installers/1804/hosted-tool-cache.sh @@ -0,0 +1,40 @@ +#!/bin/bash +################################################################################ +## File: hosted-tool-cache.sh +## Desc: Downloads and installs hosted tools cache +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Fail out if any setups fail +set -e + +# Download hosted tool cache +AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache +echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment +azcopy --recursive \ + --source https://vstsagenttools.blob.core.windows.net/tools/hostedtoolcache/ubuntu-1804 \ + --destination $AGENT_TOOLSDIRECTORY + +# Install tools from hosted tool cache +original_directory=$PWD +setups=$(find $AGENT_TOOLSDIRECTORY -name setup.sh) +for setup in $setups; do + chmod +x $setup; + cd $(dirname $setup); + ./$(basename $setup); + cd $original_directory; +done; + +DocumentInstalledItem "Python (available through the [setup-python](https://github.com/actions/setup-python/blob/master/README.md) task)" +pythons=$(ls $AGENT_TOOLSDIRECTORY/Python) +for python in $pythons; do + DocumentInstalledItemIndent "Python $python" +done; + +DocumentInstalledItem "Ruby (available through the [setup-ruby](https://github.com/actions/setup-ruby/blob/master/README.md) task)" +rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby) +for ruby in $rubys; do + DocumentInstalledItemIndent "Ruby $ruby" +done; diff --git a/images/linux/scripts/installers/1804/kubernetes-tools.sh b/images/linux/scripts/installers/1804/kubernetes-tools.sh new file mode 100644 index 000000000..dbc5c9d4a --- /dev/null +++ b/images/linux/scripts/installers/1804/kubernetes-tools.sh @@ -0,0 +1,42 @@ +#!/bin/bash +################################################################################ +## File: kubernetes-tools.sh +## Desc: Installs kubectl, helm +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +## Install kubectl +apt-get install -y apt-transport-https +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - +touch /etc/apt/sources.list.d/kubernetes.list + +# Based on https://kubernetes.io/docs/tasks/tools/install-kubectl/, package is still called xenial +echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list +apt-get update +apt-get install -y kubectl + +# Install Helm +curl -L https://git.io/get_helm.sh | bash + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v kubectl; then + echo "kubectl was not installed" + exit 1 +fi + +if ! command -v helm; then + echo "helm was not installed" + exit 1 +fi + +echo "Initializing helm" +helm init --client-only + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "kubectl ($(kubectl version --short |& head -n 1))" +DocumentInstalledItem "helm ($(helm version --short |& head -n 1))" diff --git a/images/linux/scripts/installers/1804/mercurial.sh b/images/linux/scripts/installers/1804/mercurial.sh new file mode 100644 index 000000000..a7c048d78 --- /dev/null +++ b/images/linux/scripts/installers/1804/mercurial.sh @@ -0,0 +1,21 @@ +#!/bin/bash +################################################################################ +## File: mercurial.sh +## Desc: Installs Mercurial +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +apt-get install -y --no-install-recommends mercurial + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v hg; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Mercurial ($(hg --version | head -n 1))" diff --git a/images/linux/scripts/installers/1804/php.sh b/images/linux/scripts/installers/1804/php.sh new file mode 100644 index 000000000..7dc872eed --- /dev/null +++ b/images/linux/scripts/installers/1804/php.sh @@ -0,0 +1,181 @@ +#!/bin/bash +################################################################################ +## File: php.sh +## Desc: Installs php +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +set -e + +apt-add-repository ppa:ondrej/php -y + +# Install php7.1 +apt-fast install -y --no-install-recommends \ + php7.1 \ + php7.1-amqp \ + php7.1-bcmath \ + php7.1-bz2 \ + php7.1-cgi \ + php7.1-cli \ + php7.1-common \ + php7.1-curl \ + php7.1-dba \ + php7.1-dev \ + php7.1-enchant \ + php7.1-fpm \ + php7.1-gd \ + php7.1-gmp \ + php7.1-imap \ + php7.1-interbase \ + php7.1-intl \ + php7.1-json \ + php7.1-ldap \ + php7.1-mbstring \ + php7.1-mcrypt \ + php7.1-mysql \ + php7.1-odbc \ + php7.1-opcache \ + php7.1-pgsql \ + php7.1-phpdbg \ + php7.1-pspell \ + php7.1-readline \ + php7.1-recode \ + php7.1-snmp \ + php7.1-soap \ + php7.1-sqlite3 \ + php7.1-sybase \ + php7.1-tidy \ + php7.1-xml \ + php7.1-xmlrpc \ + php7.1-xsl \ + php7.1-zip +apt-get remove --purge -yq php7.1-dev + +# Install php7.2 +apt-fast install -y --no-install-recommends \ + php7.2 \ + php7.2-apcu \ + php7.2-amqp \ + php7.2-bcmath \ + php7.2-bz2 \ + php7.2-cgi \ + php7.2-cli \ + php7.2-common \ + php7.2-curl \ + php7.2-dba \ + php7.2-dev \ + php7.2-enchant \ + php7.2-fpm \ + php7.2-gd \ + php7.2-gmp \ + php7.2-imap \ + php7.2-interbase \ + php7.2-intl \ + php7.2-json \ + php7.2-ldap \ + php7.2-mbstring \ + php7.2-mysql \ + php7.2-odbc \ + php7.2-opcache \ + php7.2-pgsql \ + php7.2-phpdbg \ + php7.2-pspell \ + php7.2-readline \ + php7.2-recode \ + php7.2-snmp \ + php7.2-soap \ + php7.2-sqlite3 \ + php7.2-sybase \ + php7.2-tidy \ + php7.2-xml \ + php7.2-xmlrpc \ + php7.2-xsl \ + php7.2-zip + +# Install php7.3 +apt-fast install -y --no-install-recommends \ + php7.3 \ + php7.3-apcu \ + php7.3-amqp \ + php7.3-bcmath \ + php7.3-bz2 \ + php7.3-cgi \ + php7.3-cli \ + php7.3-common \ + php7.3-curl \ + php7.3-dba \ + php7.3-dev \ + php7.3-enchant \ + php7.3-fpm \ + php7.3-gd \ + php7.3-gmp \ + php7.3-imap \ + php7.3-interbase \ + php7.3-intl \ + php7.3-json \ + php7.3-ldap \ + php7.3-mbstring \ + php7.3-mysql \ + php7.3-odbc \ + php7.3-opcache \ + php7.3-pgsql \ + php7.3-phpdbg \ + php7.3-pspell \ + php7.3-readline \ + php7.3-recode \ + php7.3-snmp \ + php7.3-soap \ + php7.3-sqlite3 \ + php7.3-sybase \ + php7.3-tidy \ + php7.3-xml \ + php7.3-xmlrpc \ + php7.3-xsl \ + php7.3-zip + +apt-fast install -y --no-install-recommends \ + php-igbinary \ + php-memcache \ + php-memcached \ + php-mongodb \ + php-redis \ + php-xdebug \ + php-yaml \ + php-zmq + +apt-get remove --purge -yq php7.2-dev + +apt-fast install -y --no-install-recommends snmp + +# Install composer +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +php composer-setup.php +sudo mv composer.phar /usr/bin/composer +php -r "unlink('composer-setup.php');" + +# Install phpunit (for PHP) +wget -q -O phpunit https://phar.phpunit.de/phpunit-7.phar +chmod +x phpunit +mv phpunit /usr/local/bin/phpunit + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in php php7.1 php7.2 php7.3 composer phpunit; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "PHP 7.1 ($(php7.1 --version | head -n 1))" +DocumentInstalledItem "PHP 7.2 ($(php7.2 --version | head -n 1))" +DocumentInstalledItem "PHP 7.3 ($(php7.3 --version | head -n 1))" +DocumentInstalledItem "Composer ($(composer --version))" +DocumentInstalledItem "PHPUnit ($(phpunit --version))" diff --git a/images/linux/scripts/installers/1804/powershellcore.sh b/images/linux/scripts/installers/1804/powershellcore.sh new file mode 100644 index 000000000..c9d0e3c3d --- /dev/null +++ b/images/linux/scripts/installers/1804/powershellcore.sh @@ -0,0 +1,31 @@ +#!/bin/bash +################################################################################ +## File: powershellcore.sh +## Desc: Installs powershellcore +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +# Install Powershell +apt-get install -y powershell + +# Temp fix based on: https://github.com/PowerShell/PowerShell/issues/9746 +sudo apt remove libicu64 + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v pwsh; then + echo "pwsh was not installed" + exit 1 +fi +if ! pwsh -c 'Write-Host Hello world'; then + echo "pwsh failed to run" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Powershell ($(pwsh --version))" diff --git a/images/linux/scripts/installers/1804/preparemetadata.sh b/images/linux/scripts/installers/1804/preparemetadata.sh new file mode 100644 index 000000000..020a5ef12 --- /dev/null +++ b/images/linux/scripts/installers/1804/preparemetadata.sh @@ -0,0 +1,12 @@ +#!/bin/bash +################################################################################ +## File: preparemetadata.sh +## Desc: This script adds a image title information to the metadata +## document +################################################################################ + +source $HELPER_SCRIPTS/document.sh + +AddTitle "Hosted Ubuntu 1804 Image ($(lsb_release -ds))" +WriteItem "The following software is installed on machines in the Hosted Ubuntu 1804 (v$IMAGE_VERSION) pool" +WriteItem "***" diff --git a/images/linux/scripts/installers/7-zip.sh b/images/linux/scripts/installers/7-zip.sh new file mode 100644 index 000000000..42b6b2ef6 --- /dev/null +++ b/images/linux/scripts/installers/7-zip.sh @@ -0,0 +1,23 @@ +#!/bin/bash +################################################################################ +## File: 7-zip.sh +## Desc: Installs 7-zip +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install 7-Zip +apt-get update -y +apt-get install -y p7zip p7zip-full p7zip-rar + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v 7z; then + echo "7-Zip was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "7-Zip $(7z i | head --lines=2 | cut -d ' ' -f 3 | tr -d '\n')" diff --git a/images/linux/scripts/installers/ansible.sh b/images/linux/scripts/installers/ansible.sh new file mode 100644 index 000000000..0411a6421 --- /dev/null +++ b/images/linux/scripts/installers/ansible.sh @@ -0,0 +1,25 @@ +#!/bin/bash +################################################################################ +## File: ansible.sh +## Desc: Installs Ansible +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Ansible PPA and latest Ansible +add-apt-repository ppa:ansible/ansible +apt-get update +apt-get install -y --no-install-recommends ansible + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v ansible; then + echo "Ansible was not installed or found on PATH" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Ansible ($(ansible --version |& head -n 1))" diff --git a/images/linux/scripts/installers/aws.sh b/images/linux/scripts/installers/aws.sh new file mode 100644 index 000000000..d2fcaf5de --- /dev/null +++ b/images/linux/scripts/installers/aws.sh @@ -0,0 +1,26 @@ +#!/bin/bash +################################################################################ +## File: aws.sh +## Desc: Installs the AWS CLI +################################################################################ + +# Source the helpers +source $HELPER_SCRIPTS/document.sh + +# Install the AWS CLI +curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" +unzip awscli-bundle.zip +./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws +rm awscli-bundle.zip +rm -rf awscli-bundle + +# Validate the installation +echo "Validate the installation" +if ! command -v aws; then + echo "aws was not installed" + exit 1 +fi + +# Document the installed version +echo "Document the installed version" +DocumentInstalledItem "AWS CLI ($(aws --version 2>&1))" diff --git a/images/linux/scripts/installers/azcopy.sh b/images/linux/scripts/installers/azcopy.sh new file mode 100644 index 000000000..317a4d84c --- /dev/null +++ b/images/linux/scripts/installers/azcopy.sh @@ -0,0 +1,25 @@ +#!/bin/bash +################################################################################ +## File: azcopy.sh +## Desc: Installs AzCopy +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install AzCopy +wget -O azcopy.tar.gz https://aka.ms/downloadazcopylinux64 +tar -xf azcopy.tar.gz +rm azcopy.tar.gz +./install.sh + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v azcopy; then + echo "azcopy was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "AzCopy ($(azcopy --version))" diff --git a/images/linux/scripts/installers/azure-cli.sh b/images/linux/scripts/installers/azure-cli.sh new file mode 100644 index 000000000..bf9d43aec --- /dev/null +++ b/images/linux/scripts/installers/azure-cli.sh @@ -0,0 +1,26 @@ +#!/bin/bash +################################################################################ +## File: azure-cli.sh +## Desc: Installed Azure CLI (az) +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_CODENAME=$(lsb_release -cs) + +# Install Azure CLI (instructions taken from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli) +echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $LSB_CODENAME main" | tee /etc/apt/sources.list.d/azure-cli.list +apt-key adv --keyserver packages.microsoft.com --recv-keys B02C46DF417A0893 +apt-get update +apt-get install -y --no-install-recommends apt-transport-https azure-cli + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v az; then + echo "azure-cli was not installed" + exit 1 +fi + +# Document what was added to the image +DocumentInstalledItem "Azure CLI ($(az -v | head -n 1))" diff --git a/images/linux/scripts/installers/azure-devops-cli.sh b/images/linux/scripts/installers/azure-devops-cli.sh new file mode 100644 index 000000000..c8ca46718 --- /dev/null +++ b/images/linux/scripts/installers/azure-devops-cli.sh @@ -0,0 +1,23 @@ +#!/bin/bash +################################################################################ +## File: azure-devops-cli.sh +## Desc: Installed Azure DevOps CLI (az devops) +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# install azure devops Cli extension +az extension add -n azure-devops + +# check to determine if extension was installed or not +if [ $? -eq 0 ] +then + echo "azure DevOps Cli extension was installed" +else + echo "azure DevOps Cli extension was not installed" + exit 1 +fi + +# Document what was added to the image +DocumentInstalledItem "Azure CLI ($(az -v | grep azure-devops))" diff --git a/images/linux/scripts/installers/boost.sh b/images/linux/scripts/installers/boost.sh new file mode 100644 index 000000000..be9aa802f --- /dev/null +++ b/images/linux/scripts/installers/boost.sh @@ -0,0 +1,31 @@ +#!/bin/bash +################################################################################ +## File: boost.sh +## Desc: Installs Boost C++ Libraries +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +BOOST_ZIP_PATH=/opt/hostedtoolcache/Boost +BOOST_LIB=/usr/local/share/boost + +# Install Boost +for BOOST_VERSION in ${BOOST_VERSIONS//,/ } +do + BOOST_SYMLINK_VER=`echo "${BOOST_VERSION//[.]/_}"` + BOOST_ROOT="BOOST_ROOT_$BOOST_SYMLINK_VER" + BOOST_ZIP="boost_`echo $BOOST_VERSION`_gcc.zip" + + unzip $BOOST_ZIP_PATH/$BOOST_ZIP -d $BOOST_LIB + + echo "$BOOST_ROOT=$BOOST_LIB/$BOOST_VERSION" | tee -a /etc/environment + if [[ $BOOST_VERSION == $BOOST_DEFAULT ]]; then + echo "BOOST_ROOT=$BOOST_LIB/$BOOST_VERSION" | tee -a /etc/environment + fi + + DocumentInstalledItem "Boost C++ Libraries $BOOST_VERSION" +done + +# Deleting archives with Boost Libraries +rm -rf $BOOST_ZIP_PATH diff --git a/images/linux/scripts/installers/build-essential.sh b/images/linux/scripts/installers/build-essential.sh new file mode 100644 index 000000000..964aa0459 --- /dev/null +++ b/images/linux/scripts/installers/build-essential.sh @@ -0,0 +1,24 @@ +#!/bin/bash +################################################################################ +## File: build-essential.sh +## Desc: Installs build-essential package +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +PACKAGE=build-essential + +# Test to see if the software in question is already installed, if not install it +echo "Checking to see if the installer script has already been run" +if ! IsInstalled $PACKAGE; then + echo "Installing $PACKAGE" + apt-get install -y --no-install-recommends $PACKAGE +else + echo "$PACKAGE is already installed" +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "$PACKAGE" diff --git a/images/linux/scripts/installers/clang.sh b/images/linux/scripts/installers/clang.sh new file mode 100644 index 000000000..5b85448a7 --- /dev/null +++ b/images/linux/scripts/installers/clang.sh @@ -0,0 +1,31 @@ +#!/bin/bash +################################################################################ +## File: example.sh +## Desc: This is an example script that can be copied to add a new software +## installer to the image +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - +apt-add-repository "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-6.0 main" +apt-get update +apt-get install -y clang-6.0 lldb-6.0 lld-6.0 + +update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-6.0 100 +update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 100 + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in clang clang++ clang-6.0 clang++-6.0; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Clang 6.0 ($(clang-6.0 --version | head -n 1))" diff --git a/images/linux/scripts/installers/cmake.sh b/images/linux/scripts/installers/cmake.sh new file mode 100644 index 000000000..7e284c839 --- /dev/null +++ b/images/linux/scripts/installers/cmake.sh @@ -0,0 +1,30 @@ +#!/bin/bash +################################################################################ +## File: cmake.sh +## Desc: Installs CMake +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Test to see if the software in question is already installed, if not install it +echo "Checking to see if the installer script has already been run" +if command -v cmake; then + echo "Example variable already set to $EXAMPLE_VAR" +else + curl -sL https://cmake.org/files/v3.12/cmake-3.12.4-Linux-x86_64.sh -o cmakeinstall.sh \ + && chmod +x cmakeinstall.sh \ + && ./cmakeinstall.sh --prefix=/usr/local --exclude-subdir \ + && rm cmakeinstall.sh +fi + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v cmake; then + echo "cmake was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "CMake ($(cmake --version | head -n 1))" diff --git a/images/linux/scripts/installers/docker-compose.sh b/images/linux/scripts/installers/docker-compose.sh new file mode 100644 index 000000000..0ee5f47ac --- /dev/null +++ b/images/linux/scripts/installers/docker-compose.sh @@ -0,0 +1,26 @@ +#!/bin/bash +################################################################################ +## File: docker-compose.sh +## Desc: Installs Docker Compose +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +version="1.22.0" + +# Install latest docker-compose from releases +curl -L "https://github.com/docker/compose/releases/download/$version/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose +chmod +x /usr/local/bin/docker-compose + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v docker-compose; then + echo "docker-compose was not installed" + exit 1 +fi + +## Add version information to the metadata file +echo "Documenting Docker Compose version" +docker_compose_version=$(docker-compose -v) +DocumentInstalledItem "Docker Compose (${docker_compose_version})" diff --git a/images/linux/scripts/installers/docker-moby.sh b/images/linux/scripts/installers/docker-moby.sh new file mode 100644 index 000000000..ed1817224 --- /dev/null +++ b/images/linux/scripts/installers/docker-moby.sh @@ -0,0 +1,43 @@ +#!/bin/bash +################################################################################ +## File: docker-ce.sh +## Desc: Installs docker onto the image, but does not pre-pull any images +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +docker_package=moby + +## Check to see if docker is already installed +echo "Determing if Docker ($docker_package) is installed" +if ! IsInstalled $docker_package; then + echo "Docker ($docker_package) was not found. Installing..." + apt-get remove -y moby-engine moby-cli + apt-get update + apt-get install -y apt-transport-https ca-certificates curl software-properties-common + curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - + curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/microsoft-prod.list + apt-get update + apt-get install -y moby-engine moby-cli +else + echo "Docker ($docker_package) is already installed" +fi + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v docker; then + echo "docker was not installed" + exit 1 +else + # Docker daemon takes time to come up after installing + sleep 10 + set -e + docker info + set +e +fi + +## Add version information to the metadata file +echo "Documenting Docker version" +docker_version=$(docker -v) +DocumentInstalledItem "Docker ($docker_version)" diff --git a/images/linux/scripts/installers/docker.sh b/images/linux/scripts/installers/docker.sh new file mode 100644 index 000000000..2b9db9b43 --- /dev/null +++ b/images/linux/scripts/installers/docker.sh @@ -0,0 +1,34 @@ +#!/bin/bash +################################################################################ +## File: docker.sh +## Desc: Installs the correct version of docker onto the image, and pulls +## down the default docker image used for building on ubuntu +################################################################################ + +source $HELPER_SCRIPTS/apt.sh +source $HELPER_SCRIPTS/document.sh + +DOCKER_PACKAGE=moby + +apt-get remove -y moby-engine mobi-cli +apt-get update +apt-get install -y apt-transport-https ca-certificates curl software-properties-common +apt-get update +apt-get install -y moby-engine mobi-cli + +docker pull node:10 +docker pull node:12 +docker pull buildpack-deps:stretch +docker pull node:10-alpine +docker pull node:12-alpine +docker pull debian:8 +docker pull debian:9 +docker pull alpine:3.7 +docker pull alpine:3.8 +docker pull alpine:3.9 +docker pull alpine:3.10 + +## Add version information to the metadata file +echo "Documenting Docker version" +DOCKER_VERSION=`docker -v` +DocumentInstalledItem "Docker ($DOCKER_VERSION)" diff --git a/images/linux/scripts/installers/erlang.sh b/images/linux/scripts/installers/erlang.sh new file mode 100644 index 000000000..4ff26d044 --- /dev/null +++ b/images/linux/scripts/installers/erlang.sh @@ -0,0 +1,39 @@ +#!/bin/bash +################################################################################ +## File: erlang.sh +## Desc: Installs erlang +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +source_list=/etc/apt/sources.list.d/eslerlang.list + +# Install Erlang +echo "deb http://binaries.erlang-solutions.com/debian $(lsb_release -cs) contrib" > $source_list +wget -O - http://binaries.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add - +apt-get update +apt-get install -y --no-install-recommends esl-erlang + +# Install rebar3 +wget -q -O rebar3 https://s3.amazonaws.com/rebar3/rebar3 +chmod +x rebar3 +mv rebar3 /usr/local/bin/rebar3 + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in erl erlc rebar3; do + if ! command -v $cmd; then + echo "$cmd was not installed or not found on PATH" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +erlang_version="$(erl -version 2>&1 | tr -d '\n' | tr -d '\r')" +DocumentInstalledItem "Erlang ($erlang_version)" + +# Clean up source list +rm $source_list diff --git a/images/linux/scripts/installers/example.sh b/images/linux/scripts/installers/example.sh new file mode 100644 index 000000000..aeab39f02 --- /dev/null +++ b/images/linux/scripts/installers/example.sh @@ -0,0 +1,31 @@ +#!/bin/bash +################################################################################ +## File: example.sh +## Desc: This is an example script that can be copied to add a new software +## installer to the image +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Test to see if the software in question is already installed, if not install it +echo "Checking to see if the installer script has already been run" +if [ -z $EXAMPLE_VAR ]; then + $EXAMPLE_VAR=1.0.0 +else + echo "Example variable already set to $EXAMPLE_VAR" +fi + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if [ -z $EXAMPLE_VAR ]; then + echo "EXAMPLE_VAR variable was not set as expected" + exit 1 +else + echo "EXAMPLE_VAR was set properly" +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Example Var ($EXAMPLE_VAR)" diff --git a/images/linux/scripts/installers/firefox.sh b/images/linux/scripts/installers/firefox.sh new file mode 100644 index 000000000..3f093c7c2 --- /dev/null +++ b/images/linux/scripts/installers/firefox.sh @@ -0,0 +1,25 @@ +#!/bin/bash +################################################################################ +## File: firefox.sh +## Desc: Installs Firefox +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Firefox +apt-get install -y firefox + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v firefox; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +# Resolves: Running Firefox as root in a regular user's session is not supported. +# ($HOME is /home/packer which is owned by packer.) +HOME=/root +DocumentInstalledItem "Firefox ($(firefox --version))" diff --git a/images/linux/scripts/installers/gcc.sh b/images/linux/scripts/installers/gcc.sh new file mode 100644 index 000000000..234353a5d --- /dev/null +++ b/images/linux/scripts/installers/gcc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +################################################################################ +## File: gcc.sh +## Desc: Installs GNU C++ +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install GNU C++ compiler +add-apt-repository ppa:ubuntu-toolchain-r/test -y +apt-get update -y +apt-get install g++-7 -y + + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v g++-7; then + echo "GNU C++ was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "GNU C++ $(g++-7 --version | head -n 1 | cut -d ' ' -f 4)" diff --git a/images/linux/scripts/installers/git.sh b/images/linux/scripts/installers/git.sh new file mode 100644 index 000000000..be1393aa4 --- /dev/null +++ b/images/linux/scripts/installers/git.sh @@ -0,0 +1,37 @@ +#!/bin/bash +################################################################################ +## File: git.sh +## Desc: Installs Git +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +## Install git +add-apt-repository ppa:git-core/ppa -y +apt-get update +apt-get install git -y +git --version + +# Install git-lfs +curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash +apt-get install -y --no-install-recommends git-lfs + +# Run tests to determine that the software installed as expected +echo "Testing git installation" +if ! command -v git; then + echo "git was not installed" + exit 1 +fi +echo "Testing git-lfs installation" +if ! command -v git-lfs; then + echo "git-lfs was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, document the installed versions" +# git version 2.20.1 +DocumentInstalledItem "Git ($(git --version 2>&1 | cut -d ' ' -f 3))" +# git-lfs/2.6.1 (GitHub; linux amd64; go 1.11.1) +DocumentInstalledItem "Git Large File Storage (LFS) ($(git-lfs --version 2>&1 | cut -d ' ' -f 1 | cut -d '/' -f 2))" diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh new file mode 100644 index 000000000..151d18b06 --- /dev/null +++ b/images/linux/scripts/installers/google-chrome.sh @@ -0,0 +1,27 @@ +#!/bin/bash +################################################################################ +## File: google-chrome.sh +## Desc: Installs google-chrome +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_RELEASE=$(lsb_release -rs) + +wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - +echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list +apt-get update +apt-get install -y google-chrome-stable +echo "CHROME_BIN=/usr/bin/google-chrome" | tee -a /etc/environment + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v google-chrome; then + echo "google-chrome was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Google Chrome ($(google-chrome --version))" diff --git a/images/linux/scripts/installers/google-cloud-sdk.sh b/images/linux/scripts/installers/google-cloud-sdk.sh new file mode 100644 index 000000000..f057d6ab9 --- /dev/null +++ b/images/linux/scripts/installers/google-cloud-sdk.sh @@ -0,0 +1,25 @@ +#!/bin/bash +################################################################################ +## File: google-cloud-sdk.sh +## Desc: Installs the Google Cloud SDK +################################################################################ + +# Source the helpers +source $HELPER_SCRIPTS/document.sh + +# Install the Google Cloud SDK +echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list +curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - +sudo apt-get update -y +sudo apt-get install -y google-cloud-sdk + +# Validate the installation +echo "Validate the installation" +if ! command -v gcloud; then + echo "gcloud was not installed" + exit 1 +fi + +# Document the installed version +echo "Document the installed version" +DocumentInstalledItem "Google Cloud SDK ($(gcloud --version | head -n 1 | cut -d ' ' -f 4))" diff --git a/images/linux/scripts/installers/haskell.sh b/images/linux/scripts/installers/haskell.sh new file mode 100644 index 000000000..63d3d4c34 --- /dev/null +++ b/images/linux/scripts/installers/haskell.sh @@ -0,0 +1,64 @@ +#!/bin/bash +################################################################################ +## File: haskell.sh +## Desc: Installs Haskell +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Herbert V. Riedel's PPA for managing multiple version of ghc on ubuntu. +# https://launchpad.net/~hvr/+archive/ubuntu/ghc +apt-get install -y software-properties-common +add-apt-repository -y ppa:hvr/ghc +apt-get update + +# Install various versions of ghc and cabal +apt-get install -y \ + ghc-8.0.2 \ + ghc-8.2.2 \ + ghc-8.4.4 \ + ghc-8.6.2 \ + ghc-8.6.3 \ + ghc-8.6.4 \ + ghc-8.6.5 \ + ghc-8.8.1 \ + cabal-install-2.0 \ + cabal-install-2.2 \ + cabal-install-2.4 \ + cabal-install-3.0 + +# Install haskell stack, pinned to v2.1.3 +curl -sSL https://raw.githubusercontent.com/commercialhaskell/stack/v2.1.3/etc/scripts/get-stack.sh | sh + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +# Check all ghc versions +for version in 8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1; do + if ! command -v /opt/ghc/$version/bin/ghc; then + echo "ghc $version was not installed" + exit 1 + fi +done +# Check all cabal versions +for version in 2.0 2.2 2.4 3.0; do + if ! command -v /opt/cabal/$version/bin/cabal; then + echo "cabal $version was not installed" + exit 1 + fi +done +# Check stack +if ! command -v stack; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +for version in 2.0 2.2 2.4 3.0; do + DocumentInstalledItem "Haskell Cabal ($(/opt/cabal/$version/bin/cabal --version))" +done +for version in 8.0.2 8.2.2 8.4.4 8.6.2 8.6.3 8.6.4 8.6.5 8.8.1; do + DocumentInstalledItem "GHC ($(/opt/ghc/$version/bin/ghc --version))" +done +DocumentInstalledItem "Haskell Stack ($(stack --version))" diff --git a/images/linux/scripts/installers/heroku.sh b/images/linux/scripts/installers/heroku.sh new file mode 100644 index 000000000..22d4665f5 --- /dev/null +++ b/images/linux/scripts/installers/heroku.sh @@ -0,0 +1,22 @@ +#!/bin/bash +################################################################################ +## File: heroku.sh +## Desc: Installs Heroku CLI +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Heroku CLI +curl https://cli-assets.heroku.com/install-ubuntu.sh | sh + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v heroku; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Heroku ($(heroku version))" diff --git a/images/linux/scripts/installers/hhvm.sh b/images/linux/scripts/installers/hhvm.sh new file mode 100644 index 000000000..c040af3e0 --- /dev/null +++ b/images/linux/scripts/installers/hhvm.sh @@ -0,0 +1,37 @@ +#!/bin/bash +################################################################################ +## File: hhvm.sh +## Desc: Installs hhvm +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +hhvm_package=hhvm + +# Test to see if the software in question is already installed, if not install it +echo "Checking to see if the installer script has already been run" +if ! IsInstalled ${hhvm_package}; then + apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xB4112585D386EB94 + add-apt-repository https://dl.hhvm.com/ubuntu + apt-get update + apt-get -qq install -y hhvm +else + echo "${hhvm_package} already installed" +fi + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! IsInstalled ${hhvm_package}; then + echo "${hhvm_package} was not installed" + exit 1 +fi + +if ! command -v hhvm; then + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "HHVM ($(hhvm --version | head -n 1))" diff --git a/images/linux/scripts/installers/image-magick.sh b/images/linux/scripts/installers/image-magick.sh new file mode 100644 index 000000000..db186057d --- /dev/null +++ b/images/linux/scripts/installers/image-magick.sh @@ -0,0 +1,20 @@ +#!/bin/bash +################################################################################ +## File: image-magick.sh +## Desc: Installs ImageMagick +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install ImageMagick +apt-get install -y --no-install-recommends --fix-missing \ + imagemagick \ + libmagickcore-dev \ + libmagickwand-dev \ + libmagic-dev + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "ImageMagick" diff --git a/images/linux/scripts/installers/java-tools.sh b/images/linux/scripts/installers/java-tools.sh new file mode 100644 index 000000000..c1c254745 --- /dev/null +++ b/images/linux/scripts/installers/java-tools.sh @@ -0,0 +1,78 @@ +#!/bin/bash +################################################################################ +## File: java-tools.sh +## Team: CI-Platform +## Desc: Installs Java and related tooling (Ant, Gradle, Maven) +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +DEFAULT_JDK_VERSION=8 + +set -e + +# Install the Azul Systems Zulu JDKs +# See https://www.azul.com/downloads/azure-only/zulu/ +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 +apt-add-repository "deb http://repos.azul.com/azure-only/zulu/apt stable main" +apt-get -q update +apt-get -y install zulu-7-azure-jdk=\* +apt-get -y install zulu-8-azure-jdk=\* +apt-get -y install zulu-11-azure-jdk=\* +apt-get -y install zulu-12-azure-jdk=\* +update-java-alternatives -s /usr/lib/jvm/zulu-8-azure-amd64 +echo "JAVA_HOME_7_X64=/usr/lib/jvm/zulu-7-azure-amd64" | tee -a /etc/environment +echo "JAVA_HOME_8_X64=/usr/lib/jvm/zulu-8-azure-amd64" | tee -a /etc/environment +echo "JAVA_HOME_11_X64=/usr/lib/jvm/zulu-11-azure-amd64" | tee -a /etc/environment +echo "JAVA_HOME_12_X64=/usr/lib/jvm/zulu-12-azure-amd64" | tee -a /etc/environment +echo "JAVA_HOME=/usr/lib/jvm/zulu-${DEFAULT_JDK_VERSION}-azure-amd64" | tee -a /etc/environment +echo "JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8" | tee -a /etc/environment + +# Install Ant +apt-fast install -y --no-install-recommends ant ant-optional +echo "ANT_HOME=/usr/share/ant" | tee -a /etc/environment + +# Install Maven +curl -sL https://www-eu.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.zip -o maven.zip +unzip -d /usr/share maven.zip +rm maven.zip +ln -s /usr/share/apache-maven-3.6.2/bin/mvn /usr/bin/mvn +echo "M2_HOME=/usr/share/apache-maven-3.6.2" | tee -a /etc/environment + +# Install Gradle +# This script downloads the latest HTML list of releases at https://gradle.org/releases/. +# Then, it extracts the top-most release download URL, relying on the top-most URL being for the latest release. +# The release download URL looks like this: https://services.gradle.org/distributions/gradle-5.2.1-bin.zip +# The release version is extracted from the download URL (i.e. 5.2.1). +# After all of this, the release is downloaded, extracted, a symlink is created that points to it, and GRADLE_HOME is set. +wget -O gradleReleases.html https://gradle.org/releases/ +gradleUrl=$(grep -m 1 -o "https:\/\/services.gradle.org\/distributions\/gradle-.*-bin\.zip" gradleReleases.html | head -1) +gradleVersion=$(echo $gradleUrl | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p') +rm gradleReleases.html +echo "gradleUrl=$gradleUrl" +echo "gradleVersion=$gradleVersion" +curl -sL $gradleUrl -o gradleLatest.zip +unzip -d /usr/share gradleLatest.zip +rm gradleLatest.zip +ln -s /usr/share/gradle-"${gradleVersion}"/bin/gradle /usr/bin/gradle +echo "GRADLE_HOME=/usr/share/gradle" | tee -a /etc/environment + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in gradle java javac mvn ant; do + if ! command -v $cmd; then + echo "$cmd was not installed or found on path" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Azul Zulu OpenJDK (7) ($(/usr/lib/jvm/zulu-7-azure-amd64/bin/java -showversion |& head -n 1))" +DocumentInstalledItem "Azul Zulu OpenJDK (8) ($(/usr/lib/jvm/zulu-8-azure-amd64/bin/java -showversion |& head -n 1))" +DocumentInstalledItem "Azul Zulu OpenJDK (11) ($(/usr/lib/jvm/zulu-11-azure-amd64/bin/java -showversion |& head -n 1))" +DocumentInstalledItem "Azul Zulu OpenJDK (12) ($(/usr/lib/jvm/zulu-12-azure-amd64/bin/java -showversion |& head -n 1))" +DocumentInstalledItem "Ant ($(ant -version))" +DocumentInstalledItem "Gradle ${gradleVersion}" +DocumentInstalledItem "Maven ($(mvn -version | head -n 1))" diff --git a/images/linux/scripts/installers/kind.sh b/images/linux/scripts/installers/kind.sh new file mode 100644 index 000000000..8cbd1eeb3 --- /dev/null +++ b/images/linux/scripts/installers/kind.sh @@ -0,0 +1,26 @@ +#!/bin/bash +################################################################################ +## File: kind.sh +## Desc: Installs kind +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install KIND +KIND_VERSION="v0.5.1" + +curl -L -o /usr/local/bin/kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64" +chmod +x /usr/local/bin/kind + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v kind; then + echo "Kind was not installed or found on PATH" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Kind ($(kind version))" diff --git a/images/linux/scripts/installers/leiningen.sh b/images/linux/scripts/installers/leiningen.sh new file mode 100644 index 000000000..c343fc069 --- /dev/null +++ b/images/linux/scripts/installers/leiningen.sh @@ -0,0 +1,35 @@ +#!/bin/bash +################################################################################ +## File: leiningen.sh +## Desc: Installs Leiningen +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +set -e + +LEIN_BIN=/usr/local/bin/lein +curl -s https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > $LEIN_BIN +chmod 0755 $LEIN_BIN + +# Run lein to trigger self-install +export LEIN_HOME=/usr/local/lib/lein +lein + +LEIN_JAR=$(find $LEIN_HOME -name "leiningen-*-standalone.jar") +echo "LEIN_JAR=$LEIN_JAR" | tee -a /etc/environment +echo "LEIN_HOME=$LEIN_HOME" | tee -a /etc/environment + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v lein; then + echo "lein was not installed" + exit 1 +else + lein new app testapp && rm -rf testapp +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Leiningen ($(lein -v))" diff --git a/images/linux/scripts/installers/miniconda.sh b/images/linux/scripts/installers/miniconda.sh new file mode 100644 index 000000000..e012781f0 --- /dev/null +++ b/images/linux/scripts/installers/miniconda.sh @@ -0,0 +1,23 @@ +#!/bin/bash +################################################################################ +## File: miniconda.sh +## Desc: Installs miniconda +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Miniconda +curl -sL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o miniconda.sh \ + && chmod +x miniconda.sh \ + && ./miniconda.sh -b -p /usr/share/miniconda \ + && rm miniconda.sh + +CONDA=/usr/share/miniconda +echo "CONDA=$CONDA" | tee -a /etc/environment + +ln -s $CONDA/bin/conda /usr/bin/conda + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Miniconda ($($CONDA/bin/conda --version))" diff --git a/images/linux/scripts/installers/mono.sh b/images/linux/scripts/installers/mono.sh new file mode 100644 index 000000000..c00ca95b8 --- /dev/null +++ b/images/linux/scripts/installers/mono.sh @@ -0,0 +1,29 @@ +#!/bin/bash +################################################################################ +## File: cmake.sh +## Desc: Installs Mono +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +LSB_CODENAME=$(lsb_release -cs) + +# Test to see if the software in question is already installed, if not install it +# wget "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" -O out && sudo apt-key add out && rm out + +apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +echo "deb https://download.mono-project.com/repo/ubuntu stable-$LSB_CODENAME main" | tee /etc/apt/sources.list.d/mono-official-stable.list +apt-get update +apt-get install -y --no-install-recommends apt-transport-https mono-complete + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v mono; then + echo "mono was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Mono ($(mono --version | head -n 1))" diff --git a/images/linux/scripts/installers/mysql.sh b/images/linux/scripts/installers/mysql.sh new file mode 100644 index 000000000..fecbc9eb6 --- /dev/null +++ b/images/linux/scripts/installers/mysql.sh @@ -0,0 +1,43 @@ +#!/bin/bash +################################################################################ +## File: mysql.sh +## Desc: Installs MySQL Client +################################################################################ + +## Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +export ACCEPT_EULA=Y + +# Install MySQL Client +apt-get install mysql-client -y + +# Install MySQL Server +MYSQL_ROOT_PASSWORD=root +echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections +echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections + +apt-get install -y mysql-server + +# Install MS SQL Server client tools (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?view=sql-server-2017) +apt-get install -y mssql-tools unixodbc-dev +apt-get -f install +ln -s /opt/mssql-tools/bin/* /usr/local/bin/ + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v mysql; then + echo "mysql was not installed" + exit 1 +fi + +set -e +mysql -vvv -e 'CREATE DATABASE smoke_test' -uroot -proot +mysql -vvv -e 'DROP DATABASE smoke_test' -uroot -proot +set +e + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "MySQL ($(mysql --version))" +DocumentInstalledItem "MySQL Server (user:root password:root)" +DocumentInstalledItem "MS SQL Server Client Tools" diff --git a/images/linux/scripts/installers/nodejs.sh b/images/linux/scripts/installers/nodejs.sh new file mode 100644 index 000000000..8ad5c457f --- /dev/null +++ b/images/linux/scripts/installers/nodejs.sh @@ -0,0 +1,47 @@ +#!/bin/bash +################################################################################ +## File: nodejs.sh +## Team: CI-Platform +## Desc: Installs Node.js LTS and related tooling (Gulp, Bower, Grunt) +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install LTS Node.js and related build tools +curl -sL https://git.io/n-install | bash -s -- -ny - +~/n/bin/n lts +npm install -g bower grunt gulp n parcel-bundler typescript +npm install -g --save-dev webpack webpack-cli +npm install -g npm +rm -rf ~/n + +# Install Yarn repository and key +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list +apt-get update + +# Install yarn +apt-get install -y --no-install-recommends yarn + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in node bower grunt gulp webpack parcel yarn; do + if ! command -v $cmd; then + echo "$cmd was not installed" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Node.js ($(node --version))" +DocumentInstalledItem "Bower ($(bower --version))" +DocumentInstalledItem "Grunt ($(grunt --version))" +DocumentInstalledItem "Gulp ($(gulp --version))" +DocumentInstalledItem "n ($(n --version))" +DocumentInstalledItem "Parcel ($(parcel --version))" +DocumentInstalledItem "TypeScript ($(tsc --version))" +DocumentInstalledItem "Webpack ($(webpack --version))" +DocumentInstalledItem "Webpack CLI ($(webpack-cli --version))" +DocumentInstalledItem "Yarn ($(yarn --version))" diff --git a/images/linux/scripts/installers/phantomjs.sh b/images/linux/scripts/installers/phantomjs.sh new file mode 100644 index 000000000..338bed36b --- /dev/null +++ b/images/linux/scripts/installers/phantomjs.sh @@ -0,0 +1,29 @@ +#!/bin/bash +################################################################################ +## File: phantomjs.sh +## Desc: Installs PhantomJS +################################################################################ + +set -e + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install PhantomJS +apt-get install -y chrpath libssl-dev libxft-dev libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev +PHANTOM_JS=phantomjs-2.1.1-linux-x86_64 +wget https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_JS.tar.bz2 +tar xvjf $PHANTOM_JS.tar.bz2 +mv $PHANTOM_JS /usr/local/share +ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v phantomjs; then + echo "phantomjs was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "PhantomJS ($(phantomjs --version))" diff --git a/images/linux/scripts/installers/pollinate.sh b/images/linux/scripts/installers/pollinate.sh new file mode 100644 index 000000000..c1692d435 --- /dev/null +++ b/images/linux/scripts/installers/pollinate.sh @@ -0,0 +1,22 @@ +#!/bin/bash +################################################################################ +## File: pollinate.sh +## Desc: Installs Pollinate +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Pollinate +apt-get install -y --no-install-recommends pollinate + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v pollinate; then + echo "pollinate was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Pollinate" diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh new file mode 100644 index 000000000..4b56cf159 --- /dev/null +++ b/images/linux/scripts/installers/python.sh @@ -0,0 +1,67 @@ +#!/bin/bash +################################################################################ +## File: python.sh +## Desc: Installs Python 2/3 and related tools (pip, pypy) +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Python, Python 3, pip, pip3 +apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip + +# Install PyPy 2.7 to $AGENT_TOOLSDIRECTORY +wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.1.0-linux64.tar.bz2 +tar -x -C /tmp -f /tmp/pypy2.7-v7.1.0-linux64.tar.bz2 +rm /tmp/pypy2.7-v7.1.0-linux64.tar.bz2 +mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/2.7.13 +mv /tmp/pypy2.7-v7.1.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64 +touch $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64.complete + +# add pypy to PATH by default +ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy /usr/local/bin/pypy +# pypy will be the python in PATH when its tools cache directory is prepended to PATH +# PEP 394-style symlinking; don't bother with minor version +ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2 +ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python + +# Install latest Pip for PyPy2 +$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m ensurepip +$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m pip install --ignore-installed pip + +# Install PyPy 3.5 to $AGENT_TOOLSDIRECTORY +wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy3.5-v7.0.0-linux64.tar.bz2 +tar -x -C /tmp -f /tmp/pypy3.5-v7.0.0-linux64.tar.bz2 +rm /tmp/pypy3.5-v7.0.0-linux64.tar.bz2 +mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/3.5.3 +mv /tmp/pypy3.5-v7.0.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64 +touch $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64.complete + +# add pypy3 to PATH by default +ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 /usr/local/bin/pypy3 +# pypy3 will be the python in PATH when its tools cache directory is prepended to PATH +# PEP 394-style symlinking; don't bother with minor version +ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/python3 +ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/python3 $AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/python + +# Install latest Pip for PyPy3 +$AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 -m ensurepip +$AGENT_TOOLSDIRECTORY/PyPy/3.5.3/x64/bin/pypy3 -m pip install --ignore-installed pip + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +for cmd in python pip pypy python3 pip3 pypy3; do + if ! command -v $cmd; then + echo "$cmd was not installed or not found on PATH" + exit 1 + fi +done + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Python ($(python --version 2>&1))" +DocumentInstalledItem "pip ($(pip --version))" +DocumentInstalledItem "Python3 ($(python3 --version))" +DocumentInstalledItem "pip3 ($(pip3 --version))" +DocumentInstalledItem "PyPy2 ($(pypy --version 2>&1 | grep PyPy))" +DocumentInstalledItem "PyPy3 ($(pypy3 --version 2>&1 | grep PyPy))" diff --git a/images/linux/scripts/installers/ruby.sh b/images/linux/scripts/installers/ruby.sh new file mode 100644 index 000000000..cc2d29709 --- /dev/null +++ b/images/linux/scripts/installers/ruby.sh @@ -0,0 +1,11 @@ +#!/bin/bash +################################################################################ +## File: ruby.sh +## Desc: Installs Ruby requirements +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Ruby requirements +apt-get install -y libz-dev openssl libssl-dev diff --git a/images/linux/scripts/installers/rust.sh b/images/linux/scripts/installers/rust.sh new file mode 100644 index 000000000..35fe66b25 --- /dev/null +++ b/images/linux/scripts/installers/rust.sh @@ -0,0 +1,54 @@ +#!/bin/bash +################################################################################ +## File: rust.sh +## Desc: Installs Rust +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +set -e + +export RUSTUP_HOME=/usr/share/rust/.rustup +export CARGO_HOME=/usr/share/rust/.cargo + +curl https://sh.rustup.rs -sSf | sh -s -- -y + +# Add Cargo and Rust binaries to the machine path +echo "PATH=${CARGO_HOME}/bin:$PATH" | tee -a /etc/environment +source $CARGO_HOME/env + +# Install common tools +rustup component add rustfmt +rustup component add clippy +cargo install bindgen +cargo install cbindgen + +echo "Test installation of the Rust toochain" + +# Permissions +chmod -R 777 $(dirname $RUSTUP_HOME) + +for cmd in rustup rustc rustdoc cargo rustfmt cargo-clippy bindgen cbindgen; do + if ! command -v $cmd --version; then + echo "$cmd was not installed or is not found on the path" + exit 1 + fi +done + +# Rust Symlinks are added to a default profile /etc/skel +pushd /etc/skel +ln -sf $RUSTUP_HOME .rustup +ln -sf $CARGO_HOME .cargo +popd + +# Document what was added to the image +echo "Lastly, document what was added to the metadata file" +DocumentInstalledItem "rustup ($(rustup --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "rust ($(rustc --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "cargo ($(cargo --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "rustfmt ($(rustfmt --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "clippy ($(cargo-clippy --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "rustdoc ($(rustdoc --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "bindgen ($(bindgen --version 2>&1 | cut -d ' ' -f 2))" +DocumentInstalledItem "cbindgen ($(cbindgen --version 2>&1 | cut -d ' ' -f 2))" diff --git a/images/linux/scripts/installers/sbt.sh b/images/linux/scripts/installers/sbt.sh new file mode 100644 index 000000000..148dfe000 --- /dev/null +++ b/images/linux/scripts/installers/sbt.sh @@ -0,0 +1,20 @@ +#!/bin/bash +################################################################################ +## File: scala.sh +## Team: CI-Platform +## Desc: Installs sbt +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install sbt +# https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html +echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list +curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add +apt-get -q update +apt-get -y install sbt + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "sbt ($(sbt --script-version))" diff --git a/images/linux/scripts/installers/sphinx.sh b/images/linux/scripts/installers/sphinx.sh new file mode 100644 index 000000000..707a7cae3 --- /dev/null +++ b/images/linux/scripts/installers/sphinx.sh @@ -0,0 +1,15 @@ +#!/bin/bash +################################################################################ +## File: sphinx.sh +## Desc: Installs Sphinx +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Sphinx +apt-get install -y sphinxsearch + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Sphinx Open Source Search Server" diff --git a/images/linux/scripts/installers/subversion.sh b/images/linux/scripts/installers/subversion.sh new file mode 100644 index 000000000..165567169 --- /dev/null +++ b/images/linux/scripts/installers/subversion.sh @@ -0,0 +1,22 @@ +#!/bin/bash +################################################################################ +## File: subversion.sh +## Desc: Installs Subversion client +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install Subversion +apt-get install -y --no-install-recommends subversion + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v svn; then + echo "Subversion (svn) was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Subversion ($(svn --version | head -n 1))" diff --git a/images/linux/scripts/installers/terraform.sh b/images/linux/scripts/installers/terraform.sh new file mode 100644 index 000000000..6c7ce09d0 --- /dev/null +++ b/images/linux/scripts/installers/terraform.sh @@ -0,0 +1,26 @@ +#!/bin/bash +################################################################################ +## File: terraform.sh +## Desc: Installs terraform +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh +source $HELPER_SCRIPTS/apt.sh + +# Install Terraform +TERRAFORM_VERSION=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r .current_version) +curl -LO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" +unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -d /usr/local/bin +rm -f "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v terraform; then + echo "Terraform was not installed or found on PATH" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Terraform ($(terraform --version))" diff --git a/images/linux/scripts/installers/test-toolcache.sh b/images/linux/scripts/installers/test-toolcache.sh new file mode 100644 index 000000000..d8aa44247 --- /dev/null +++ b/images/linux/scripts/installers/test-toolcache.sh @@ -0,0 +1,70 @@ +#!/bin/bash +################################################################################ +## File: test-toolcache.sh +## Desc: Test Python and Ruby versions in tools cache +################################################################################ + +# Must be procecessed after tool cache setup(hosted-tool-cache.sh). + +# Fail out if any tests fail +set -e + +AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache + +# Python test +if [ -d "$AGENT_TOOLSDIRECTORY/Python" ]; then + cd $AGENT_TOOLSDIRECTORY/Python + python_dirs=($(find . -mindepth 1 -maxdepth 1 -type d | sed "s|^\./||")) + echo "Python versions folders: ${python_dirs[@]}" + echo "------------------------------------------" + if [ -n "$python_dirs" ]; then + for version_dir in "${python_dirs[@]}" + do + echo "Test $AGENT_TOOLSDIRECTORY/Python/$version_dir:" + expected_ver=$(echo $version_dir | egrep -o '[0-9]+\.[0-9]+') + actual_ver=$($AGENT_TOOLSDIRECTORY/Python/$version_dir/x64/python -c 'import sys;print(sys.version)'| head -1 | egrep -o '[0-9]+\.[0-9]+') + + if [ "$expected_ver" = "$actual_ver" ]; then + echo "Passed!" + else + echo "Expected: $expected_ver; Actual: $actual_ver" + exit 1 + fi + done + else + echo "$AGENT_TOOLSDIRECTORY/Python does not include any folders" + exit 1 + fi +else + echo "$AGENT_TOOLSDIRECTORY/Python does not exist" + exit 1 +fi + +# Ruby test +if [ -d "$AGENT_TOOLSDIRECTORY/Ruby" ]; then + cd $AGENT_TOOLSDIRECTORY/Ruby + ruby_dirs=($(find . -mindepth 1 -maxdepth 1 -type d | sed "s|^\./||")) + echo "Ruby versions folders: ${ruby_dirs[@]}" + echo "--------------------------------------" + if [ -n "$ruby_dirs" ]; then + for version_dir in "${ruby_dirs[@]}" + do + echo "Test $AGENT_TOOLSDIRECTORY/Ruby/$version_dir:" + expected_ver=$(echo $version_dir | egrep -o '[0-9]+\.[0-9]+') + actual_ver=$($AGENT_TOOLSDIRECTORY/Ruby/$version_dir/x64/bin/ruby -e "puts RUBY_VERSION" | egrep -o '[0-9]+\.[0-9]+') + + if [ "$expected_ver" = "$actual_ver" ]; then + echo "Passed!" + else + echo "Expected: $expected_ver; Actual: $actual_ver" + exit 1 + fi + done + else + echo "$AGENT_TOOLSDIRECTORY/Ruby does not include any folders" + exit 1 + fi +else + echo "$AGENT_TOOLSDIRECTORY/Ruby does not exist" + exit 1 +fi diff --git a/images/linux/scripts/installers/vcpkg.sh b/images/linux/scripts/installers/vcpkg.sh new file mode 100644 index 000000000..ec42ec5a9 --- /dev/null +++ b/images/linux/scripts/installers/vcpkg.sh @@ -0,0 +1,30 @@ +#!/bin/bash +################################################################################ +## File: vcpkg.sh +## Desc: Installs vcpkg +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Set env variable for vcpkg +VCPKG_INSTALLATION_ROOT=/usr/local/share/vcpkg +echo "VCPKG_INSTALLATION_ROOT=${VCPKG_INSTALLATION_ROOT}" | tee -a /etc/environment + +# Install vcpkg +git clone --depth=1 https://github.com/Microsoft/vcpkg $VCPKG_INSTALLATION_ROOT +$VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh +$VCPKG_INSTALLATION_ROOT/vcpkg integrate install +chmod 0777 -R $VCPKG_INSTALLATION_ROOT +ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin + +# Run tests to determine that the software installed as expected +echo "Testing to make sure that script performed as expected, and basic scenarios work" +if ! command -v vcpkg; then + echo "vcpkg was not installed" + exit 1 +fi + +# Document what was added to the image +echo "Lastly, documenting what we added to the metadata file" +DocumentInstalledItem "Vcpkg $(vcpkg version | head -n 1 | cut -d ' ' -f 6)" diff --git a/images/linux/scripts/installers/zeit-now.sh b/images/linux/scripts/installers/zeit-now.sh new file mode 100644 index 000000000..eb53f08bb --- /dev/null +++ b/images/linux/scripts/installers/zeit-now.sh @@ -0,0 +1,22 @@ +#!/bin/bash +################################################################################ +## File: zeit-now.sh +## Desc: Installs the Zeit Now CLI +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +# Install the Zeit Now CLI +npm i -g now + +# Validate the installation +echo "Validate the installation" +if ! command -v now; then + echo "Zeit Now CLI was not installed" + exit 1 +fi + +# Document the installed version +echo "Document the installed version" +DocumentInstalledItem "Zeit Now CLI ($(now --version))" diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json new file mode 100644 index 000000000..21bf64f1e --- /dev/null +++ b/images/linux/ubuntu1604.json @@ -0,0 +1,236 @@ +{ + "variables": { + "commit_id": "{{env `COMMIT_ID`}}", + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}", + "tenant_id": "{{env `ARM_TENANT_ID`}}", + "resource_group": "{{env `ARM_RESOURCE_GROUP`}}", + "storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}", + "temp_resource_group_name": "{{env `TEMP_RESOURCE_GROUP_NAME`}}", + "location": "{{env `ARM_RESOURCE_LOCATION`}}", + "virtual_network_name": "{{env `VNET_NAME`}}", + "virtual_network_resource_group_name": "{{env `VNET_RESOURCE_GROUP`}}", + "virtual_network_subnet_name": "{{env `VNET_SUBNET`}}", + "private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}", + "image_folder": "/imagegeneration", + "commit_file": "/imagegeneration/commit.txt", + "metadata_file": "/imagegeneration/metadatafile", + "installer_script_folder": "/imagegeneration/installers", + "helper_script_folder": "/imagegeneration/helpers", + "vm_size": "Standard_DS2_v2", + "capture_name_prefix": "packer", + "image_version": "dev" + }, + "builders": [ + { + "type": "azure-arm", + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "subscription_id": "{{user `subscription_id`}}", + "tenant_id": "{{user `tenant_id`}}", + + "location": "{{user `location`}}", + "vm_size": "{{user `vm_size`}}", + "resource_group_name": "{{user `resource_group`}}", + "storage_account": "{{user `storage_account`}}", + "temp_resource_group_name": "{{user `temp_resource_group_name`}}", + "capture_container_name": "images", + "capture_name_prefix": "{{user `capture_name_prefix`}}", + "virtual_network_name": "{{user `virtual_network_name`}}", + "virtual_network_resource_group_name": "{{user `virtual_network_resource_group_name`}}", + "virtual_network_subnet_name": "{{user `virtual_network_subnet_name`}}", + "private_virtual_network_with_public_ip": "{{user `private_virtual_network_with_public_ip`}}", + "os_type": "Linux", + "image_publisher": "Canonical", + "image_offer": "UbuntuServer", + "image_sku": "16.04-LTS", + "os_disk_size_gb": "86" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": [ + "mkdir {{user `image_folder`}}", + "chmod 777 {{user `image_folder`}}", + "echo {{user `commit_id`}} > {{user `commit_file`}}", + "chmod +r {{user `commit_file`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/base/repos.sh" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "apt-get update", + "apt-get dist-upgrade -y", + "systemctl disable apt-daily.service", + "systemctl disable apt-daily.timer", + "systemctl disable apt-daily-upgrade.timer", + "systemctl disable apt-daily-upgrade.service", + "echo '* soft nofile 50000 \n* hard nofile 50000' >> /etc/security/limits.conf", + "echo 'session required pam_limits.so' >> /etc/pam.d/common-session", + "echo 'session required pam_limits.so' >> /etc/pam.d/common-session-noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{template_dir}}/scripts/helpers", + "destination": "{{user `helper_script_folder`}}" + }, + { + "type": "file", + "source": "{{template_dir}}/scripts/installers", + "destination": "{{user `installer_script_folder`}}" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/1604/preparemetadata.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "echo ImageVersion={{user `image_version`}} | tee -a /etc/environment" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/7-zip.sh", + "{{template_dir}}/scripts/installers/ansible.sh", + "{{template_dir}}/scripts/installers/azcopy.sh", + "{{template_dir}}/scripts/installers/azure-cli.sh", + "{{template_dir}}/scripts/installers/azure-devops-cli.sh", + "{{template_dir}}/scripts/installers/1604/basic.sh", + "{{template_dir}}/scripts/installers/aws.sh", + "{{template_dir}}/scripts/installers/build-essential.sh", + "{{template_dir}}/scripts/installers/clang.sh", + "{{template_dir}}/scripts/installers/cmake.sh", + "{{template_dir}}/scripts/installers/docker-compose.sh", + "{{template_dir}}/scripts/installers/docker-moby.sh", + "{{template_dir}}/scripts/installers/docker.sh", + "{{template_dir}}/scripts/installers/1604/dotnetcore-sdk.sh", + "{{template_dir}}/scripts/installers/erlang.sh", + "{{template_dir}}/scripts/installers/firefox.sh", + "{{template_dir}}/scripts/installers/gcc.sh", + "{{template_dir}}/scripts/installers/git.sh", + "{{template_dir}}/scripts/installers/1604/go.sh", + "{{template_dir}}/scripts/installers/google-chrome.sh", + "{{template_dir}}/scripts/installers/google-cloud-sdk.sh", + "{{template_dir}}/scripts/installers/haskell.sh", + "{{template_dir}}/scripts/installers/heroku.sh", + "{{template_dir}}/scripts/installers/hhvm.sh", + "{{template_dir}}/scripts/installers/image-magick.sh", + "{{template_dir}}/scripts/installers/java-tools.sh", + "{{template_dir}}/scripts/installers/kind.sh", + "{{template_dir}}/scripts/installers/1604/kubernetes-tools.sh", + "{{template_dir}}/scripts/installers/leiningen.sh", + "{{template_dir}}/scripts/installers/1604/mercurial.sh", + "{{template_dir}}/scripts/installers/miniconda.sh", + "{{template_dir}}/scripts/installers/mono.sh", + "{{template_dir}}/scripts/installers/mysql.sh", + "{{template_dir}}/scripts/installers/nodejs.sh", + "{{template_dir}}/scripts/installers/phantomjs.sh", + "{{template_dir}}/scripts/installers/1604/php.sh", + "{{template_dir}}/scripts/installers/pollinate.sh", + "{{template_dir}}/scripts/installers/1604/powershellcore.sh", + "{{template_dir}}/scripts/installers/ruby.sh", + "{{template_dir}}/scripts/installers/rust.sh", + "{{template_dir}}/scripts/installers/sbt.sh", + "{{template_dir}}/scripts/installers/sphinx.sh", + "{{template_dir}}/scripts/installers/subversion.sh", + "{{template_dir}}/scripts/installers/terraform.sh", + "{{template_dir}}/scripts/installers/vcpkg.sh", + "{{template_dir}}/scripts/installers/zeit-now.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/1604/android.sh", + "{{template_dir}}/scripts/installers/1604/azpowershell.sh", + "{{template_dir}}/scripts/helpers/containercache.sh", + "{{template_dir}}/scripts/installers/1604/hosted-tool-cache.sh", + "{{template_dir}}/scripts/installers/python.sh", + "{{template_dir}}/scripts/installers/test-toolcache.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/boost.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "BOOST_VERSIONS=1.69.0", + "BOOST_DEFAULT=1.69.0" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{user `metadata_file`}}", + "destination": "{{template_dir}}/Ubuntu1604-README.md", + "direction": "download" + }, + { + "type": "shell", + "inline": [ + "rm -rf {{user `helper_script_folder`}}", + "rm -rf {{user `installer_script_folder`}}", + "chmod 755 {{user `image_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{template_dir}}/config/ubuntu1604.conf", + "destination": "/tmp/" + }, + { + "type": "shell", + "inline": [ + "mkdir -p /etc/vsts", + "cp /tmp/ubuntu1604.conf /etc/vsts/machine_instance.conf" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "sleep 30", + "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + } + ] +} diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json new file mode 100644 index 000000000..873d7c4a4 --- /dev/null +++ b/images/linux/ubuntu1804.json @@ -0,0 +1,239 @@ +{ + "variables": { + "commit_id": "{{env `COMMIT_ID`}}", + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}", + "tenant_id": "{{env `ARM_TENANT_ID`}}", + "resource_group": "{{env `ARM_RESOURCE_GROUP`}}", + "storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}", + "temp_resource_group_name": "{{env `TEMP_RESOURCE_GROUP_NAME`}}", + "location": "{{env `ARM_RESOURCE_LOCATION`}}", + "virtual_network_name": "{{env `VNET_NAME`}}", + "virtual_network_resource_group_name": "{{env `VNET_RESOURCE_GROUP`}}", + "virtual_network_subnet_name": "{{env `VNET_SUBNET`}}", + "private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}", + "image_folder": "/imagegeneration", + "commit_file": "/imagegeneration/commit.txt", + "metadata_file": "/imagegeneration/metadatafile", + "installer_script_folder": "/imagegeneration/installers", + "helper_script_folder": "/imagegeneration/helpers", + "vm_size": "Standard_DS2_v2", + "capture_name_prefix": "packer", + "image_version": "dev" + }, + "builders": [ + { + "type": "azure-arm", + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "subscription_id": "{{user `subscription_id`}}", + "tenant_id": "{{user `tenant_id`}}", + + "location": "{{user `location`}}", + "vm_size": "{{user `vm_size`}}", + "resource_group_name": "{{user `resource_group`}}", + "storage_account": "{{user `storage_account`}}", + "temp_resource_group_name": "{{user `temp_resource_group_name`}}", + "capture_container_name": "images", + "capture_name_prefix": "{{user `capture_name_prefix`}}", + "virtual_network_name": "{{user `virtual_network_name`}}", + "virtual_network_resource_group_name": "{{user `virtual_network_resource_group_name`}}", + "virtual_network_subnet_name": "{{user `virtual_network_subnet_name`}}", + "private_virtual_network_with_public_ip": "{{user `private_virtual_network_with_public_ip`}}", + "os_type": "Linux", + "image_publisher": "Canonical", + "image_offer": "UbuntuServer", + "image_sku": "18.04-LTS", + "os_disk_size_gb": "86" + } + ], + "provisioners": [ + { + "type": "shell", + "inline": [ + "mkdir {{user `image_folder`}}", + "chmod 777 {{user `image_folder`}}", + "echo {{user `commit_id`}} > {{user `commit_file`}}", + "chmod +r {{user `commit_file`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/base/repos.sh" + ], + "environment_vars": [ + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "apt-get update", + "apt-get dist-upgrade -y", + "systemctl disable apt-daily.service", + "systemctl disable apt-daily.timer", + "systemctl disable apt-daily-upgrade.timer", + "systemctl disable apt-daily-upgrade.service", + "echo '* soft nofile 50000 \n* hard nofile 50000' >> /etc/security/limits.conf", + "echo 'session required pam_limits.so' >> /etc/pam.d/common-session", + "echo 'session required pam_limits.so' >> /etc/pam.d/common-session-noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{template_dir}}/scripts/helpers", + "destination": "{{user `helper_script_folder`}}" + }, + { + "type": "file", + "source": "{{template_dir}}/scripts/installers", + "destination": "{{user `installer_script_folder`}}" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/1804/preparemetadata.sh" + ], + "environment_vars": [ + "IMAGE_VERSION={{user `image_version`}}", + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "echo ImageVersion={{user `image_version`}} | tee -a /etc/environment" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts": [ + "{{template_dir}}/scripts/installers/7-zip.sh", + "{{template_dir}}/scripts/installers/ansible.sh", + "{{template_dir}}/scripts/installers/azcopy.sh", + "{{template_dir}}/scripts/installers/azure-cli.sh", + "{{template_dir}}/scripts/installers/azure-devops-cli.sh", + "{{template_dir}}/scripts/installers/1804/basic.sh", + "{{template_dir}}/scripts/installers/aws.sh", + "{{template_dir}}/scripts/installers/build-essential.sh", + "{{template_dir}}/scripts/installers/clang.sh", + "{{template_dir}}/scripts/installers/cmake.sh", + "{{template_dir}}/scripts/installers/docker-compose.sh", + "{{template_dir}}/scripts/installers/docker-moby.sh", + "{{template_dir}}/scripts/installers/docker.sh", + "{{template_dir}}/scripts/installers/1804/dotnetcore-sdk.sh", + "{{template_dir}}/scripts/installers/erlang.sh", + "{{template_dir}}/scripts/installers/firefox.sh", + "{{template_dir}}/scripts/installers/gcc.sh", + "{{template_dir}}/scripts/installers/git.sh", + "{{template_dir}}/scripts/installers/1804/go.sh", + "{{template_dir}}/scripts/installers/google-chrome.sh", + "{{template_dir}}/scripts/installers/google-cloud-sdk.sh", + "{{template_dir}}/scripts/installers/haskell.sh", + "{{template_dir}}/scripts/installers/heroku.sh", + "{{template_dir}}/scripts/installers/hhvm.sh", + "{{template_dir}}/scripts/installers/image-magick.sh", + "{{template_dir}}/scripts/installers/java-tools.sh", + "{{template_dir}}/scripts/installers/kind.sh", + "{{template_dir}}/scripts/installers/1804/kubernetes-tools.sh", + "{{template_dir}}/scripts/installers/leiningen.sh", + "{{template_dir}}/scripts/installers/1804/mercurial.sh", + "{{template_dir}}/scripts/installers/miniconda.sh", + "{{template_dir}}/scripts/installers/mono.sh", + "{{template_dir}}/scripts/installers/mysql.sh", + "{{template_dir}}/scripts/installers/nodejs.sh", + "{{template_dir}}/scripts/installers/phantomjs.sh", + "{{template_dir}}/scripts/installers/1804/php.sh", + "{{template_dir}}/scripts/installers/pollinate.sh", + "{{template_dir}}/scripts/installers/1804/powershellcore.sh", + "{{template_dir}}/scripts/installers/ruby.sh", + "{{template_dir}}/scripts/installers/rust.sh", + "{{template_dir}}/scripts/installers/sbt.sh", + "{{template_dir}}/scripts/installers/sphinx.sh", + "{{template_dir}}/scripts/installers/subversion.sh", + "{{template_dir}}/scripts/installers/terraform.sh", + "{{template_dir}}/scripts/installers/vcpkg.sh", + "{{template_dir}}/scripts/installers/zeit-now.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "DEBIAN_FRONTEND=noninteractive" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/1804/android.sh", + "{{template_dir}}/scripts/installers/1804/azpowershell.sh", + "{{template_dir}}/scripts/helpers/containercache.sh", + "{{template_dir}}/scripts/installers/1804/hosted-tool-cache.sh", + "{{template_dir}}/scripts/installers/python.sh", + "{{template_dir}}/scripts/installers/test-toolcache.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "scripts":[ + "{{template_dir}}/scripts/installers/boost.sh" + ], + "environment_vars": [ + "METADATA_FILE={{user `metadata_file`}}", + "HELPER_SCRIPTS={{user `helper_script_folder`}}", + "BOOST_VERSIONS=1.69.0", + "BOOST_DEFAULT=1.69.0" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{user `metadata_file`}}", + "destination": "{{template_dir}}/Ubuntu1804-README.md", + "direction": "download" + }, + { + "type": "shell", + "inline": [ + "rm -rf {{user `helper_script_folder`}}", + "rm -rf {{user `installer_script_folder`}}", + "chmod 755 {{user `image_folder`}}" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "file", + "source": "{{template_dir}}/config/ubuntu1804.conf", + "destination": "/tmp/" + }, + { + "type": "shell", + "inline": [ + "mkdir -p /etc/vsts", + "cp /tmp/ubuntu1804.conf /etc/vsts/machine_instance.conf" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + }, + { + "type": "shell", + "inline": [ + "sleep 30", + "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync" + ], + "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" + } + ] +} diff --git a/images/macos/macos-10.13-Readme.md b/images/macos/macos-10.13-Readme.md new file mode 100644 index 000000000..b21f01337 --- /dev/null +++ b/images/macos/macos-10.13-Readme.md @@ -0,0 +1,395 @@ +# Azure Pipelines hosted macOS image + +The following software is installed on machines in the Azure Pipelines **macOS-10.13** VM image ('Hosted macOS High Sierra' pool). + +#### Xcode 10.1 set by default + +## Operating System + +- OS X 10.13.6 (17G8037) **High Sierra** + +## Installed Software + +### Language and Runtime + +- Java 1.7: OpenJDK Runtime Environment (Zulu 7.34.0.5-CA-macosx) (build 1.7.0_242-b7) +- Java 1.8: OpenJDK Runtime Environment (Zulu 8.42.0.21-CA-macosx) (build 1.8.0_232-b18) (default) +- Java 11: OpenJDK Runtime Environment Zulu11.35+13-CA (build 11.0.5+10-LTS) +- Java 12: OpenJDK Runtime Environment Zulu12.3+11-CA (build 12.0.2+3) +- Java 13: OpenJDK Runtime Environment Zulu13.28+11-CA (build 13.0.1+10-MTS) +- Node.js 6.17.0 +- NVM 0.33.11 +- NVM - Installed node versions: + v6.17.1 + v8.16.2 + v10.17.0 + v12.13.0 +- PowerShell 6.2.3 +- Python 2.7.17 +- Python 3.7.4 +- Ruby 2.6.5p114 +- .NET Core SDK 1.0.1, 1.0.4, 1.1.4, 1.1.5, 1.1.7, 1.1.8, 1.1.9, 1.1.10, 1.1.11, 1.1.12, 1.1.13, 2.0.0, 2.0.3, 2.1.100, 2.1.101, 2.1.102, 2.1.103, 2.1.104, 2.1.105, 2.1.503, 2.1.504, 2.1.505, 2.1.2, 2.1.200, 2.1.201, 2.1.300, 2.1.301, 2.1.4, 2.1.400, 2.1.401 2.1.402 2.1.502, 2.1.504, 2.2.101, 2.2.102, 2.2.103, 2.2.104, 2.2.105 +- Go 1.13.3 + +### Package Management + +- Bundler 2.0.2 +- Carthage 0.34.0 +- CocoaPods 1.8.4 +- Homebrew 2.1.15 +- NPM 3.10.10 +- Yarn 1.19.1 +- NuGet 4.7.0.5148 +- pip 19.3.1(python 2.7) +- pip 19.2.3(python 3.7) +- Miniconda 4.7.12 + +### Project Management + +- Apache Maven 3.6.2 +- Gradle 5.6.3 + +### Utilities + +- curl 7.66.0 (x86_64-apple-darwin17.7.0) libcurl/7.66.0 SecureTransport zlib/1.2.11 +- Git 2.23.0 +- Git LFS 2.8.0 +- GNU Wget 1.20.3 +- Subversion (SVN) 1.12.2 +- GNU parallel 20190822 + +### Tools + +- fastlane 2.134.0 +- App Center CLI 1.2.2 +- Azure-CLI 2.0.75 + +### Pre-cached tools +- Python (available through the [setup-python](https://github.com/actions/setup-python/blob/master/README.md) task) + - 2.7.16 + - 3.4.10 + - 3.5.7 + - 3.6.9 + - 3.7.5 + - 3.8.0 + - pypy2 + - pypy3 +- Ruby (available through the [setup-ruby](https://github.com/actions/setup-ruby/blob/master/README.md) task) + - 2.3.8 + - 2.4.6 + - 2.5.5 + - 2.6.3 + +### Xcode +| Version | Build | Path | +|------------------------|---------|-------------------------------| +| 10.1 | 10B61 | /Applications/Xcode_10.1.app | +| 10.0 | 10A255 | /Applications/Xcode_10.app | +| 9.4.1 | 9F2000 | /Applications/Xcode_9.4.1.app | +| 9.4 | 9F1027a | /Applications/Xcode_9.4.app | +| 9.3.1 | 9E501 | /Applications/Xcode_9.3.1.app | +| 9.3 | 9E145 | /Applications/Xcode_9.3.app | +| 9.2 | 9C40b | /Applications/Xcode_9.2.app | +| 9.1 | 9B55 | /Applications/Xcode_9.1.app | +| 9.0.1 | 9A1004 | /Applications/Xcode_9.0.1.app | +| 9.0 | 9A235 | /Applications/Xcode_9.app | +| 8.3.3 | 8E3004b | /Applications/Xcode_8.3.3.app | + +### Xcode Support Tools + +- Nomad CLI 3.0.6 +- Nomad CLI IPA 0.14.3 +- xcpretty 0.3.0 +- xctool 0.3.5 +- xcversion 2.6.1 + +### Installed SDKs +| SDK | SDK name | Xcode Version | +|---------------------------|-------------|---------------| +| macOS 10.12 | macosx10.12 | 8.3.3 | +| macOS 10.13 | macosx10.13 | 9.0, 9.0.1, 9.1, 9.2, 9.3, 9.3.1, 9.4, 9.4.1 | +| macOS 10.14 | macosx10.14 | 10, 10.1 | +| iOS 10.3 | iphoneos10.3 | 8.3.3 | +| iOS 11.0 | iphoneos11.0 | 9.0, 9.0.1 | +| iOS 11.1 | iphoneos11.1 | 9.1 | +| iOS 11.2 | iphoneos11.2 | 9.2 | +| iOS 11.3 | iphoneos11.3 | 9.3, 9.3.1 | +| iOS 11.4 | iphoneos11.4 | 9.4, 9.4.1 | +| iOS 12.0 | iphoneos12.0 | 10 | +| iOS 12.1 | iphoneos12.1 | 10.1 | +| iOS Simulator 10.3 | iphonesimulator10.3 | 8.3.3 | +| iOS Simulator 11.0 | iphonesimulator11.0 | 9.0, 9.0.1 | +| iOS Simulator 11.1 | iphonesimulator11.1 | 9.1 | +| iOS Simulator 11.2 | iphonesimulator11.2 | 9.2 | +| iOS Simulator 11.3 | iphonesimulator11.3 | 9.3, 9.3.1 | +| iOS Simulator 11.4 | iphonesimulator11.4 | 9.4, 9.4.1 | +| iOS Simulator 12.0 | iphonesimulator12.0 | 10 | +| iOS Simulator 12.1 | iphonesimulator12.1 | 10.1 | +| tvOS 10.2 | appletvos10.2 | 8.3.3 | +| tvOS 11.0 | appletvos11.0 | 9.0, 9.0.1 | +| tvOS 11.1 | appletvos11.1 | 9.1 | +| tvOS 11.2 | appletvos11.2 | 9.2 | +| tvOS 11.3 | appletvos11.3 | 9.3, 9.3.1 | +| tvOS 11.4 | appletvos11.4 | 9.4, 9.4.1 | +| tvOS 12.0 | appletvos12.0 | 10 | +| tvOS 12.1 | appletvos12.1 | 10.1 | +| tvOS Simulator 10.2 | appletvsimulator10.2 | 8.3.3 | +| tvOS Simulator 11.0 | appletvsimulator11.0 | 9.0, 9.0.1 | +| tvOS Simulator 11.1 | appletvsimulator11.1 | 9.1 | +| tvOS Simulator 11.2 | appletvsimulator11.2 | 9.2 | +| tvOS Simulator 11.3 | appletvsimulator11.3 | 9.3, 9.3.1 | +| tvOS Simulator 11.4 | appletvsimulator11.4 | 9.4, 9.4.1 | +| tvOS Simulator 12.0 | appletvsimulator12.0 | 10 | +| tvOS Simulator 12.1 | appletvsimulator12.1 | 10.1 | +| watchOS 3.2 | watchos3.2 | 8.3.3 | +| watchOS 4.0 | watchos4.0 | 9.0, 9.0.1 | +| watchOS 4.1 | watchos4.1 | 9.1 | +| watchOS 4.2 | watchos4.2 | 9.2 | +| watchOS 4.3 | watchos4.3 | 9.3, 9.3.1, 9.4, 9.4.1 | +| watchOS 5.0 | watchos5.0 | 10.0 | +| watchOS 5.1 | watchos5.1 | 10.1 | +| watchOS Simulator 3.2 | watchsimulator3.2 | 8.3.3 | +| watchOS Simulator 4.0 | watchsimulator4.0 | 9.0, 9.0.1 | +| watchOS Simulator 4.1 | watchsimulator4.1 | 9.1 | +| watchOS Simulator 4.2 | watchsimulator4.2 | 9.2 | +| watchOS Simulator 4.3 | watchsimulator4.3 | 9.3, 9.3.1, 9.4, 9.4.1 | +| watchOS Simulator 5.0 | watchsimulator5.0 | 10.0 | +| watchOS Simulator 5.1 | watchsimulator5.1 | 10.1 | + +### Installed Simulators + +#### Runtimes + +| OS | Xcode Version | Simulators | +|---------|---------------------------------|------------| +| iOS 8.4 (12H141) | 8.3.3, 9.0, 9.0.1, 9.1, 9.2, 9.3, 9.3.1, 9.4, 9.4.1, 10.0, 10.1 | iPhone 4s
iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPad 2
iPad Retina
iPad Air | +| iOS 9.0 (13A344) | 8.3.3, 9.0, 9.0.1, 9.1, 9.2, 9.3, 9.3.1, 9.4, 9.4.1, 10.0, 10.1 | iPhone 4s
iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPad 2
iPad Retina
iPad Air
iPad Air 2 | +| iOS 9.1 (13B143)
iOS 9.2 (13C75)
iOS 9.3 (13E233) | 8.3.3, 9.0, 9.0.1, 9.1, 9.2, 9.3, 9.3.1, 9.4, 9.4.1, 10.0, 10.1 | iPhone 4s
iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPad 2
iPad Retina
iPad Air
iPad Air 2
iPad Pro | +| iOS 10.0 (14A345) | 8.3.3, 9.0, 9.0.1, 9.1, 9.2, 9.3, 9.3.1, 9.4, 9.4.1, 10.0, 10.1 | iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone SE
iPad Air
iPad Air 2
iPad Pro (9.7 inch)
iPad Pro (12.9 inch) | +| iOS 10.1 (14B72)
iOS 10.2 (14C89) | 8.3.3, 9.0, 9.0.1, 9.1, 9.2, 9.3, 9.3.1, 9.4, 9.4.1, 10.0, 10.1 | iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone SE
iPad Air
iPad Air 2
iPad Pro (9.7 inch)
iPad Pro (12.9 inch) | +| iOS 10.3 (14E8301) | 8.3.3 | iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone SE
iPad Air
iPad Air 2
iPad Pro (9.7 inch)
iPad Pro (12.9 inch)
iPad (5th generation)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch) | +| iOS 11.0 (15A372) | 9.0 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone 8
iPhone 8 Plus
iPhone SE
iPhone X
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch) | +| iOS 11.0 (15A8401) | 9.0.1 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone 8
iPhone 8 Plus
iPhone SE
iPhone X
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch) | +| iOS 11.1 (15B87) | 9.1 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone 8
iPhone 8 Plus
iPhone SE
iPhone X
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch) | +| iOS 11.2 (15C107) | 9.2 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone 8
iPhone 8 Plus
iPhone SE
iPhone X
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch) | +| iOS 11.3 (15E217) | 9.3, 9.3.1 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone 8
iPhone 8 Plus
iPhone SE
iPhone X
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch) | +| iOS 11.4 (15F79) | 9.4, 9.4.1 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone 8
iPhone 8 Plus
iPhone SE
iPhone X
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch) | +| iOS 12.0 (16A366) | 10.0 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone SE
iPhone 8
iPhone 8 Plus
iPhone X
iPhone XR
iPhone XS
iPhone XS Max
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (10.5-inch)
iPad Pro (11-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad (6th generation) | +| iOS 12.1 (16B91) | 10.1 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone SE
iPhone 8
iPhone 8 Plus
iPhone X
iPhone X
iPhone XS
iPhone XS Max
iPhone XR
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch)
iPad (6th generation)
iPad Pro (11-inch)
iPad Pro (12.9-inch) (3rd generation) | +| tvOS 10.2 (14W260) | 8.3.3 | Apple TV 1080p | +| tvOS 11.0 (15J380) | 9.0, 9.0.1 | Apple TV
Apple TV 4K
Apple TV 4K (at 1080p) | +| tvOS 11.1 (15J580) | 9.1 | Apple TV
Apple TV 4K
Apple TV 4K (at 1080p) | +| tvOS 11.2 (15K104) | 9.2 | Apple TV
Apple TV 4K
Apple TV 4K (at 1080p) | +| tvOS 11.3 (15L211) | 9.3, 9.3.1 | Apple TV
Apple TV 4K
Apple TV 4K (at 1080p) | +| tvOS 11.4 (15L576) | 9.4, 9.4.1 | Apple TV
Apple TV 4K
Apple TV 4K (at 1080p) | +| tvOS 12.0 (16J364) | 10.0 | Apple TV
Apple TV 4K
Apple TV 4K (at 1080p) | +| tvOS 12.1 (16J602) | 10.1 | Apple TV
Apple TV 4K
Apple TV 4K (at 1080p) | +| watchOS 3.2 (14V243) | 8.3.3 | Apple Watch - 38mm
Apple Watch - 42mm
Apple Watch Series 2 - 38mm
Apple Watch Series 2 - 42mm | +| watchOS 4.0 (15R372) | 9.0, 9.0.1 | Apple Watch - 38mm
Apple Watch - 42mm
Apple Watch Series 2 - 38mm
Apple Watch Series 2 - 42mm
Apple Watch Series 3 - 38mm
Apple Watch Series 3 - 42mm | +| watchOS 4.1 (15R844) | 9.1 | Apple Watch - 38mm
Apple Watch - 42mm
Apple Watch Series 2 - 38mm
Apple Watch Series 2 - 42mm
Apple Watch Series 3 - 38mm
Apple Watch Series 3 - 42mm | +| watchOS 4.2 (15S100) | 9.2 | Apple Watch - 38mm
Apple Watch - 42mm
Apple Watch Series 2 - 38mm
Apple Watch Series 2 - 42mm
Apple Watch Series 3 - 38mm
Apple Watch Series 3 - 42mm | +| watchOS 4.3 (15T212) | 9.3, 9.3.1, 9.4, 9.4.1 | Apple Watch - 38mm
Apple Watch - 42mm
Apple Watch Series 2 - 38mm
Apple Watch Series 2 - 42mm
Apple Watch Series 3 - 38mm
Apple Watch Series 3 - 42mm | +| watchOS 5.0 (16R363) | 10.0 | Apple Watch Series 2 - 38mm
Apple Watch Series 2 - 42mm
Apple Watch Series 3 - 38mm
Apple Watch Series 3 - 42mm
Apple Watch Series 4 - 40mm
Apple Watch Series 4 - 44mm | +| watchOS 5.1 (16R591) | 10.1 | Apple Watch Series 2 - 38mm
Apple Watch Series 2 - 42mm
Apple Watch Series 3 - 38mm
Apple Watch Series 3 - 42mm
Apple Watch Series 4 - 40mm
Apple Watch Series 4 - 44mm | + +#### How to install additional simulators? +Image contains only default simulators for each Xcode version. To install a specific simulator for all Xcode version, use xcversion tool: +``` +xcversion simulators --install='iOS 8.4' +``` +**!** - The installation of some simulators may cause compatibility issues. + +### Device Pairs + +| Watch | Phone | +|-----------------------------|----------------| +| Apple Watch - 38mm | iPhone 6s | +| Apple Watch - 42mm | iPhone 6s Plus | +| Apple Watch Series 2 - 38mm | iPhone 7 | +| Apple Watch Series 2 - 42mm | iPhone 7 Plus | +| Apple Watch Series 3 - 38mm | iPhone 8 | +| Apple Watch Series 3 - 42mm | iPhone 8 Plus | +| Apple Watch Series 4 - 40mm | iPhone XS | +| Apple Watch Series 4 - 44mm | iPhone XS Max | + +## Android + +### Android SDK Tools + +| Package name | Description | +|-----------------------|---------------------------------------------| +| tools | Android SDK Tools, revision 26.1.1 | + +### Android SDK Platform-tools + +| Package name | Description | +|-----------------------|---------------------------------------------| +| platform-tools | Android SDK Platform-tools, revision 29.0.4 | + +### Android SDK Platforms + +| Package name | Description | +|-----------------------|-------------------------------------------| +| android-15 | Android SDK Platform 15, Revision 5 | +| android-16 | Android SDK Platform 16, Revision 5 | +| android-17 | Android SDK Platform 17, Revision 3 | +| android-18 | Android SDK Platform 18, Revision 3 | +| android-19 | Android SDK Platform 19, Revision 4 | +| android-20 | Android SDK Platform 20, Revision 2 | +| android-21 | Android SDK Platform 21, Revision 2 | +| android-22 | Android SDK Platform 22, Revision 2 | +| android-23 | Android SDK Platform 23, Revision 3 | +| android-24 | Android SDK Platform 24, Revision 2 | +| android-25 | Android SDK Platform 25, Revision 3 | +| android-26 | Android SDK Platform 26, Revision 2 | +| android-27 | Android SDK Platform 27, Revision 3 | +| android-28 | Android SDK Platform 28, Revision 6 | +| android-29 | Android SDK Platform 29, Revision 3 | + +### Android SDK Build-tools + +| Package name | Description | +|-----------------------|-------------------------------------------| +| build-tools-19.1.0 | Android SDK Build-tools, Revision 19.1.0 | +| build-tools-20.0.0 | Android SDK Build-tools, Revision 20.0.0 | +| build-tools-21.1.2 | Android SDK Build-tools, Revision 21.1.2 | +| build-tools-22.0.1 | Android SDK Build-tools, Revision 22.0.1 | +| build-tools-23.0.1 | Android SDK Build-tools, Revision 23.0.1 | +| build-tools-23.0.2 | Android SDK Build-tools, Revision 23.0.2 | +| build-tools-23.0.3 | Android SDK Build-tools, Revision 23.0.3 | +| build-tools-24.0.0 | Android SDK Build-tools, Revision 24.0.0 | +| build-tools-24.0.1 | Android SDK Build-tools, Revision 24.0.1 | +| build-tools-24.0.2 | Android SDK Build-tools, Revision 24.0.2 | +| build-tools-24.0.3 | Android SDK Build-tools, Revision 24.0.3 | +| build-tools-25.0.0 | Android SDK Build-tools, Revision 25.0.0 | +| build-tools-25.0.1 | Android SDK Build-tools, Revision 25.0.1 | +| build-tools-25.0.2 | Android SDK Build-tools, Revision 25.0.2 | +| build-tools-25.0.3 | Android SDK Build-tools, Revision 25.0.3 | +| build-tools-26.0.0 | Android SDK Build-tools, Revision 26.0.0 | +| build-tools-26.0.1 | Android SDK Build-tools, Revision 26.0.1 | +| build-tools-26.0.2 | Android SDK Build-tools, Revision 26.0.2 | +| build-tools-26.0.3 | Android SDK Build-tools, Revision 26.0.3 | +| build-tools-27.0.0 | Android SDK Build-tools, Revision 27.0.0 | +| build-tools-27.0.1 | Android SDK Build-tools, Revision 27.0.1 | +| build-tools-27.0.2 | Android SDK Build-tools, Revision 27.0.2 | +| build-tools-27.0.3 | Android SDK Build-tools, Revision 27.0.3 | +| build-tools-28.0.0 | Android SDK Build-tools, Revision 28.0.0 | +| build-tools-28.0.1 | Android SDK Build-tools, Revision 28.0.1 | +| build-tools-28.0.2 | Android SDK Build-tools, Revision 28.0.2 | +| build-tools-28.0.3 | Android SDK Build-tools, Revision 28.0.3 | +| build-tools-29.0.0 | Android SDK Build-tools, Revision 29.0.0 | +| build-tools-29.0.1 | Android SDK Build-tools, Revision 29.0.1 | +| build-tools-29.0.2 | Android SDK Build-tools, Revision 29.0.2 | + +### Utils + +| Package name | Description | +|-----------------------|-------------------------------------------| +| cmake | 3.6.4111459 | +| lldb | 3.1.4508709 | +| ndk-bundle | 18.1.5063045 | +| ProGuard | 5.3.3 | +| Android Emulator | 29.2.1 | + +### Google APIs + +| Package name | Description | +|-----------------------|-------------------------------------------| +| google_apis-google-21 | Google APIs, Android API 21, revision 1 | +| google_apis-google-22 | Google APIs, Android API 22, revision 1 | +| google_apis-google-23 | Google APIs, Android API 23, revision 1 | +| google_apis-google-24 | Google APIs, Android API 24, revision 1 | + +### Extra packages + +| Package name | Description | +|-----------------------------------|------------------------------------------| +| extra-android-m2repository | Android Support Repository, revision 47 | +| extra-google-google_play_services | Google Play services, revision 49 | +| extra-google-m2repository | Google Repository, revision 58 | +| Hardware_Accelerated_Execution_Manager | Intel x86 Emulator Accelerator 7.5.1 | + +## Xamarin + +### Visual Studio for Mac + +- 8.3.4.8 + +### Mono + +- 6.4.0 +- 6.0.0 +- 5.18.1 +- 5.16.1 +- 5.12.0 +- 5.10.1 +- 5.8.1 +- 5.8.0 +- 5.4.1.7 +- 5.4.0.201 +- 5.2.0.224 +- 5.0.1.1 +- 4.8.1.0 + +### Xamarin.iOS SDK + +- 13.4.0.2 +- 13.2.0.47 +- 12.14.0.114 +- 12.8.0.2 +- 12.6.0.25 +- 12.2.1.16 +- 12.2.1.11 +- 12.0.0.15 +- 11.14.0.13 +- 11.12.0.4 +- 11.9.1.24 +- 11.8.0.20 +- 11.6.1.4 +- 11.2.0.11 +- 11.0.0.0 +- 10.10.0.36 +- 10.6.0.10 + + +### Xamarin.Android SDK + +- 10.0.3.0 +- 9.4.1.0 +- 9.3.0-23 +- 9.2.3-0 +- 9.1.8-0 +- 9.0.0-20 +- 9.0.0-18 +- 8.3.3-2 +- 8.2.0-16 +- 8.2.0-15 +- 8.1.5-0 +- 8.0.0-33 +- 7.4.5-1 +- 7.3.1-2 +- 7.1.0-43 + +### Xamarin.Mac SDK + +- 6.4.0.2 +- 6.2.0.47 +- 5.16.1.24 +- 5.8.0.0 +- 5.6.0.25 +- 5.3.1.28 +- 5.2.1.16 +- 5.2.1.9 +- 4.6.0.13 +- 4.4.1.193 +- 4.2.1.28 +- 4.2.0.20 +- 4.0.0.216 +- 3.8.0.49 +- 3.6.3.3 +- 3.4.0.36 +- 3.0.0.398 + +### Unit Test Framework + +- NUnit: 3.6.1 diff --git a/images/macos/macos-10.14-Readme.md b/images/macos/macos-10.14-Readme.md new file mode 100644 index 000000000..d4f08c07e --- /dev/null +++ b/images/macos/macos-10.14-Readme.md @@ -0,0 +1,390 @@ +# Azure Pipelines hosted macOS image + +The following software is installed on machines in the Azure Pipelines **macOS-10.14** VM image ('Hosted macOS' pool). + +#### Xcode 11.1 set by default + +## Operating System + +- OS X 10.14.6 (18G103) **Mojave** + +## Installed Software + +### Language and Runtime + +- Java 1.7: OpenJDK Runtime Environment (Zulu 7.34.0.5-CA-macosx) (build 1.7.0_242-b7) +- Java 1.8: OpenJDK Runtime Environment (Zulu 8.42.0.21-CA-macosx) (build 1.8.0_232-b18) (default) +- Java 11: OpenJDK Runtime Environment Zulu11.35+13-CA (build 11.0.5+10-LTS) +- Java 12: OpenJDK Runtime Environment Zulu12.3+11-CA (build 12.0.2+3) +- Java 13: OpenJDK Runtime Environment Zulu13.28+11-CA (build 13.0.1+10-MTS) +- Node.js 6.17.0 +- NVM 0.33.11 +- NVM - Installed node versions: + v6.17.1 + v8.16.2 + v10.17.0 + v12.13.0 +- PowerShell 6.2.3 +- Python 2.7.16 +- Python 3.7.4 +- Ruby 2.6.5p114 +- .NET Core SDK 1.0.1 1.0.4 1.1.10 1.1.11 1.1.12 1.1.13 1.1.4 1.1.5 1.1.7 1.1.8 1.1.9 2.0.0 2.0.3 2.1.100 2.1.101 2.1.102 2.1.103 2.1.104 2.1.105 2.1.2 2.1.200 2.1.201 2.1.202 2.1.300 2.1.301 2.1.302 2.1.4 2.1.400 2.1.401 2.1.402 2.1.403 2.1.500 2.1.502 2.1.503 2.1.504 2.1.505 2.2.100 2.2.101 2.2.102 2.2.103 2.2.104 2.2.105 +- Go 1.13.3 + + +### Package Management + +- Bundler 2.0.2 +- Carthage 0.34.0 +- CocoaPods 1.8.4 +- Homebrew 2.1.15 +- NPM 3.10.10 +- Yarn 1.19.1 +- NuGet 4.7.0.5148 +- pip 19.1.1(python 2.7) +- pip 19.2.3(python 3.7) +- Miniconda 4.7.12 + +### Project Management + +- Apache Maven 3.6.2 +- Gradle 5.6.3 + +### Utilities + +- curl 7.66.0 (libcurl/7.66.0 SecureTransport zlib/1.2.11) +- Git 2.23.0 +- Git LFS 2.8.0 +- GNU Wget 1.20.3 +- Subversion (SVN) 1.12.2 +- GNU parallel 20190922 + +### Tools + +- fastlane 2.134.0 +- App Center CLI 1.2.2 +- Azure-CLI 2.0.75 + +### Pre-cached tools + +- Python (available through the [setup-python](https://github.com/actions/setup-python/blob/master/README.md) task) + - 2.7.16 + - 3.4.10 + - 3.5.7 + - 3.6.9 + - 3.7.5 + - 3.8.0 + - pypy2 + - pypy3 +- Ruby (available through the [setup-ruby](https://github.com/actions/setup-ruby/blob/master/README.md) task) + - 2.3.8 + - 2.4.6 + - 2.5.5 + - 2.6.3 + +### Xcode + +| Version | Build | Path | +|------------------------|---------|---------------------------------| +| 11.2_beta 2 | 11B44 | /Applications/Xcode_11.2.app | +| 11.1 | 11A1027 | /Applications/Xcode_11.1.app | +| 11.0 | 11A420a | /Applications/Xcode_11.app | +| 10.3 | 10G8 | /Applications/Xcode_10.3.app | +| 10.2.1 | 10E1001 | /Applications/Xcode_10.2.1.app | +| 10.2 | 10E125 | /Applications/Xcode_10.2.app | +| 10.1 | 10B61 | /Applications/Xcode_10.1.app | +| 10.0 | 10A255 | /Applications/Xcode_10.app | +| 9.4.1 | 9F2000 | /Applications/Xcode_9.4.1.app | + +### Xcode Support Tools + +- Nomad CLI 3.0.6 +- Nomad CLI IPA 0.14.3 +- xcpretty 0.3.0 +- xctool 0.3.6 +- xcversion 2.6.1 + +### Installed SDKs + +| SDK | SDK name |Xcode Version | +|---------------------------|-------------|--------------| +| macOS 10.13 | macosx10.13 | 9.4.1 | +| macOS 10.14 | macosx10.14 | 10.0, 10.1, 10.2, 10.2.1, 10.3 | +| macOS 10.15 | macosx10.15 | 11.0, 11.1, 11.2_beta 2 | +| iOS 11.4 | iphoneos11.4 | 9.4.1 | +| iOS 12.0 | iphoneos12.0 | 10.0 | +| iOS 12.1 | iphoneos12.1 | 10.1 | +| iOS 12.2 | iphoneos12.2 | 10.2, 10.2.1| +| iOS 12.4 | iphoneos12.4 | 10.3 | +| iOS 13.0 | iphoneos13.0 | 11.0 | +| iOS 13.1 | iphoneos13.1 | 11.1 | +| iOS 13.2 | iphoneos13.2 | 11.2_beta 2 | +| iOS Simulator 11.4 | iphonesimulator11.4 | 9.4.1 | +| iOS Simulator 12.0 | iphonesimulator12.0 | 10.0 | +| iOS Simulator 12.1 | iphonesimulator12.1 | 10.1 | +| iOS Simulator 12.2 | iphonesimulator12.2 | 10.2, 10.2.1 | +| iOS Simulator 12.4 | iphonesimulator12.4 | 10.3 | +| iOS Simulator 13.0 | iphonesimulator13.0 | 11.0 | +| iOS Simulator 13.1 | iphonesimulator13.1 | 11.1 | +| iOS Simulator 13.2 | iphonesimulator13.2 | 11.2_beta 2 | +| tvOS 11.4 | appletvos11.4 | 9.4.1 | +| tvOS 12.0 | appletvos12.0 | 10.0 | +| tvOS 12.1 | appletvos12.1 | 10.1 | +| tvOS 12.2 | appletvos12.2 | 10.2, 10.2.1 | +| tvOS 12.4 | appletvos12.4 | 10.3 | +| tvOS 13.0 | appletvos13.0 | 11.0, 11.1 | +| tvOS 13.2 | appletvos13.2 | 11.2_beta 2 | +| tvOS Simulator 11.4 | appletvsimulator11.4 | 9.4.1 | +| tvOS Simulator 12.0 | appletvsimulator12.0 | 10.0 | +| tvOS Simulator 12.1 | appletvsimulator12.1 | 10.1 | +| tvOS Simulator 12.2 | appletvsimulator12.2 | 10.2, 10.2.1 | +| tvOS Simulator 12.4 | appletvsimulator12.4 | 10.3 | +| tvOS Simulator 13.0 | appletvsimulator13.0 | 11.0, 11.1 | +| tvOS Simulator 13.2 | appletvsimulator13.2 | 11.2_beta 2 | +| watchOS 4.3 | watchos4.3 | 9.4.1 | +| watchOS 5.0 | watchos5.0 | 10.0 | +| watchOS 5.1 | watchos5.1 | 10.1 | +| watchOS 5.2 | watchos5.2 | 10.2, 10.2.1 | +| watchOS 5.3 | watchos5.3 | 10.3 | +| watchOS 6.0 | watchos6.0 | 11.0, 11.1 | +| watchOS 6.1 | watchos6.1 | 11.2_beta 2 | +| watchOS Simulator 4.3 | watchsimulator4.3 | 9.4.1 | +| watchOS Simulator 5.0 | watchsimulator5.0 | 10.0 | +| watchOS Simulator 5.1 | watchsimulator5.1 | 10.1 | +| watchOS Simulator 5.2 | watchsimulator5.2 | 10.2, 10.2.1 | +| watchOS Simulator 5.3 | watchsimulator5.3 | 10.3 | +| watchOS Simulator 6.0 | watchsimulator6.0 | 11.0, 11.1 | +| watchOS Simulator 6.1 | watchsimulator6.1 | 11.2_beta 2 | +| DriverKit 19.0 | driverkit.macosx19.0 | 11.0, 11.1, 11.2_beta 2 | + + +### Installed Simulators + +#### Runtimes + +| OS | Xcode Version | Simulators | +|---------|---------------------------------|------------| +| iOS 8.4 (12H141) | 9.4.1, 10.0, 10.1, 10.2, 10.2.1, 11, 11.1, 11.2_beta 2 | iPhone 4s
iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPad 2
iPad Retina
iPad Air | +| iOS 9.0 (13A344) | 9.4.1, 10.0, 10.1, 10.2, 10.2.1, 11, 11.1, 11.2_beta 2 | iPhone 4s
iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPad 2
iPad Retina
iPad Air
iPad Air 2 | +| iOS 9.1 (13B143)
iOS 9.2 (13C75)
iOS 9.3 (13E233) | 9.4.1, 10.0, 10.1, 10.2, 10.2.1, 11, 11.1, 11.2_beta 2 | iPhone 4s
iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPad 2
iPad Retina
iPad Air
iPad Air 2
iPad Pro | +| iOS 10.0 (14A345) | 9.4.1, 10.0, 10.1, 10.2, 10.2.1, 11, 11.1, 11.2_beta 2 | iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone SE
iPad Air
iPad Air 2
iPad Pro (9.7 inch)
iPad Pro (12.9 inch) | +| iOS 10.1 (14B72)
iOS 10.2 (14C89) | 9.4.1, 10.0, 10.1, 10.2, 10.2.1, 11, 11.1, 11.2_beta 2 | iPhone 5
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone SE
iPad Air
iPad Air 2
iPad Pro (9.7 inch)
iPad Pro (12.9 inch) | +| iOS 11.4 (15F79) | 9.4.1 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone SE
iPhone 8
iPhone 8 Plus
iPhone X
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch) | +| iOS 12.0 (16A5288q) | 10.0 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone SE
iPhone 8
iPhone 8 Plus
iPhone X
iPhone XR
iPhone XS
iPhone XS Max
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (10.5-inch)
iPad Pro (11-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad (6th generation) | +| iOS 12.1 (16B91) | 10.1 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone SE
iPhone 8
iPhone 8 Plus
iPhone X
iPhone X
iPhone XS
iPhone XS Max
iPhone XR
iPad Air
iPad Air 2
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch)
iPad (6th generation)
iPad Pro (11-inch)
iPad Pro (12.9-inch) (3rd generation) | +| iOS 12.2 (16E226)
iOS 12.4 (16G73) | 10.2, 10.2.1
10.3 | iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone 7
iPhone 7 Plus
iPhone SE
iPhone 8
iPhone 8 Plus
iPhone X
iPhone X
iPhone XS
iPhone XS Max
iPhone XR
iPad Air
iPad Air 2
iPad Air (3rd generation)
iPad mini 2
iPad mini 3
iPad mini 4
iPad mini (5th generation)
iPad (5th generation)
iPad Pro (9.7-inch)
iPad Pro (12.9-inch)
iPad Pro (12.9-inch) (2nd generation)
iPad Pro (10.5-inch)
iPad (6th generation)
iPad Pro (11-inch)
iPad Pro (12.9-inch) (3rd generation) | +| iOS 13.0 (17A577a) | 11 | iPhone 8
iPhone 8 Plus
iPhone 11
iPhone 11 Pro
iPhone 11 Pro Max
iPad Pro (9.7-inch)
iPad Pro
iPad Pro (12.9-inch) (3rd generation)
iPad Air (3rd generation) | +| iOS 13.1 (17A844) | 11.1 | iPhone 8
iPhone 8 Plus
iPhone 11
iPhone 11 Pro
iPhone 11 Pro Max
iPad Pro (9.7-inch)
iPad Pro
iPad Pro (12.9-inch) (3rd generation)
iPad Air (3rd generation) | +| iOS 13.2 (17B5068e) | 11.2_beta 2 | iPhone 8
iPhone 8 Plus
iPhone 11
iPhone 11 Pro
iPhone 11 Pro Max
iPad Pro (9.7-inch)
iPad Pro
iPad Pro (12.9-inch) (3rd generation)
iPad Air (3rd generation) | +| tvOS 11.4 (15L576)
tvOS 12.0 (16J5283n)
tvOS 12.1 (16J602)
tvOS 12.2 (16L225)
tvOS 12.4 (16M567)
tvOS 13.0 (17J559)
tvOS 13.2 (17K5068b) | 9.4.1
10.0
10.1
10.2, 10.2.1
10.3
11.0
11.1 | Apple TV
Apple TV 4K
Apple TV 4K (at 1080p) | +| watchOS 4.3 (15T212) | 9.4.1 | Apple Watch 38mm
Apple Watch 42mm
Apple Watch Series 2 38mm
Apple Watch Series 2 42mm
Apple Watch Series 3 38mm
Apple Watch Series 3 42mm | +| watchOS 5.0 (16R5283q)
watchOS 5.1 (16R591)
watchOS 5.2 (16T224)
watchOS 5.3 (16U567) | 10.0
10.1
10.2, 10.2.1
10.3 | Apple Watch Series 2 38mm
Apple Watch Series 2 42mm
Apple Watch Series 3 38mm
Apple Watch Series 3 42mm
Apple Watch Series 4 40mm
Apple Watch Series 4 44mm | +| watchOS 6.0 (17R566)

watchOS 6.1 (17S5068e) | 11.0
11.1
11.2_beta 2 | Apple Watch Series 4 40mm
Apple Watch Series 4 44mm
Apple Watch Series 5 40mm
Apple Watch Series 5 44mm | + + +#### How to install additional simulators? +Image contains only default simulators for each Xcode version. To install a specific simulator for all Xcode version, use xcversion tool: +``` +xcversion simulators --install='iOS 8.4' +``` +**!** - The installation of some simulators may cause compatibility issues. + +### Device Pairs + +| Watch | Phone | +|-----------------------------|-------------------| +| Apple Watch - 38mm | iPhone 6s | +| Apple Watch - 42mm | iPhone 6s Plus | +| Apple Watch Series 2 - 38mm | iPhone 7 | +| Apple Watch Series 2 - 42mm | iPhone 7 Plus | +| Apple Watch Series 3 - 38mm | iPhone 8 | +| Apple Watch Series 3 - 42mm | iPhone 8 Plus | +| Apple Watch Series 4 - 40mm | iPhone XS | +| Apple Watch Series 4 - 44mm | iPhone XS Max | +| Apple Watch Series 5 - 40mm | iPhone 11 Pro | +| Apple Watch Series 5 - 44mm | iPhone 11 Pro Max | + +## Android + +### Android SDK Tools + +| Package name | Description | +|-----------------------|---------------------------------------------| +| tools | Android SDK Tools, revision 26.1.1 | + +### Android SDK Platform-tools + +| Package name | Description | +|-----------------------|---------------------------------------------| +| platform-tools | Android SDK Platform-tools, revision 29.0.4 | + +### Android SDK Platforms + +| Package name | Description | +|-----------------------|-------------------------------------------| +| android-15 | Android SDK Platform 15, Revision 5 | +| android-16 | Android SDK Platform 16, Revision 5 | +| android-17 | Android SDK Platform 17, Revision 3 | +| android-18 | Android SDK Platform 18, Revision 3 | +| android-19 | Android SDK Platform 19, Revision 4 | +| android-20 | Android SDK Platform 20, Revision 2 | +| android-21 | Android SDK Platform 21, Revision 2 | +| android-22 | Android SDK Platform 22, Revision 2 | +| android-23 | Android SDK Platform 23, Revision 3 | +| android-24 | Android SDK Platform 24, Revision 2 | +| android-25 | Android SDK Platform 25, Revision 3 | +| android-26 | Android SDK Platform 26, Revision 2 | +| android-27 | Android SDK Platform 27, Revision 3 | +| android-28 | Android SDK Platform 28, Revision 6 | +| android-29 | Android SDK Platform 29, Revision 3 | + +### Android SDK Build-tools + +| Package name | Description | +|-----------------------|-------------------------------------------| +| build-tools-19.1.0 | Android SDK Build-tools, Revision 19.1.0 | +| build-tools-20.0.0 | Android SDK Build-tools, Revision 20.0.0 | +| build-tools-21.1.2 | Android SDK Build-tools, Revision 21.1.2 | +| build-tools-22.0.1 | Android SDK Build-tools, Revision 22.0.1 | +| build-tools-23.0.1 | Android SDK Build-tools, Revision 23.0.1 | +| build-tools-23.0.2 | Android SDK Build-tools, Revision 23.0.2 | +| build-tools-23.0.3 | Android SDK Build-tools, Revision 23.0.3 | +| build-tools-24.0.0 | Android SDK Build-tools, Revision 24.0.0 | +| build-tools-24.0.1 | Android SDK Build-tools, Revision 24.0.1 | +| build-tools-24.0.2 | Android SDK Build-tools, Revision 24.0.2 | +| build-tools-24.0.3 | Android SDK Build-tools, Revision 24.0.3 | +| build-tools-25.0.0 | Android SDK Build-tools, Revision 25.0.0 | +| build-tools-25.0.1 | Android SDK Build-tools, Revision 25.0.1 | +| build-tools-25.0.2 | Android SDK Build-tools, Revision 25.0.2 | +| build-tools-25.0.3 | Android SDK Build-tools, Revision 25.0.3 | +| build-tools-26.0.0 | Android SDK Build-tools, Revision 26.0.0 | +| build-tools-26.0.1 | Android SDK Build-tools, Revision 26.0.1 | +| build-tools-26.0.2 | Android SDK Build-tools, Revision 26.0.2 | +| build-tools-26.0.3 | Android SDK Build-tools, Revision 26.0.3 | +| build-tools-27.0.0 | Android SDK Build-tools, Revision 27.0.0 | +| build-tools-27.0.1 | Android SDK Build-tools, Revision 27.0.1 | +| build-tools-27.0.2 | Android SDK Build-tools, Revision 27.0.2 | +| build-tools-27.0.3 | Android SDK Build-tools, Revision 27.0.3 | +| build-tools-28.0.0 | Android SDK Build-tools, Revision 28.0.0 | +| build-tools-28.0.1 | Android SDK Build-tools, Revision 28.0.1 | +| build-tools-28.0.2 | Android SDK Build-tools, Revision 28.0.2 | +| build-tools-28.0.3 | Android SDK Build-tools, Revision 28.0.3 | +| build-tools-29.0.0 | Android SDK Build-tools, Revision 29.0.0 | +| build-tools-29.0.1 | Android SDK Build-tools, Revision 29.0.1 | +| build-tools-29.0.2 | Android SDK Build-tools, Revision 29.0.2 | + +### Utils + +| Package name | Description | +|-----------------------|-------------------------------------------| +| cmake | 3.6.4111459 | +| lldb | 2.3.3614996 | +| ndk-bundle | 18.1.5063045 | +| ProGuard | 5.3.3 | +| Android Emulator | 29.2.1 | + +### Google APIs + +| Package name | Description | +|-----------------------|-------------------------------------------| +| google_apis-google-21 | Google APIs, Android API 21, revision 1 | +| google_apis-google-22 | Google APIs, Android API 22, revision 1 | +| google_apis-google-23 | Google APIs, Android API 23, revision 1 | +| google_apis-google-24 | Google APIs, Android API 24, revision 1 | + +### Extra packages + +| Package name | Description | +|-----------------------------------|------------------------------------------| +| extra-android-m2repository | Android Support Repository, revision 47 | +| extra-google-google_play_services | Google Play services, revision 49 | +| extra-google-m2repository | Google Repository, revision 58 | +| Hardware_Accelerated_Execution_Manager | Intel x86 Emulator Accelerator 7.3.2 | + +## Xamarin + +### Visual Studio for Mac + +- 8.3.4.8 + + +### Mono + +- 6.4.0 +- 6.0.0 +- 5.18.1 +- 5.16.1 +- 5.12.0 +- 5.10.1 +- 5.8.1 +- 5.8.0 +- 5.4.1.7 +- 5.4.0.201 +- 5.2.0.224 +- 5.0.1.1 +- 4.8.1.0 + +### Xamarin.iOS SDK + +- 13.4.0.2 +- 13.2.0.47 +- 12.14.0.114 +- 12.10.0.157 +- 12.8.0.2 +- 12.6.0.25 +- 12.2.1.16 +- 12.2.1.11 +- 12.0.0.15 +- 11.14.0.13 +- 11.12.0.4 +- 11.9.1.24 +- 11.8.0.20 +- 11.6.1.4 +- 11.2.0.11 +- 11.0.0.0 +- 10.10.0.36 +- 10.6.0.10 + + +### Xamarin.Android SDK + +- 10.0.3.0 +- 9.4.1.0 +- 9.3.0-23 +- 9.2.3-0 +- 9.1.8-0 +- 9.0.0-20 +- 9.0.0-18 +- 8.3.3-2 +- 8.2.0-16 +- 8.2.0-15 +- 8.1.5-0 +- 8.0.0-33 +- 7.4.5-1 +- 7.3.1-2 +- 7.1.0-43 + +### Xamarin.Mac SDK + +- 6.4.0.2 +- 6.2.0.47 +- 5.16.1.24 +- 5.10.0.157 +- 5.8.0.0 +- 5.6.0.25 +- 5.3.1.28 +- 5.2.1.16 +- 5.2.1.9 +- 4.6.0.13 +- 4.4.1.193 +- 4.2.1.28 +- 4.2.0.20 +- 4.0.0.216 +- 3.8.0.49 +- 3.6.3.3 +- 3.4.0.36 +- 3.0.0.398 + +### Unit Test Framework + +- NUnit: 3.6.1 diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json new file mode 100644 index 000000000..902f0791e --- /dev/null +++ b/images/win/Windows2019-Azure.json @@ -0,0 +1,782 @@ +{ + "variables": { + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}", + "tenant_id": "{{env `ARM_TENANT_ID`}}", + "object_id": "{{env `ARM_OBJECT_ID`}}", + "resource_group": "{{env `ARM_RESOURCE_GROUP`}}", + "storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}", + "temp_resource_group_name": "{{env `TEMP_RESOURCE_GROUP_NAME`}}", + "location": "{{env `ARM_RESOURCE_LOCATION`}}", + "ssh_password": "{{env `SSH_PASSWORD`}}", + "virtual_network_name": "{{env `VNET_NAME`}}", + "virtual_network_resource_group_name": "{{env `VNET_RESOURCE_GROUP`}}", + "virtual_network_subnet_name": "{{env `VNET_SUBNET`}}", + "private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}", + "vm_size": "Standard_DS4_v2", + + "image_folder": "C:\\image", + "commit_file": "C:\\image\\commit.txt", + "metadata_file": "C:\\image\\metadata.txt", + "helper_script_folder": "C:\\Program Files\\WindowsPowerShell\\Modules\\", + "commit_id": "LATEST", + "install_user": "installer", + "install_password": null, + "capture_name_prefix": "packer", + "image_version": "dev" + }, + "sensitive-variables": ["install_password", "ssh_password", "client_secret"], + "builders": [ + { + "name": "vhd", + "type": "azure-arm", + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "subscription_id": "{{user `subscription_id`}}", + "object_id": "{{user `object_id`}}", + "tenant_id": "{{user `tenant_id`}}", + "os_disk_size_gb": "128", + "location": "{{user `location`}}", + "vm_size": "{{user `vm_size`}}", + "resource_group_name": "{{user `resource_group`}}", + "storage_account": "{{user `storage_account`}}", + "temp_resource_group_name": "{{user `temp_resource_group_name`}}", + "capture_container_name": "images", + "capture_name_prefix": "{{user `capture_name_prefix`}}", + "virtual_network_name": "{{user `virtual_network_name`}}", + "virtual_network_resource_group_name": "{{user `virtual_network_resource_group_name`}}", + "virtual_network_subnet_name": "{{user `virtual_network_subnet_name`}}", + "private_virtual_network_with_public_ip": "{{user `private_virtual_network_with_public_ip`}}", + "os_type": "Windows", + "image_publisher": "MicrosoftWindowsServer", + "image_offer": "WindowsServer", + "image_sku": "2019-Datacenter", + "communicator": "winrm", + "winrm_use_ssl": "true", + "winrm_insecure": "true", + "winrm_username": "packer" + } + ], + "provisioners": [ + { + "type": "powershell", + "inline":[ + "New-Item -Path {{user `image_folder`}} -ItemType Directory -Force", + "Write-Output {{user `commit_id`}} > {{user `commit_file`}}", + "Write-Host (Get-Content -Path {{user `commit_file`}})" + ] + }, + { + "type": "file", + "source": "{{ template_dir }}/scripts/ImageHelpers", + "destination": "{{user `helper_script_folder`}}" + }, + { + "type": "windows-shell", + "inline": [ + "net user {{user `install_user`}} {{user `install_password`}} /add /passwordchg:no /passwordreq:yes /active:yes /Y" , + "net localgroup Administrators {{user `install_user`}} /add", + "winrm set winrm/config/service/auth @{Basic=\"true\"}", + "winrm get winrm/config/service/auth" + ] + }, + { + "type": "powershell", + "inline": [ + "if (-not ((net localgroup Administrators) -contains '{{user `install_user`}}')) { exit 1 }" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "ImageVersion={{user `image_version`}}" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Vs2019/Initialize-VM.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-ContainersFeature.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "inline": [ + "setx ImageVersion {{user `image_version` }} /m" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Docker.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-PowershellCore.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Docker.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-PowershellCore.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Vs2019/Update-DockerImages.ps1" + ] + }, + { + "type": "powershell", + "scripts": [ + "{{ template_dir }}/scripts/Installers/Vs2019/Install-WDK.ps1" + ] + }, + { + "type": "powershell", + "valid_exit_codes": [ + 0, + 3010 + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Vs2019/Install-VS2019.ps1" + ], + "elevated_user": "{{user `install_user`}}", + "elevated_password": "{{user `install_password`}}" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Vs2019/Install-Wix.ps1" + ] + }, + { + "type": "powershell", + "valid_exit_codes": [ + 0, + 3010 + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-NET48.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-ServiceFabricSDK.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Vs2019/Validate-Wix.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-NET48.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Vs2019/Validate-WDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-ServiceFabricSDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Update-DotnetTLS.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzureCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzureDevOpsCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Download-ToolCache.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Vs2019/Install-Python.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Git.ps1" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "GO_VERSIONS=1.10.8,1.11.12,1.12.7,1.13", + "GO_DEFAULT=1.12.7" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Go.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-PHP.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Ruby.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Rust.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Sbt.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Svn.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Chrome.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Firefox.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-SeleniumWebDrivers.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Enable-DeveloperMode.ps1" + ], + "elevated_user": "{{user `install_user`}}", + "elevated_password": "{{user `install_password`}}" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-WinAppDriver.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-WinAppDriver.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-NodeLts.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-JavaTools.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Cmake.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-DACFx.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Update-AndroidSDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-MysqlCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-SQLPowerShellTools.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-DotnetSDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-WindowsUpdates.ps1" + ] + }, + { + "type": "windows-shell", + "inline": ["wmic product where \"name like '%%microsoft azure powershell%%'\" call uninstall /nointeractive"] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzureModules.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-MinGW.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-TypeScript.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Miniconda.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-AzureCosmosDbEmulator.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-7zip.ps1" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "BOOST_VERSIONS=1.69.0", + "BOOST_DEFAULT=1.69.0" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Boost.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Mercurial.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Jq.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-InnoSetup.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Perl.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-GitVersion.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-OpenSSL.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-NSIS.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-CloudFoundryCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Vcpkg.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-KubernetesCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Kind.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzureCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzureDevOpsCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-ToolCache.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Python.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Git.ps1" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "GO_VERSIONS=1.10.8,1.11.12,1.12.7,1.13", + "GO_DEFAULT=1.12.7" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Go.ps1" + ] + }, + { + "type": "powershell", + "environment_vars": [ + "BOOST_VERSIONS=1.69.0", + "BOOST_DEFAULT=1.69.0" + ], + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Boost.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-PHP.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Ruby.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Rust.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Svn.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Sbt.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Chrome.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Firefox.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-SeleniumWebDrivers.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-NodeLts.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-JavaTools.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Cmake.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-DACFx.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-DotnetSDK.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-MysqlCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-MinGW.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-TypeScript.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Miniconda.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-7zip.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Mercurial.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Jq.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-InnoSetup.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Perl.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-GitVersion.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-OpenSSL.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-NSIS.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-CloudFoundryCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Vcpkg.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-KubernetesCli.ps1" + ] + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Validate-Kind.ps1" + ] + }, + { + "type": "file", + "source": "C:\\InstalledSoftware.md", + "destination": "{{ template_dir }}/Vs2019-Server2019-Readme.md", + "direction": "download" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Finalize-VM.ps1" + ] + }, + { + "type": "windows-restart", + "restart_timeout": "10m" + }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Vs2019/Run-Antivirus.ps1" + ] + }, + { + "type": "powershell", + "inline": [ + "if( Test-Path $Env:SystemRoot\\System32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\System32\\Sysprep\\unattend.xml -Force}", + "& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit", + "while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10 } else { break } }" + ] + } + ] +} diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psd1 b/images/win/scripts/ImageHelpers/ImageHelpers.psd1 new file mode 100644 index 000000000..438a9d322 --- /dev/null +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psd1 @@ -0,0 +1,124 @@ +# +# Module manifest for module 'ImageHelpers' +# +# Generated by: chrispat +# +# Generated on: 11/1/2017 +# + +@{ + +# Script module or binary module file associated with this manifest. +RootModule = 'ImageHelpers.psm1' + +# Version number of this module. +ModuleVersion = '0.0.1' + +# Supported PSEditions +# CompatiblePSEditions = @() + +# ID used to uniquely identify this module +GUID = 'c9334909-16a1-48f1-a94a-c7baf1b961d9' + +# Author of this module +Author = 'chrispat' + +# Company or vendor of this module +CompanyName = 'Unknown' + +# Copyright statement for this module +Copyright = '(c) 2017 chrispat. All rights reserved.' + +# Description of the functionality provided by this module +Description = 'Helper functions for creating vsts images' + +# Minimum version of the Windows PowerShell engine required by this module +# PowerShellVersion = '' + +# Name of the Windows PowerShell host required by this module +# PowerShellHostName = '' + +# Minimum version of the Windows PowerShell host required by this module +# PowerShellHostVersion = '' + +# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# DotNetFrameworkVersion = '' + +# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# CLRVersion = '' + +# Processor architecture (None, X86, Amd64) required by this module +# ProcessorArchitecture = '' + +# Modules that must be imported into the global environment prior to importing this module +# RequiredModules = @() + +# Assemblies that must be loaded prior to importing this module +# RequiredAssemblies = @() + +# Script files (.ps1) that are run in the caller's environment prior to importing this module. +# ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +# TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +# FormatsToProcess = @() + +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess +# NestedModules = @() + +# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. +FunctionsToExport = '*' + +# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. +CmdletsToExport = '*' + +# Variables to export from this module +VariablesToExport = '*' + +# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. +AliasesToExport = '*' + +# DSC resources to export from this module +# DscResourcesToExport = @() + +# List of all modules packaged with this module +# ModuleList = @() + +# List of all files packaged with this module +# FileList = @() + +# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. +PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + # Tags = @() + + # A URL to the license for this module. + # LicenseUri = '' + + # A URL to the main website for this project. + # ProjectUri = '' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + } # End of PSData hashtable + +} # End of PrivateData hashtable + +# HelpInfo URI of this module +# HelpInfoURI = '' + +# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. +# DefaultCommandPrefix = '' + +} + + diff --git a/images/win/scripts/ImageHelpers/ImageHelpers.psm1 b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 new file mode 100644 index 000000000..12df84e7a --- /dev/null +++ b/images/win/scripts/ImageHelpers/ImageHelpers.psm1 @@ -0,0 +1,19 @@ +[CmdletBinding()] +param() + +. $PSScriptRoot\PathHelpers.ps1 +. $PSScriptRoot\InstallHelpers.ps1 +. $PSScriptRoot\MarkdownHelpers.ps1 + +Export-ModuleMember -Function @( + 'Test-MachinePath' + 'Get-MachinePath' + 'Set-MachinePath' + 'Add-MachinePathItem' + 'Get-SystemVariable' + 'Set-SystemVariable' + 'Install-MSI' + 'Install-EXE' + 'Add-ContentToMarkdown' + 'Add-SoftwareDetailsToMarkdown' +) diff --git a/images/win/scripts/ImageHelpers/InstallHelpers.ps1 b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 new file mode 100644 index 000000000..57eaa1b03 --- /dev/null +++ b/images/win/scripts/ImageHelpers/InstallHelpers.ps1 @@ -0,0 +1,83 @@ +function Install-MSI +{ + Param + ( + [String]$MsiUrl, + [String]$MsiName + ) + + $exitCode = -1 + + try + { + Write-Host "Downloading $MsiName..." + $FilePath = "${env:Temp}\$MsiName" + + Invoke-WebRequest -Uri $MsiUrl -OutFile $FilePath + + $Arguments = ('/i', $FilePath, '/QN', '/norestart' ) + + Write-Host "Starting Install $MsiName..." + $process = Start-Process -FilePath msiexec.exe -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + exit $exitCode + } + } + catch + { + Write-Host -Object "Failed to install the MSI $MsiName" + Write-Host -Object $_.Exception.Message + exit -1 + } +} + + +function Install-EXE +{ + Param + ( + [String]$Url, + [String]$Name, + [String[]]$ArgumentList + ) + + $exitCode = -1 + + try + { + Write-Host "Downloading $Name..." + $FilePath = "${env:Temp}\$Name" + + Invoke-WebRequest -Uri $Url -OutFile $FilePath + + Write-Host "Starting Install $Name..." + $process = Start-Process -FilePath $FilePath -ArgumentList $ArgumentList -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + return $exitCode + } + } + catch + { + Write-Host -Object "Failed to install the Executable $Name" + Write-Host -Object $_.Exception.Message + return -1 + } +} diff --git a/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 b/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 new file mode 100644 index 000000000..3d5f17590 --- /dev/null +++ b/images/win/scripts/ImageHelpers/MarkdownHelpers.ps1 @@ -0,0 +1,25 @@ +function Add-ContentToMarkdown { + [CmdletBinding()] + param( + $Content = "" + ) + + Add-Content 'C:\InstalledSoftware.md' $Content +} + + +function Add-SoftwareDetailsToMarkdown { + [CmdletBinding()] + param( + $SoftwareName = "", + $DescriptionMarkdown = "" + ) + +$Content = @" + +## $SoftwareName + +$DescriptionMarkdown +"@ + Add-ContentToMarkdown -Content $Content +} diff --git a/images/win/scripts/ImageHelpers/PathHelpers.ps1 b/images/win/scripts/ImageHelpers/PathHelpers.ps1 new file mode 100644 index 000000000..0d50cbe38 --- /dev/null +++ b/images/win/scripts/ImageHelpers/PathHelpers.ps1 @@ -0,0 +1,68 @@ +function Test-MachinePath{ + [CmdletBinding()] + param( + [string]$PathItem + ) + + $currentPath = Get-MachinePath + + $pathItems = $currentPath.Split(';') + + if($pathItems.Contains($PathItem)) + { + return $true + } + else + { + return $false + } +} + +function Set-MachinePath{ + [CmdletBinding()] + param( + [string]$NewPath + ) + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name Path -Value $NewPath + return $NewPath +} + +function Add-MachinePathItem +{ + [CmdletBinding()] + param( + [string]$PathItem + ) + + $currentPath = Get-MachinePath + $newPath = $PathItem + ';' + $currentPath + return Set-MachinePath -NewPath $newPath +} + +function Get-MachinePath{ + [CmdletBinding()] + param( + + ) + $currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path + return $currentPath +} + +function Get-SystemVariable{ + [CmdletBinding()] + param( + [string]$SystemVariable + ) + $currentPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name $SystemVariable).$SystemVariable + return $currentPath +} + +function Set-SystemVariable{ + [CmdletBinding()] + param( + [string]$SystemVariable, + [string]$Value + ) + Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name $SystemVariable -Value $Value + return $Value +} \ No newline at end of file diff --git a/images/win/scripts/ImageHelpers/test/ImageHelpers.Tests.ps1 b/images/win/scripts/ImageHelpers/test/ImageHelpers.Tests.ps1 new file mode 100644 index 000000000..74af90959 --- /dev/null +++ b/images/win/scripts/ImageHelpers/test/ImageHelpers.Tests.ps1 @@ -0,0 +1,13 @@ +$ModuleManifestName = 'ImageHelpers.psd1' +$ModuleManifestPath = "$PSScriptRoot\..\$ModuleManifestName" + + + +Describe 'Module Manifest Tests' { + It 'Passes Test-ModuleManifest' { + Test-ModuleManifest -Path $ModuleManifestPath | Should Not BeNullOrEmpty + $? | Should Be $true + } +} + + diff --git a/images/win/scripts/ImageHelpers/test/PathHelpers.Tests.ps1 b/images/win/scripts/ImageHelpers/test/PathHelpers.Tests.ps1 new file mode 100644 index 000000000..1848fe432 --- /dev/null +++ b/images/win/scripts/ImageHelpers/test/PathHelpers.Tests.ps1 @@ -0,0 +1,34 @@ +. $PSScriptRoot\..\PathHelpers.ps1 + +Describe 'Test-MachinePath Tests' { + Mock Get-MachinePath {return "C:\foo;C:\bar"} + It 'Path contains item' { + Test-MachinePath -PathItem "C:\foo" | Should Be $true + } + It 'Path does not containe item' { + Test-MachinePath -PathItem "C:\baz" | Should Be $false + } +} + +Describe 'Set-MachinePath Tests' { + Mock Get-MachinePath {return "C:\foo;C:\bar"} + Mock Set-ItemProperty {return} + It 'Set-MachinePath should return new path' { + Set-MachinePath -NewPath "C:\baz" | Should Be "C:\baz" + } +} + +Describe "Add-MachinePathItem Tests"{ + Mock Get-MachinePath {return "C:\foo;C:\bar"} + Mock Set-ItemProperty {return} + It 'Add-MachinePathItem should return complete path' { + Add-MachinePathItem -PathItem 'C:\baz' | Should Be 'C:\baz;C:\foo;C:\bar' + } +} + +Describe 'Set-SystemVariable Tests' { + Mock Set-ItemProperty {return} + It 'Set-SystemVariable should return new path' { + Set-SystemVariable -SystemVariable "NewPathVar" -Value "C:\baz" | Should Be "C:\baz" + } +} \ No newline at end of file diff --git a/images/win/scripts/Installers/Download-ToolCache.ps1 b/images/win/scripts/Installers/Download-ToolCache.ps1 new file mode 100644 index 000000000..5f5c3e9e8 --- /dev/null +++ b/images/win/scripts/Installers/Download-ToolCache.ps1 @@ -0,0 +1,51 @@ +################################################################################ +## File: Download-ToolCache.ps1 +## Desc: Download tool cache +################################################################################ + +Function InstallTool +{ + Param + ( + [System.Object]$ExecutablePath + ) + + Write-Host $ExecutablePath.DirectoryName + Set-Location -Path $ExecutablePath.DirectoryName + Get-Location | Write-Host + if (Test-Path 'tool.zip') + { + Expand-Archive 'tool.zip' -DestinationPath '.' + } + cmd.exe /c 'install_to_tools_cache.bat' +} + +$SourceUrl = "https://vstsagenttools.blob.core.windows.net/tools" + +$Dest = "C:/" + +$Path = "hostedtoolcache/windows" + +$env:Path = "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy;" + $env:Path + +Write-Host "Started AzCopy from $SourceUrl to $Dest" + +AzCopy /Source:$SourceUrl /Dest:$Dest /S /V /Pattern:$Path + +$ToolsDirectory = $Dest + $Path + +$current = Get-Location +Set-Location -Path $ToolsDirectory + +Get-ChildItem -Recurse -Depth 4 -Filter install_to_tools_cache.bat | ForEach-Object { + #In order to work correctly Python 3.4 x86 must be installed after x64, this is achieved by current toolcache catalog structure + InstallTool($_) +} + +Set-Location -Path $current + +setx AGENT_TOOLSDIRECTORY $ToolsDirectory /M + +#junction point from the previous Python2 directory to the toolcache Python2 +$python2Dir = (Get-Item -Path ($ToolsDirectory + '/Python/2.7*/x64')).FullName +cmd.exe /c mklink /d "C:\Python27amd64" "$python2Dir" diff --git a/images/win/scripts/Installers/Enable-DeveloperMode.ps1 b/images/win/scripts/Installers/Enable-DeveloperMode.ps1 new file mode 100644 index 000000000..796d02d88 --- /dev/null +++ b/images/win/scripts/Installers/Enable-DeveloperMode.ps1 @@ -0,0 +1,13 @@ +################################################################################ +## File: Enable-DeveloperMode.ps1 +## Desc: Enables Developer Mode by toggling registry setting. Developer Mode is required to enable certain tools (e.g. WinAppDriver). +################################################################################ + +# Create AppModelUnlock if it doesn't exist, required for enabling Developer Mode +$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" +if (-not(Test-Path -Path $RegistryKeyPath)) { + New-Item -Path $RegistryKeyPath -ItemType Directory -Force +} + +# Add registry value to enable Developer Mode +New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1 diff --git a/images/win/scripts/Installers/Finalize-VM.ps1 b/images/win/scripts/Installers/Finalize-VM.ps1 new file mode 100644 index 000000000..d8632568f --- /dev/null +++ b/images/win/scripts/Installers/Finalize-VM.ps1 @@ -0,0 +1,34 @@ +################################################################################ +## File: Finalize-VM.ps1 +## Desc: Clean up folders temp folders after installs to save space +################################################################################ + +Write-Host "Cleanup WinSxS" +Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase + +$ErrorActionPreference = 'silentlycontinue' + +Write-Host "Clean up various directories" +@( + "C:\\Recovery", + "$env:windir\\logs", + "$env:windir\\winsxs\\manifestcache", + "$env:windir\\Temp", + "$env:windir\\Installer", + "$env:TEMP" +) | ForEach-Object { + if (Test-Path $_) { + Write-Host "Removing $_" + try { + Takeown /d Y /R /f $_ + Icacls $_ /GRANT:r administrators:F /T /c /q 2>&1 | Out-Null + Remove-Item $_ -Recurse -Force | Out-Null + } + catch { $global:error.RemoveAt(0) } + } +} + +$winInstallDir = "$env:windir\\Installer" +New-Item -Path $winInstallDir -ItemType Directory -Force + +$ErrorActionPreference = 'Continue' diff --git a/images/win/scripts/Installers/Install-7zip.ps1 b/images/win/scripts/Installers/Install-7zip.ps1 new file mode 100644 index 000000000..4a073e0a7 --- /dev/null +++ b/images/win/scripts/Installers/Install-7zip.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-7zip.ps1 +## Desc: Install 7zip +################################################################################ + +choco install 7zip.install -y diff --git a/images/win/scripts/Installers/Install-AzureCli.ps1 b/images/win/scripts/Installers/Install-AzureCli.ps1 new file mode 100644 index 000000000..82f44a644 --- /dev/null +++ b/images/win/scripts/Installers/Install-AzureCli.ps1 @@ -0,0 +1,12 @@ +################################################################################ +## File: Install-AzureCli.ps1 +## Desc: Install Azure CLI +################################################################################ + +choco install azure-cli -y + +$AzureCliExtensionPath = Join-Path $Env:CommonProgramFiles 'AzureCliExtensionDirectory' +New-Item -ItemType "directory" -Path $AzureCliExtensionPath + +[Environment]::SetEnvironmentVariable("AZURE_EXTENSION_DIR", $AzureCliExtensionPath, [System.EnvironmentVariableTarget]::Machine) +$Env:AZURE_EXTENSION_DIR = $AzureCliExtensionPath diff --git a/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 b/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 new file mode 100644 index 000000000..9676c0695 --- /dev/null +++ b/images/win/scripts/Installers/Install-AzureCosmosDbEmulator.ps1 @@ -0,0 +1,8 @@ +#################################################################################### +## File: Install-AzureCosmosDbEmulator.ps1 +## Desc: Install Azure CosmosDb Emulator +#################################################################################### + +Import-Module -Name ImageHelpers -Force + +Install-MSI -MsiUrl "https://aka.ms/cosmosdb-emulator" -MsiName "AzureCosmosDBEmulator.msi" diff --git a/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 b/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 new file mode 100644 index 000000000..b2d4c10b2 --- /dev/null +++ b/images/win/scripts/Installers/Install-AzureDevOpsCli.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-AzureDevOpsCli.ps1 +## Desc: Install Azure DevOps CLI +################################################################################ + +az extension add -n azure-devops diff --git a/images/win/scripts/Installers/Install-AzureModules.ps1 b/images/win/scripts/Installers/Install-AzureModules.ps1 new file mode 100644 index 000000000..c1f7956ac --- /dev/null +++ b/images/win/scripts/Installers/Install-AzureModules.ps1 @@ -0,0 +1,197 @@ +################################################################################ +## File: Install-AzureModules.ps1 +## Desc: Install Azure PowerShell modules +################################################################################ + +Add-Type -AssemblyName System.IO.Compression.FileSystem + +function Download-Zip +{ + [CmdletBinding()] + Param( + [Parameter( + Mandatory = $true + )] + [string] + $BlobUri + ) + + Write-Host "Downloading the zip from blob: '$BlobUri'" + $fileName = "azureps_" + "$(Get-Random)" + ".zip" + $targetLocation = Join-Path $ENV:Temp -ChildPath $fileName + Write-Host "Download target location: '$targetLocation'" + $webClient = New-Object Net.WebClient + $null = $webClient.DownloadFileAsync($BlobUri, $targetLocation) + while ($webClient.IsBusy) { } + Write-Host "Download complete. Target Location: '$targetLocation'" + return $targetLocation +} + +function Extract-Zip +{ + [CmdletBinding()] + Param( + [Parameter( + Mandatory = $true + )] + [string] + $ZipFilePath, + + [Parameter( + Mandatory = $true + )] + [string] + $TargetLocation + ) + + Write-Host "Expanding the Zip File: '$ZipFilePath'. Target: '$TargetLocation'" + $null = [System.IO.Compression.ZipFile]::ExtractToDirectory($ZipFilePath, $TargetLocation) + Write-Host "Extraction completed successfully." +} + +Set-PSRepository -InstallationPolicy Trusted -Name PSGallery + +# We try to detect the whether Azure PowerShell is installed using .msi file. If it is installed, we find it's version, then it needs to be uninstalled manually (because the uninstallation requires the PowerShell session to be closed) +$regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" +$installedApplications = Get-ItemProperty -Path $regKey +$SdkVersion = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("microsoft azure powershell") } | Select-Object -First 1).DisplayVersion + +if($SdkVersion -eq $null) +{ + Write-Host "No .msi Installation Present" +} +else +{ + Write-Host "An Azure PowerShell Installation through installer has been detected. Please close this powershell session and manually uninstall the Azure PowerShell from the Add or Remove Programs in the Control Panel. Then, rerun this script from an Admin PowerShell" + throw "An Azure PowerShell Installation through installer has been detected. Please close this powershell session and manually uninstall the Azure PowerShell from the Add or Remove Programs in the Control Panel. Then, rerun this script from an Admin PowerShell" +} + +# We will try to uninstall any installation of Azure PowerShell + +$modules = Get-Module -Name Azure -ListAvailable +Write-Host "The Azure Modules initially present are:" +$modules | Select-Object Name,Version,Path | Format-Table + +foreach($module in $modules) +{ + # add logging for telling what module we are working on now + if(Test-Path -LiteralPath $module.Path) + { + try + { + Uninstall-Module -Name Azure -RequiredVersion $module.Version.tostring() -Force + } + catch + { + Write-Host "The Uninstallation of Azure Module version: $($module.Version.tostring()) failed with the error: $($_.Exception.Message) . Please Check if there isn't any other PowerShell session open." + throw $_.Exception.Message + } + } +} + +$modules = Get-Module -Name AzureRM -ListAvailable +Write-Host "The AzureRM Modules initially present are:" +$modules | Select-Object Name,Version,Path | Format-Table + +foreach($module in $modules) +{ + # add logging for telling what module we are working on now + if(Test-Path -LiteralPath $module.Path) + { + try + { + Uninstall-Module -Name AzureRM -RequiredVersion $module.Version.tostring() -Force + } + catch + { + Write-Host "The Uninstallation of AzureRM Module version: $($module.Version.tostring()) failed with the error: $($_.Exception.Message) . Please Check if there isn't any other PowerShell session open." + throw $_.Exception.Message + } + } +} + +#after this, the only installations available through a Get-Module cmdlet should be nothing + +$modules = Get-Module -Name Azure -ListAvailable + +foreach($module in $modules) +{ + Write-Host "Module found: $($module.Name) Module Version: $($module.Version)" + if($module.Version.ToString() -ne " ") + { + Write-Host "Another installation of Azure module is detected with version $($module.Version.ToString()) at path: $($module.Path)" + throw "Azure module uninstallation unsuccessful" + } +} + +$modules = Get-Module -Name AzureRM -ListAvailable + +foreach($module in $modules) +{ + write-host "Module found: $($module.Name) Module Version: $($module.Version)" + if($module.Version.ToString() -ne " ") + { + Write-Host "Another installation of AzureRM module is detected with version $($module.Version.ToString()) at path: $($module.Path)" + throw "AzureRM module uninstallation unsuccessful" + } +} + +#### NOW The correct Modules need to be saved in C:\Modules + +if($(Test-Path -LiteralPath "C:\Modules") -eq $true) +{ + Write-Host "C:\Modules directory is already present. Beginning to clear it up completely" + Remove-Item -Path "C:\Modules" -Recurse -Force +} + +mkdir "C:\Modules" + +$directoryListing = Get-ChildItem -Path "C:\Modules" + +if($directoryListing.Length -gt 0) +{ + Write-Host "C:\Modules was not deleted properly. It still has the following contents:" + $directoryListing +} +else { + Write-Host "The Directory is clean. There are no contents present in it" +} + +# Download and unzip the stored AzurePSModules from the vstsagentools public blob +$extractLocation = "C:\Modules" +$azurePsUri = @( + "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/AzurePSModules.M157.20190808.27979.zip", + "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/AzureRmPSModules.M157.20190808.27379.zip", + "https://vstsagenttools.blob.core.windows.net/tools/azurepowershellmodules/AzPSModules.M158.20190903.19326.zip" +) + +$azureRMModulePath = "C:\Modules\azurerm_2.1.0" +$azureModulePath = "C:\Modules\azure_2.1.0" +$finalPath = "" +$environmentPSModulePath = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine") +$existingPaths = $environmentPSModulePath -split ';' -replace '\\$','' + +if ($existingPaths -notcontains $azureRMModulePath) { + $finalPath = $azureRMModulePath +} + +if ($existingPaths -notcontains $azureModulePath) { + if($finalPath -ne "") { + $finalPath = $finalPath + ";" + $azureModulePath + } + else { + $finalPath = $azureModulePath + } +} + +if($finalPath -ne "") { + [Environment]::SetEnvironmentVariable("PSModulePath", $finalPath + ";" + $env:PSModulePath, "Machine") +} + +$env:PSModulePath = $env:PSModulePath.TrimStart(';') + +foreach ($uri in $azurePsUri) +{ + $targetFile = Download-Zip -BlobUri $uri + Extract-Zip -ZipFilePath $targetFile -TargetLocation $extractLocation +} diff --git a/images/win/scripts/Installers/Install-Boost.ps1 b/images/win/scripts/Installers/Install-Boost.ps1 new file mode 100644 index 000000000..58be0ab68 --- /dev/null +++ b/images/win/scripts/Installers/Install-Boost.ps1 @@ -0,0 +1,45 @@ +################################################################################ +## File: Install-Boost.ps1 +## Desc: Install boost using tool cache +################################################################################ + +$ToolCache = 'C:\hostedtoolcache\windows\boost' +$BoostDirectory = Join-Path -Path $env:ProgramFiles -ChildPath "Boost" +$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(',') +$BoostDefault = $env:BOOST_DEFAULT + +foreach($BoostVersion in $BoostVersionsToInstall) +{ + $ZipName = Join-Path -Path $ToolCache -ChildPath "boost_${BoostVersion}_msvc-14.1.zip" + + if (-Not (Test-Path $ZipName)) + { + Write-Host "$ZipName not found" + exit 1 + } + + Write-Host "Expanding $ZipName" + + $BoostInstallationDir = Join-Path -Path $BoostDirectory -ChildPath $BoostVersion + # Expand-Archive slower for 70% than 7z + & "$env:ProgramFiles\7-Zip\7z.exe" x $ZipName -o"$BoostDirectory" -y + + $EnvBoostPath = "BOOST_ROOT_{0}" -f ($BoostVersion.Replace('.', '_')) + setx $EnvBoostPath $BoostInstallationDir /M | Out-Null + + if ($BoostVersion -eq $BoostDefault) + { + Write-Host "Adding Boost $BoostVersion to the path..." + # Add the Boost binaries to the path + Add-MachinePathItem $BoostInstallationDir | Out-Null + # Set the BOOSTROOT environment variable + setx BOOST_ROOT $BoostInstallationDir /M | Out-Null + } +} + +# Removing boost cache folder +Write-Host "Removing boost cache folder" +if (Test-Path $ToolCache) +{ + Remove-Item -Path $ToolCache -Force -Recurse +} diff --git a/images/win/scripts/Installers/Install-Chrome.ps1 b/images/win/scripts/Installers/Install-Chrome.ps1 new file mode 100644 index 000000000..32f3bcf16 --- /dev/null +++ b/images/win/scripts/Installers/Install-Chrome.ps1 @@ -0,0 +1,26 @@ +################################################################################ +## File: Install-Chrome.ps1 +## Desc: Install Google Chrome +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$temp_install_dir = 'C:\Windows\Installer' +New-Item -Path $temp_install_dir -ItemType Directory -Force + +Install-MSI -MsiUrl "https://seleniumwebdrivers.blob.core.windows.net/knownchromeversion/googlechromestandaloneenterprise64.msi" -MsiName "googlechromestandaloneenterprise64.msi" + +New-NetFirewallRule -DisplayName "BlockGoogleUpdate" -Direction Outbound -Action Block -Program "C:\Program Files (x86)\Google\Update\GoogleUpdate.exe" + +Stop-Service -Name gupdate -Force +Set-Service -Name gupdate -StartupType "Disabled" +Stop-Service -Name gupdatem -Force +Set-Service -Name gupdatem -StartupType "Disabled" + +New-Item -Path "HKLM:\SOFTWARE\Policies\Google\Update" -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "AutoUpdateCheckPeriodMinutes" -Value 00000000 -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "UpdateDefault" -Value 00000000 -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "DisableAutoUpdateChecksCheckboxValue" -Value 00000001 -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Update" -Name "Update{8A69D345-D564-463C-AFF1-A69D9E530F96}" -Value 00000000 -Force +New-Item -Path "HKLM:\SOFTWARE\Policies\Google\Chrome" -Force +New-ItemProperty "HKLM:\SOFTWARE\Policies\Google\Chrome" -Name "DefaultBrowserSettingEnabled" -Value 00000000 -Force diff --git a/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 new file mode 100644 index 000000000..b8e5bc4c2 --- /dev/null +++ b/images/win/scripts/Installers/Install-CloudFoundryCli.ps1 @@ -0,0 +1,24 @@ +################################################################################ +## File: Install-CloudFoundryCli.ps1 +## Desc: Install Cloud Foundry CLI +################################################################################ + +Import-Module -Name ImageHelpers + +# Download the latest cf cli exe +Invoke-WebRequest -UseBasicParsing -Uri "https://packages.cloudfoundry.org/stable?release=windows64-exe&source=github" -OutFile cf-cli.zip + +# Create directory for cf cli +$cf_cli_path = "C:\cf-cli" +New-Item -Path $cf_cli_path -ItemType Directory -Force + +# Extract the zip archive +Write-Host "Extracting cf cli..." +Expand-Archive -Path cf-cli.zip -DestinationPath $cf_cli_path -Force + +# Add cf to path +Add-MachinePathItem $cf_cli_path + +# Delete the cfl-cli zip archive +Write-Host "Deleting downloaded archive of cf cli" +Remove-Item cf-cli.zip diff --git a/images/win/scripts/Installers/Install-Cmake.ps1 b/images/win/scripts/Installers/Install-Cmake.ps1 new file mode 100644 index 000000000..c0d2f4b41 --- /dev/null +++ b/images/win/scripts/Installers/Install-Cmake.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-Cmake.ps1 +## Desc: Install Cmake +################################################################################ + +choco install cmake.install -y --installargs 'ADD_CMAKE_TO_PATH=""System""' diff --git a/images/win/scripts/Installers/Install-ContainersFeature.ps1 b/images/win/scripts/Installers/Install-ContainersFeature.ps1 new file mode 100644 index 000000000..0713f6060 --- /dev/null +++ b/images/win/scripts/Installers/Install-ContainersFeature.ps1 @@ -0,0 +1,16 @@ +################################################################################ +## File: Install-ContainersFeature.ps1 +## Desc: Install Windows container features. +## Must be an independent step becuase it requires a machine restart +## before we can continue. +################################################################################ + +Write-Host "Install Containers feature" +Install-WindowsFeature -Name Containers + +if ((GWMI Win32_Processor).VirtualizationFirmwareEnabled[0] -and (GWMI Win32_Processor).SecondLevelAddressTranslationExtensions[0]) { + Write-Host "Install Hyper-V feature" + Install-WindowsFeature -Name Hyper-V -IncludeManagementTools +} else { + Write-Host "Skipping installation of Hyper-V feature" +} diff --git a/images/win/scripts/Installers/Install-DACFx.ps1 b/images/win/scripts/Installers/Install-DACFx.ps1 new file mode 100644 index 000000000..d494f12c4 --- /dev/null +++ b/images/win/scripts/Installers/Install-DACFx.ps1 @@ -0,0 +1,10 @@ +#################################################################################### +## File: Install-DACFx.ps1 +## Desc: Install SQL Server® Data-Tier Application Framework (DACFx) for Windows +#################################################################################### + +Import-Module -Name ImageHelpers -Force + +$exitcode = Install-MSI -MsiUrl "https://download.microsoft.com/download/f/1/9/f19eaee6-0728-4a0b-9755-9808acc8af0b/EN/x64/DacFramework.msi" -MsiName "DacFramework.msi" + +exit $exitcode diff --git a/images/win/scripts/Installers/Install-Docker.ps1 b/images/win/scripts/Installers/Install-Docker.ps1 new file mode 100644 index 000000000..59df7c4a0 --- /dev/null +++ b/images/win/scripts/Installers/Install-Docker.ps1 @@ -0,0 +1,16 @@ +################################################################################ +## File: Install-Docker.ps1 +## Desc: Install Docker. +## Must be an independent step becuase it requires a restart before we +## can continue. +################################################################################ + +Set-PSRepository -InstallationPolicy Trusted -Name PSGallery +Write-Host "Install-Module DockerProvider" +Install-Module DockerMsftProvider -Force + +Write-Host "Install-Package Docker" +Install-Package -Name docker -ProviderName DockerMsftProvider -Force +Start-Service docker + +choco install docker-compose -y diff --git a/images/win/scripts/Installers/Install-DotnetSDK.ps1 b/images/win/scripts/Installers/Install-DotnetSDK.ps1 new file mode 100644 index 000000000..45169adf3 --- /dev/null +++ b/images/win/scripts/Installers/Install-DotnetSDK.ps1 @@ -0,0 +1,113 @@ +################################################################################ +## File: Install-DotnetSDK.ps1 +## Desc: Install all released versions of the dotnet sdk and populate package +## cache. Should run after VS and Node +################################################################################ + +# ensure temp +New-Item -Path C:\Temp -Force -ItemType Directory + +[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" + +$templates = @( + 'console', + 'mstest', + 'web', + 'mvc', + 'webapi' +) + +function InstallSDKVersion ( + $sdkVersion +) +{ + if (!(Test-Path -Path "C:\Program Files\dotnet\sdk\$sdkVersion")) + { + Write-Host "Installing dotnet $sdkVersion" + .\dotnet-install.ps1 -Architecture x64 -Version $sdkVersion -InstallDir $(Join-Path -Path $env:ProgramFiles -ChildPath 'dotnet') + } + else + { + Write-Host "Sdk version $sdkVersion already installed" + } + + # Fix for issue 1276. This will be fixed in 3.1. + Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/sdk/82bc30c99f1325dfaa7ad450be96857a4fca2845/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.ImportPublishProfile.targets" -outfile "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportPublishProfile.targets" + + # warm up dotnet for first time experience + $templates | ForEach-Object { + $template = $_ + $projectPath = Join-Path -Path C:\temp -ChildPath $template + New-Item -Path $projectPath -Force -ItemType Directory + Push-Location -Path $projectPath + & $env:ProgramFiles\dotnet\dotnet.exe new globaljson --sdk-version "$sdkVersion" + & $env:ProgramFiles\dotnet\dotnet.exe new $template + Pop-Location + Remove-Item $projectPath -Force -Recurse + } +} + +function InstallAllValidSdks() +{ + Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json' -UseBasicParsing -OutFile 'releases-index.json' + $dotnetChannels = Get-Content -Path 'releases-index.json' | ConvertFrom-Json + + # Consider all channels except preview/eol channels. + # Sort the channels in ascending order + $dotnetChannels = $dotnetChannels.'releases-index' | Where-Object { !$_."support-phase".Equals('preview') -and !$_."support-phase".Equals('eol') } | Sort-Object { [Version] $_."channel-version" } + + # Download installation script. + Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile 'dotnet-install.ps1' + + ForEach ($dotnetChannel in $dotnetChannels) + { + $channelVersion = $dotnetChannel.'channel-version'; + Invoke-WebRequest -Uri $dotnetChannel.'releases.json' -UseBasicParsing -OutFile "releases-$channelVersion.json" + $currentReleases = Get-Content -Path "releases-$channelVersion.json" | ConvertFrom-Json + # filtering out the preview/rc releases + $currentReleases = $currentReleases.'releases' | Where-Object { !$_.'release-version'.Contains('-') } | Sort-Object { [Version] $_.'release-version' } + ForEach ($release in $currentReleases) + { + if ($release.'sdks'.Count -gt 0) + { + Write-Host 'Found sdks property in release: ' + $release.'release-version' + 'with sdks count: ' + $release.'sdks'.Count + + + # Remove duplicate entries & preview/rc version from download list + # Sort the sdks on version + $sdks = @($release.'sdk'); + $sdks += $release.'sdks' | Where-Object { !$_.'version'.Contains('-') -and !$_.'version'.Equals($release.'sdk'.'version') } + $sdks = $sdks | Sort-Object { [Version] $_.'version' } + + ForEach ($sdk in $sdks) + { + InstallSDKVersion -sdkVersion $sdk.'version' + } + } + elseif (!$release.'sdk'.'version'.Contains('-')) + { + $sdkVersion = $release.'sdk'.'version' + InstallSDKVersion -sdkVersion $sdkVersion + } + } + } +} + +function RunPostInstallationSteps() +{ + Add-MachinePathItem "C:\Program Files\dotnet" + # Run script at startup for all users + $cmdDotNetPath = @" +@echo off +SETX PATH "%USERPROFILE%\.dotnet\tools;%PATH%" +"@ + + $cmdPath = "C:\Program Files\dotnet\userpath.bat" + $cmdDotNetPath | Out-File -Encoding ascii -FilePath $cmdPath + + # Update Run key to run a script at logon + Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "DOTNETUSERPATH" -Value $cmdPath +} + +InstallAllValidSdks +RunPostInstallationSteps diff --git a/images/win/scripts/Installers/Install-Firefox.ps1 b/images/win/scripts/Installers/Install-Firefox.ps1 new file mode 100644 index 000000000..4493beaf0 --- /dev/null +++ b/images/win/scripts/Installers/Install-Firefox.ps1 @@ -0,0 +1,20 @@ +################################################################################ +## File: Install-Firefox.ps1 +## Desc: Install Mozilla Firefox +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$temp_install_dir = 'C:\Windows\Installer' +New-Item -Path $temp_install_dir -ItemType Directory -Force + +Install-EXE -Url "https://seleniumwebdrivers.blob.core.windows.net/knownfirefoxversion/FirefoxSetup.exe" -Name "FirefoxSetup.exe" -ArgumentList "-ms" + +$path = '{0}\Program Files\Mozilla Firefox\' -f $env:SystemDrive; +New-Item -path $path -Name 'mozilla.cfg' -Value '// +pref("browser.shell.checkDefaultBrowser", false); +pref("app.update.enabled", false);' -ItemType file -force + +$path = '{0}\Program Files\Mozilla Firefox\defaults\pref\' -f $env:SystemDrive; +New-Item -path $path -Name 'local-settings.js' -Value 'pref("general.config.obscure_value", 0); +pref("general.config.filename", "mozilla.cfg");' -ItemType file -force diff --git a/images/win/scripts/Installers/Install-Git.ps1 b/images/win/scripts/Installers/Install-Git.ps1 new file mode 100644 index 000000000..39cc5c6d2 --- /dev/null +++ b/images/win/scripts/Installers/Install-Git.ps1 @@ -0,0 +1,18 @@ +################################################################################ +## File: Install-Git.ps1 +## Desc: Install Git for Windows +################################################################################ + +Import-Module -Name ImageHelpers + +# Install the latest version of Git which is bundled with Git LFS. +# See https://chocolatey.org/packages/git +choco install git -y --package-parameters="/GitAndUnixToolsOnPath /WindowsTerminal /NoShellIntegration" + +# Disable GCM machine-wide +[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine) + +Add-MachinePathItem "C:\Program Files\Git\mingw64\bin" +Add-MachinePathItem "C:\Program Files\Git\usr\bin" +Add-MachinePathItem "C:\Program Files\Git\bin" +exit 0 diff --git a/images/win/scripts/Installers/Install-GitVersion.ps1 b/images/win/scripts/Installers/Install-GitVersion.ps1 new file mode 100644 index 000000000..a02e1b8cb --- /dev/null +++ b/images/win/scripts/Installers/Install-GitVersion.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-GitVersion.ps1 +## Desc: Install GitVersion +################################################################################ + +choco install gitversion.portable -y diff --git a/images/win/scripts/Installers/Install-Go.ps1 b/images/win/scripts/Installers/Install-Go.ps1 new file mode 100644 index 000000000..63250e34c --- /dev/null +++ b/images/win/scripts/Installers/Install-Go.ps1 @@ -0,0 +1,71 @@ +################################################################################ +## File: Install-Go.ps1 +## Desc: Install Go +################################################################################ + +Import-Module -Name ImageHelpers -Force + +function Install-GoVersion +{ + Param + ( + [String]$goVersion, + [Switch]$addToDefaultPath + ) + + # Download the Go zip archive. + Write-Host "Downloading Go $goVersion..." + $ProgressPreference = 'SilentlyContinue' + Invoke-WebRequest -UseBasicParsing -Uri "https://dl.google.com/go/go$goVersion.windows-amd64.zip" -OutFile go$goVersion.windows-amd64.zip + + # Extract the zip archive. It contains a single directory named "go". + Write-Host "Extracting Go $goVersion..." + Expand-Archive -Path go$goVersion.windows-amd64.zip -DestinationPath "C:\" -Force + + # Delete unnecessary files to conserve space + Write-Host "Cleaning directories of Go $goVersion..." + if (Test-Path "C:\go\doc") + { + Remove-Item -Recurse -Force "C:\go\doc" + } + if (Test-Path "C:\go\blog") + { + Remove-Item -Recurse -Force "C:\go\blog" + } + + # Rename the extracted "go" directory to include the Go version number (to support side-by-side versions of Go). + $newDirName = "Go$goVersion" + Rename-Item -path "C:\go" -newName $newDirName + + # Delete the Go zip archive. + Write-Host "Deleting downloaded archive of Go $goVersion..." + Remove-Item go$goVersion.windows-a`md64.zip + + # Make this the default version of Go? + if ($addToDefaultPath) + { + Write-Host "Adding Go $goVersion to the path..." + # Add the Go binaries to the path. + Add-MachinePathItem "C:\$newDirName\bin" | Out-Null + # Set the GOROOT environment variable. + setx GOROOT "C:\$newDirName" /M | Out-Null + } + + # Done + Write-Host "Done installing Go $goVersion." + return "C:\$newDirName" +} + +# Install Go +$goVersionsToInstall = $env:GO_VERSIONS.split(",") + +foreach($go in $goVersionsToInstall) { + Write-Host "Installing Go ${go}" + if($go -eq $env:GO_DEFAULT) { + $installDirectory = Install-GoVersion -goVersion $go -addToDefaultPath + } else { + $installDirectory = Install-GoVersion -goVersion $go + } + $envName = "GOROOT_{0}_{1}_X64" -f $go.split(".") + setx $envName "$installDirectory" /M +} diff --git a/images/win/scripts/Installers/Install-InnoSetup.ps1 b/images/win/scripts/Installers/Install-InnoSetup.ps1 new file mode 100644 index 000000000..35f0156f4 --- /dev/null +++ b/images/win/scripts/Installers/Install-InnoSetup.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-InnoSetup.ps1 +## Desc: Install Inno Setup +################################################################################ + +choco install innosetup -y diff --git a/images/win/scripts/Installers/Install-JavaTools.ps1 b/images/win/scripts/Installers/Install-JavaTools.ps1 new file mode 100644 index 000000000..d86f42c7b --- /dev/null +++ b/images/win/scripts/Installers/Install-JavaTools.ps1 @@ -0,0 +1,98 @@ +################################################################################ +## File: Install-JavaTools.ps1 +## Desc: Install various JDKs and java tools +################################################################################ + +# Download the Azul Systems Zulu JDKs +# See https://www.azul.com/downloads/azure-only/zulu/ +$azulJDK7Uri = 'https://repos.azul.com/azure-only/zulu/packages/zulu-7/7u232/zulu-7-azure-jdk_7.31.0.5-7.0.232-win_x64.zip' +$azulJDK8Uri = 'https://repos.azul.com/azure-only/zulu/packages/zulu-8/8u222/zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64.zip' +$azulJDK11Uri = 'https://repos.azul.com/azure-only/zulu/packages/zulu-11/11.0.4/zulu-11-azure-jdk_11.33.15-11.0.4-win_x64.zip' + +cd $env:TEMP + +Invoke-WebRequest -UseBasicParsing -Uri $azulJDK7Uri -OutFile azulJDK7.zip +Invoke-WebRequest -UseBasicParsing -Uri $azulJDK8Uri -OutFile azulJDK8.zip +Invoke-WebRequest -UseBasicParsing -Uri $azulJDK11Uri -OutFile azulJDK11.zip + +# Expand the zips +Expand-Archive -Path azulJDK7.zip -DestinationPath "C:\Program Files\Java\" -Force +Expand-Archive -Path azulJDK8.zip -DestinationPath "C:\Program Files\Java\" -Force +Expand-Archive -Path azulJDK11.zip -DestinationPath "C:\Program Files\Java\" -Force + +# Deleting zip folders +Remove-Item -Recurse -Force azulJDK7.zip +Remove-Item -Recurse -Force azulJDK8.zip +Remove-Item -Recurse -Force azulJDK11.zip + +Import-Module -Name ImageHelpers -Force + +$currentPath = Get-MachinePath + +$pathSegments = $currentPath.Split(';') +$newPathSegments = @() + +foreach ($pathSegment in $pathSegments) +{ + if($pathSegment -notlike '*java*') + { + $newPathSegments += $pathSegment + } +} + +$java7Installs = Get-ChildItem -Path 'C:\Program Files\Java' -Filter '*azure-jdk*7*' | Sort-Object -Property Name -Descending | Select-Object -First 1 +$latestJava7Install = $java7Installs.FullName; + +$java8Installs = Get-ChildItem -Path 'C:\Program Files\Java' -Filter '*azure-jdk*8*' | Sort-Object -Property Name -Descending | Select-Object -First 1 +$latestJava8Install = $java8Installs.FullName; + +$java11Installs = Get-ChildItem -Path 'C:\Program Files\Java' -Filter '*azure-jdk*11*' | Sort-Object -Property Name -Descending | Select-Object -First 1 +$latestJava11Install = $java11Installs.FullName; + +$newPath = [string]::Join(';', $newPathSegments) +$newPath = $latestJava8Install + '\bin;' + $newPath + +Set-MachinePath -NewPath $newPath + +setx JAVA_HOME $latestJava8Install /M +setx JAVA_HOME_7_X64 $latestJava7Install /M +setx JAVA_HOME_8_X64 $latestJava8Install /M +setx JAVA_HOME_11_X64 $latestJava11Install /M + +# Install Java tools +# Force chocolatey to ignore dependencies on Ant and Maven or else they will download the Oracle JDK +choco install ant -y -i +choco install maven -y -i --version=3.6.2 +choco install gradle -y + +# Move maven variables to Machine. They may not be in the environment for this script so we need to read them from the registry. +$userSid = (Get-WmiObject win32_useraccount -Filter "name = '$env:USERNAME' AND domain = '$env:USERDOMAIN'").SID +$userEnvironmentKey = 'Registry::HKEY_USERS\' + $userSid + '\Environment' + +$m2_home = (Get-ItemProperty -Path $userEnvironmentKey -Name M2_HOME).M2_HOME +$m2 = $m2_home + '\bin' +$maven_opts = '-Xms256m' + +$m2_repo = 'C:\ProgramData\m2' +New-Item -Path $m2_repo -ItemType Directory -Force + +setx M2 $m2 /M +setx M2_HOME $m2_home /M +setx M2_REPO $m2_repo /M +setx MAVEN_OPTS $maven_opts /M + +# Download cobertura jars +$uri = 'https://ayera.dl.sourceforge.net/project/cobertura/cobertura/2.1.1/cobertura-2.1.1-bin.zip' +$coberturaPath = "C:\cobertura-2.1.1" + +cd $env:TEMP + +Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile cobertura.zip + +# Expand the zip +Expand-Archive -Path cobertura.zip -DestinationPath "C:\" -Force + +# Deleting zip folder +Remove-Item -Recurse -Force cobertura.zip + +setx COBERTURA_HOME $coberturaPath /M diff --git a/images/win/scripts/Installers/Install-Jq.ps1 b/images/win/scripts/Installers/Install-Jq.ps1 new file mode 100644 index 000000000..5a0af2e3d --- /dev/null +++ b/images/win/scripts/Installers/Install-Jq.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-Jq.ps1 +## Desc: Install jq +################################################################################ + +choco install jq -y diff --git a/images/win/scripts/Installers/Install-Kind.ps1 b/images/win/scripts/Installers/Install-Kind.ps1 new file mode 100644 index 000000000..794a6d9a8 --- /dev/null +++ b/images/win/scripts/Installers/Install-Kind.ps1 @@ -0,0 +1,40 @@ +################################################################################ +## File: Install-Kind.ps1 +## Desc: Install Kind +################################################################################ + +$stableKindTag = "v0.5.1" +$tagToUse = $stableKindTag; +$destFilePath = "C:\ProgramData\kind" +$outFilePath = "C:\ProgramData\kind\kind.exe" + +try +{ + $getkindUri = "https://github.com/kubernetes-sigs/kind/releases/download/$tagToUse/kind-windows-amd64" + Write-Host "Downloading kind.exe..." + New-Item -Path $destFilePath -ItemType Directory -Force + + Invoke-WebRequest -Uri $getkindUri -OutFile $outFilePath + + Write-Host "Starting Install kind.exe..." + $process = Start-Process -FilePath $outFilePath -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + Add-MachinePathItem $destFilePath + exit $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + exit $exitCode + } +} +catch +{ + Write-Host -Object "Failed to install the Executable kind.exe" + Write-Host -Object $_.Exception.Message + exit -1 +} diff --git a/images/win/scripts/Installers/Install-KubernetesCli.ps1 b/images/win/scripts/Installers/Install-KubernetesCli.ps1 new file mode 100644 index 000000000..d96c7d798 --- /dev/null +++ b/images/win/scripts/Installers/Install-KubernetesCli.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-KubernetesCli.ps1 +## Desc: Install KubernetesCli +################################################################################ + +choco install kubernetes-cli -y diff --git a/images/win/scripts/Installers/Install-Mercurial.ps1 b/images/win/scripts/Installers/Install-Mercurial.ps1 new file mode 100644 index 000000000..9f21d97a6 --- /dev/null +++ b/images/win/scripts/Installers/Install-Mercurial.ps1 @@ -0,0 +1,10 @@ +################################################################################ +## File: Install-Mercurial.ps1 +## Desc: Install Mercurial +################################################################################ + +choco install hg -y --version 5.0.0 + +$hgPath = "${env:ProgramFiles}\Mercurial\" +Add-MachinePathItem $hgPath +$env:Path = Get-MachinePath diff --git a/images/win/scripts/Installers/Install-MinGW.ps1 b/images/win/scripts/Installers/Install-MinGW.ps1 new file mode 100644 index 000000000..5e73d0592 --- /dev/null +++ b/images/win/scripts/Installers/Install-MinGW.ps1 @@ -0,0 +1,13 @@ +################################################################################ +## File: Install-MinGW.ps1 +## Desc: Install GNU tools for Windows to C:\tools\mingw64 +################################################################################ + +Import-Module -Name ImageHelpers -Force + +choco install -y mingw + +# Make a copy of mingw32-make.exe to make.exe, which is a more discoverable name +# and so the same command line can be used on Windows as on macOS and Linux +$path = where.exe mingw32-make.exe | Get-Item +Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe') diff --git a/images/win/scripts/Installers/Install-Miniconda.ps1 b/images/win/scripts/Installers/Install-Miniconda.ps1 new file mode 100644 index 000000000..14c5df76c --- /dev/null +++ b/images/win/scripts/Installers/Install-Miniconda.ps1 @@ -0,0 +1,16 @@ +################################################################################ +## File: Install-Miniconda.ps1 +## Desc: Install the latest version of Miniconda and set $env:CONDA +################################################################################ + +Import-Module -Name ImageHelpers -Force + +# Lock to Miniconda 4.6 until we do the work to run `conda init` for the vsts user +# Then we can go back to installing the latest Miniconda +# $url = "https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe" +$url = "https://repo.continuum.io/miniconda/Miniconda3-4.6.14-Windows-x86_64.exe" +$name = $Url.Split('/')[-1] +$destination = "C:\Miniconda" + +Install-EXE -Url $url -Name $name -ArgumentList "/S /AddToPath=0 /RegisterPython=0 /D=$destination" +Set-SystemVariable -SystemVariable "CONDA" -Value $destination diff --git a/images/win/scripts/Installers/Install-MysqlCli.ps1 b/images/win/scripts/Installers/Install-MysqlCli.ps1 new file mode 100644 index 000000000..e3507581b --- /dev/null +++ b/images/win/scripts/Installers/Install-MysqlCli.ps1 @@ -0,0 +1,39 @@ +################################################################################ +## File: Install-MysqlCli.ps1 +## Desc: Install Mysql CLI +################################################################################ + + +## Downloading mysql jar +$uri = 'https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-winx64.zip' +$mysqlPath = 'C:\mysql-5.7.21-winx64\bin' + +# Installing visual c++ redistibutable package. +$InstallerURI = 'https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x64.exe' +$InstallerName = 'vcredist_x64.exe' +$ArgumentList = ('/install', '/quiet', '/norestart' ) + +$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList +if ($exitCode -eq 0 -or $exitCode -eq 3010) +{ + # MySQL disabled TLS 1.0 support on or about Jul-14-2018. Need to make sure TLS 1.2 is enabled. + [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" + + # Get the latest mysql command line tools . + Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile mysql.zip + + # Expand the zip + Expand-Archive -Path mysql.zip -DestinationPath "C:\" -Force + + # Deleting zip folder + Remove-Item -Recurse -Force mysql.zip + + # Adding mysql in system environment path + Add-MachinePathItem $mysqlPath + + return 0; +} +else +{ + return $exitCode; +} diff --git a/images/win/scripts/Installers/Install-NET48.ps1 b/images/win/scripts/Installers/Install-NET48.ps1 new file mode 100644 index 000000000..8a21e85dd --- /dev/null +++ b/images/win/scripts/Installers/Install-NET48.ps1 @@ -0,0 +1,13 @@ +################################################################################ +## File: Install-NET48.ps1 +## Desc: Install .NET 4.8 +################################################################################ + +Import-Module -Name ImageHelpers -Force + +# .NET 4.8 Dev pack +$InstallerURI = "https://download.visualstudio.microsoft.com/download/pr/7afca223-55d2-470a-8edc-6a1739ae3252/c8c829444416e811be84c5765ede6148/NDP48-DevPack-ENU.exe" +$InstallerName = "NDP48-DevPack-ENU.exe" +$ArgumentList = ('Setup', '/passive', '/norestart' ) + +Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList diff --git a/images/win/scripts/Installers/Install-NSIS.ps1 b/images/win/scripts/Installers/Install-NSIS.ps1 new file mode 100644 index 000000000..6da7cb738 --- /dev/null +++ b/images/win/scripts/Installers/Install-NSIS.ps1 @@ -0,0 +1,10 @@ +################################################################################ +## File: Install-NSIS.ps1 +## Desc: Install NSIS +################################################################################ + +choco install nsis -y + +$NsisPath = "${env:ProgramFiles(x86)}\NSIS\" +Add-MachinePathItem $NsisPath +$env:Path = Get-MachinePath diff --git a/images/win/scripts/Installers/Install-NodeLts.ps1 b/images/win/scripts/Installers/Install-NodeLts.ps1 new file mode 100644 index 000000000..9318b73b1 --- /dev/null +++ b/images/win/scripts/Installers/Install-NodeLts.ps1 @@ -0,0 +1,34 @@ +################################################################################ +## File: Install-NodeLts.ps1 +## Desc: Install nodejs-lts and other common node tools. +## Must run after python is configured +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$PrefixPath = 'C:\npm\prefix' +$CachePath = 'C:\npm\cache' + +New-Item -Path $PrefixPath -Force -ItemType Directory +New-Item -Path $CachePath -Force -ItemType Directory + +choco install nodejs-lts -y --force + +Add-MachinePathItem $PrefixPath +$env:Path = Get-MachinePath + +setx NPM_CONFIG_PREFIX $PrefixPath /M +$env:NPM_CONFIG_PREFIX = $PrefixPath + +setx NPM_CONFIG_CACHE $CachePath /M +$env:NPM_CONFIG_CACHE = $CachePath + +npm config set registry http://registry.npmjs.org/ + +npm install -g bower +npm install -g cordova +npm install -g grunt-cli +npm install -g gulp-cli +npm install -g parcel-bundler +npm install -g --save-dev webpack webpack-cli +npm install -g yarn diff --git a/images/win/scripts/Installers/Install-OpenSSL.ps1 b/images/win/scripts/Installers/Install-OpenSSL.ps1 new file mode 100644 index 000000000..43cb28f9b --- /dev/null +++ b/images/win/scripts/Installers/Install-OpenSSL.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-OpenSSL.ps1 +## Desc: Install OpenSSL +################################################################################ + +choco install openssl.light -y diff --git a/images/win/scripts/Installers/Install-PHP.ps1 b/images/win/scripts/Installers/Install-PHP.ps1 new file mode 100644 index 000000000..6221b022e --- /dev/null +++ b/images/win/scripts/Installers/Install-PHP.ps1 @@ -0,0 +1,20 @@ +################################################################################ +## File: Install-PHP.ps1 +## Desc: Install PHP +################################################################################ +$ErrorActionPreference = "Stop" + +Import-Module -Name ImageHelpers + +# Install latest PHP in chocolatey +$installDir = "c:\tools\php" +choco install php -y --force --params "/InstallDir:$installDir" + +# update path to extensions and enable curl and mbstring extensions +((Get-Content -path $installDir\php.ini -Raw) -replace ';extension=curl','extension=curl' -replace ';extension=mbstring','extension=mbstring' -replace ';extension_dir = "ext"','extension_dir = "ext"') | Set-Content -Path $installDir\php.ini + +# Set the PHPROOT environment variable. +setx PHPROOT $installDir /M + +# Done +exit 0 diff --git a/images/win/scripts/Installers/Install-Perl.ps1 b/images/win/scripts/Installers/Install-Perl.ps1 new file mode 100644 index 000000000..86f2d2902 --- /dev/null +++ b/images/win/scripts/Installers/Install-Perl.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-Perl.ps1 +## Desc: Install Perl +################################################################################ + +choco install strawberryperl -y diff --git a/images/win/scripts/Installers/Install-PowershellCore.ps1 b/images/win/scripts/Installers/Install-PowershellCore.ps1 new file mode 100644 index 000000000..1fc757081 --- /dev/null +++ b/images/win/scripts/Installers/Install-PowershellCore.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-PowershellCore.ps1 +## Desc: Install PowerShell Core +################################################################################ + +Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI -Quiet" diff --git a/images/win/scripts/Installers/Install-Ruby.ps1 b/images/win/scripts/Installers/Install-Ruby.ps1 new file mode 100644 index 000000000..184d92afa --- /dev/null +++ b/images/win/scripts/Installers/Install-Ruby.ps1 @@ -0,0 +1,20 @@ +################################################################################ +## File: Install-Ruby.ps1 +## Desc: Install Ruby for Windows +################################################################################ + +Import-Module -Name ImageHelpers + +# Ruby versions are already available in the tool cache. + +# Tool cache Ruby Path +$toolcacheRubyPath = 'C:\hostedtoolcache\windows\Ruby\2.5.*' + +# Get Latest Ruby 2.5.x +$latestRubyBinPath2_5 = Get-ChildItem -Path $toolcacheRubyPath | Sort-Object {[System.Version]$_.Name} | Select-Object -Last 1 | ForEach-Object { + Join-Path $_.FullName 'x64\bin' +} + +Add-MachinePathItem $latestRubyBinPath2_5 +$env:Path = Get-MachinePath +exit 0 diff --git a/images/win/scripts/Installers/Install-Rust.ps1 b/images/win/scripts/Installers/Install-Rust.ps1 new file mode 100644 index 000000000..fd58801df --- /dev/null +++ b/images/win/scripts/Installers/Install-Rust.ps1 @@ -0,0 +1,53 @@ +################################################################################ +## File: Install-Rust.ps1 +## Desc: Install Rust for Windows +################################################################################ + +Import-Module -Name ImageHelpers + +# Rust Env +$env:RUSTUP_HOME="C:\Rust\.rustup" +$env:CARGO_HOME="C:\Rust\.cargo" + +# Download the latest rustup-init.exe for Windows x64 +# See https://rustup.rs/# +Invoke-WebRequest -UseBasicParsing -Uri "https://win.rustup.rs/x86_64" -OutFile rustup-init.exe + +# Install Rust by running rustup-init.exe (disabling the confirmation prompt with -y) +.\rustup-init.exe -y + +# Delete rustup-init.exe when it's no longer needed +Remove-Item -Path .\rustup-init.exe + +# Add Rust binaries to the path +Add-MachinePathItem "$env:CARGO_HOME\bin" +$env:Path = Get-MachinePath + +# Install common tools +rustup component add rustfmt +rustup component add clippy +cargo install bindgen +cargo install cbindgen + +# Run script at startup for all users +$cmdRustSymScript = @" +@echo off + +if exist $env:CARGO_HOME ( + if not exist %USERPROFILE%\.cargo ( + mklink /J %USERPROFILE%\.cargo $env:CARGO_HOME + ) +) + +if exist $env:RUSTUP_HOME ( + if not exist %USERPROFILE%\.rustup ( + mklink /J %USERPROFILE%\.rustup $env:RUSTUP_HOME + ) +) +"@ + +$cmdPath = "C:\Rust\rustsym.bat" +$cmdRustSymScript | Out-File -Encoding ascii -FilePath $cmdPath + +# Update Run key to run a script at logon +Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "RUSTSYM" -Value $cmdPath diff --git a/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 b/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 new file mode 100644 index 000000000..470ee5ee3 --- /dev/null +++ b/images/win/scripts/Installers/Install-SQLPowerShellTools.ps1 @@ -0,0 +1,61 @@ +################################################################################ +## File: Install-SQLPowerShellTools.ps1 +## Desc: Install SQL PowerShell tool +################################################################################ + +Import-Module -Name ImageHelpers -Force + +Function InstallMSI +{ + Param + ( + [String]$MsiUrl, + [String]$MsiName + ) + + $exitCode = -1 + + try + { + Write-Host "Downloading $MsiName..." + $FilePath = "${env:Temp}\$MsiName" + + Invoke-WebRequest -Uri $MsiUrl -OutFile $FilePath + + $Arguments = ('/i', $FilePath, '/QN', '/norestart' ) + + Write-Host "Starting Install $MsiName..." + $process = Start-Process -FilePath msiexec.exe -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + exit $exitCode + } + } + catch + { + Write-Host -Object "Failed to install the MSI $MsiName" + Write-Host -Object $_.Exception.Message + exit -1 + } +} + +# install required MSIs +$SQLSysClrTypesExitCode = InstallMSI -MsiUrl "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64/SQLSysClrTypes.msi" -MsiName "SQLSysClrTypes.msi" + +$SharedManagementObjectsExitCode = InstallMSI -MsiUrl "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64/SharedManagementObjects.msi" -MsiName "SharedManagementObjects.msi" + +$PowerShellToolsExitCode = InstallMSI -MsiUrl "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64/PowerShellTools.msi" -MsiName "PowerShellTools.msi" + +# install sqlserver PS module +Set-PSRepository -Name PSGallery -InstallationPolicy Trusted +Install-Module -Name SqlServer -AllowClobber + +exit $PowerShellToolsExitCode diff --git a/images/win/scripts/Installers/Install-Sbt.ps1 b/images/win/scripts/Installers/Install-Sbt.ps1 new file mode 100644 index 000000000..f87cf90a1 --- /dev/null +++ b/images/win/scripts/Installers/Install-Sbt.ps1 @@ -0,0 +1,21 @@ +################################################################################ +## File: Install-Sbt.ps1 +## Team: CI-X +## Desc: Install sbt for Windows +################################################################################ +$ErrorActionPreference = "Stop" + +Import-Module -Name ImageHelpers + +# Install the latest version of sbt. +# See https://chocolatey.org/packages/sbt +choco install sbt -y + +$env:SBT_HOME="${env:ProgramFiles(x86)}\sbt" + +# Add sbt binaries to the path +Add-MachinePathItem "$env:SBT_HOME\bin" +$env:Path = Get-MachinePath + +# Done +exit 0 diff --git a/images/win/scripts/Installers/Install-SeleniumWebDrivers.ps1 b/images/win/scripts/Installers/Install-SeleniumWebDrivers.ps1 new file mode 100644 index 000000000..77f71764e --- /dev/null +++ b/images/win/scripts/Installers/Install-SeleniumWebDrivers.ps1 @@ -0,0 +1,17 @@ +################################################################################ +## File: Install-SeleniumWebDrivers.ps1 +## Desc: Install Selenium Web Drivers +################################################################################ + +Invoke-WebRequest -UseBasicParsing -Uri "https://seleniumwebdrivers.blob.core.windows.net/seleniumwebdrivers/SeleniumWebDrivers.zip" -OutFile SeleniumWebDrivers.zip + +Expand-Archive -Path SeleniumWebDrivers.zip -DestinationPath "C:\" -Force + +Remove-Item SeleniumWebDrivers.zip + +setx IEWebDriver "C:\SeleniumWebDrivers\IEDriver" /M +setx GeckoWebDriver "C:\SeleniumWebDrivers\GeckoDriver" /M +setx ChromeWebDriver "C:\SeleniumWebDrivers\ChromeDriver" /M + +exit 0 + diff --git a/images/win/scripts/Installers/Install-ServiceFabricSDK.ps1 b/images/win/scripts/Installers/Install-ServiceFabricSDK.ps1 new file mode 100644 index 000000000..d13b4395d --- /dev/null +++ b/images/win/scripts/Installers/Install-ServiceFabricSDK.ps1 @@ -0,0 +1,13 @@ +################################################################################ +## File: Install-ServiceFabricSDK.ps1 +## Desc: Install webpicmd and then the service fabric sdk +## must be install after Visual Studio +################################################################################ + +#Creating 'Installer' cache folder if it doesn't exist +$temp_install_dir = 'C:\Windows\Installer' +New-Item -Path $temp_install_dir -ItemType Directory -Force + +Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force + +WebpiCmd.exe /Install /Products:MicrosoftAzure-ServiceFabric-CoreSDK /AcceptEula diff --git a/images/win/scripts/Installers/Install-Svn.ps1 b/images/win/scripts/Installers/Install-Svn.ps1 new file mode 100644 index 000000000..107213e4c --- /dev/null +++ b/images/win/scripts/Installers/Install-Svn.ps1 @@ -0,0 +1,6 @@ +################################################################################ +## File: Install-Svn.ps1 +## Desc: Install Subversion +################################################################################ + +choco install svn -y diff --git a/images/win/scripts/Installers/Install-TypeScript.ps1 b/images/win/scripts/Installers/Install-TypeScript.ps1 new file mode 100644 index 000000000..3bf4480a2 --- /dev/null +++ b/images/win/scripts/Installers/Install-TypeScript.ps1 @@ -0,0 +1,7 @@ +################################################################################ +## File: Install-TypeScript.ps1 +## Team: CI Build +## Desc: Install Latest TypeScript +################################################################################ + +npm install -g typescript diff --git a/images/win/scripts/Installers/Install-Vcpkg.ps1 b/images/win/scripts/Installers/Install-Vcpkg.ps1 new file mode 100644 index 000000000..373f066ac --- /dev/null +++ b/images/win/scripts/Installers/Install-Vcpkg.ps1 @@ -0,0 +1,21 @@ +################################################################################ +## File: Install-Vcpkg.ps1 +## Desc: Install vcpkg +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$Uri = 'https://github.com/Microsoft/vcpkg.git' +$InstallDir = 'C:\vcpkg' +$VcpkgExecPath = 'vcpkg.exe' + +git clone --depth=1 $Uri $InstallDir -q + +# Build and integrate vcpkg +Invoke-Expression "$InstallDir\bootstrap-vcpkg.bat" +Invoke-Expression "$InstallDir\$VcpkgExecPath integrate install" + +# Add vcpkg to system environment +Add-MachinePathItem $InstallDir +$env:Path = Get-MachinePath +setx VCPKG_INSTALLATION_ROOT $InstallDir /M diff --git a/images/win/scripts/Installers/Install-WinAppDriver.ps1 b/images/win/scripts/Installers/Install-WinAppDriver.ps1 new file mode 100644 index 000000000..983585075 --- /dev/null +++ b/images/win/scripts/Installers/Install-WinAppDriver.ps1 @@ -0,0 +1,8 @@ +#################################################################################### +## File: Install-WinAppDriver.ps1 +## Desc: Install Windows Application Driver (WinAppDriver) +#################################################################################### + +Import-Module -Name ImageHelpers -Force +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +Install-MSI -MsiUrl "https://github.com/Microsoft/WinAppDriver/releases/download/v1.1/WindowsApplicationDriver.msi" -MsiName "WindowsApplicationDriver.msi" diff --git a/images/win/scripts/Installers/Install-WindowsUpdates.ps1 b/images/win/scripts/Installers/Install-WindowsUpdates.ps1 new file mode 100644 index 000000000..29d8a5f48 --- /dev/null +++ b/images/win/scripts/Installers/Install-WindowsUpdates.ps1 @@ -0,0 +1,10 @@ +################################################################################ +## File: Install-WindowsUpdates.ps1 +## Desc: Install Windows Updates. +## Should be run at end just before Antivirus. +################################################################################ + +Write-Host "Run windows updates" +Install-Module -Name PSWindowsUpdate -Force -AllowClobber +Get-WUInstall -WindowsUpdate -AcceptAll -UpdateType Software -IgnoreReboot +Get-WUInstall -MicrosoftUpdate -AcceptAll -IgnoreUserInput -IgnoreReboot diff --git a/images/win/scripts/Installers/Update-AndroidSDK.ps1 b/images/win/scripts/Installers/Update-AndroidSDK.ps1 new file mode 100644 index 000000000..b617cb372 --- /dev/null +++ b/images/win/scripts/Installers/Update-AndroidSDK.ps1 @@ -0,0 +1,156 @@ +################################################################################ +## File: Update-AndroidSDK.ps1 +## Desc: Install and update Android SDK and tools +################################################################################ + +# Download the latest command line tools so that we can accept all of the licenses. +# See https://developer.android.com/studio/#command-tools +Invoke-WebRequest -UseBasicParsing -Uri "https://dl.google.com/android/repository/sdk-tools-windows-4333796.zip" -OutFile android-sdk-tools.zip + +# Don't replace the one that VS installs as it seems to break things. +Expand-Archive -Path android-sdk-tools.zip -DestinationPath android-sdk -Force + +$sdk = Get-Item -Path .\android-sdk + +# Install the standard Android SDK licenses. In the past, there wasn't a better way to do this, +# so we are base64-encoding a zip of the licenses directory from another installation. +# To create this base64 string, create a zip file that contains nothing but a 'licenses' folder, +# which folder contains the accepted license files found in 'C:\Program Files (x86)\Android\android-sdk\licenses'. +# Then, run this in PowerShell: +# $LicensesZipFileName = 'C:\Program Files (x86)\Android\android-sdk\Licenses.zip' +# $base64Content = [Convert]::ToBase64String([IO.File]::ReadAllBytes($LicensesZipFileName)) +# echo $base64Content +# +# Future: see if the base64 technique can be avoided by running this PowerShell script to accept all licenses. +# This fails when run on a live agent, likely because non-interactive mode is set. +# It may work fine during image generation (this script). +# for($i=0; $i -lt 100; $i++) { $response += "y`n"}; $response | .\sdkmanager.bat --licenses +$base64Content = "UEsDBBQAAAAAAKJeN06amkPzKgAAACoAAAAhAAAAbGljZW5zZXMvYW5kcm9pZC1nb29nbGV0di1saWNlbnNlDQpmYzk0NmU4ZjIzMWYzZTMxNTliZjBiN2M2NTVjOTI0Y2IyZTM4MzMwUEsDBBQAAAAIAKBrN05E+YSqQwAAAFQAAAAcAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstbGljZW5zZQXByREAIQgEwP9WmYsjhxgOKJN/CNs9vmdOQ2zdRw2dxQnWjqQ/3oIgXQM9vqUiwkiX8ljWea4ZlCF3xTo1pz6w+wdQSwMEFAAAAAAAxV43TpECY7AqAAAAKgAAACQAAABsaWNlbnNlcy9hbmRyb2lkLXNkay1wcmV2aWV3LWxpY2Vuc2UNCjUwNDY2N2Y0YzBkZTdhZjFhMDZkZTlmNGIxNzI3Yjg0MzUxZjI5MTBQSwMEFAAAAAAAzF43TpOr0CgqAAAAKgAAABsAAABsaWNlbnNlcy9nb29nbGUtZ2RrLWxpY2Vuc2UNCjMzYjZhMmI2NDYwN2YxMWI3NTlmMzIwZWY5ZGZmNGFlNWM0N2Q5N2FQSwMEFAAAAAAAz143TqxN4xEqAAAAKgAAACQAAABsaWNlbnNlcy9pbnRlbC1hbmRyb2lkLWV4dHJhLWxpY2Vuc2UNCmQ5NzVmNzUxNjk4YTc3YjY2MmYxMjU0ZGRiZWVkMzkwMWU5NzZmNWFQSwMEFAAAAAAA0l43Tu2ee/8qAAAAKgAAACYAAABsaWNlbnNlcy9taXBzLWFuZHJvaWQtc3lzaW1hZ2UtbGljZW5zZQ0KNjNkNzAzZjU2OTJmZDg5MWQ1YWNhY2ZiZDhlMDlmNDBmYzk3NjEwNVBLAQIUABQAAAAAAKJeN06amkPzKgAAACoAAAAhAAAAAAAAAAEAIAAAAAAAAABsaWNlbnNlcy9hbmRyb2lkLWdvb2dsZXR2LWxpY2Vuc2VQSwECFAAUAAAACACgazdORPmEqkMAAABUAAAAHAAAAAAAAAABACAAAABpAAAAbGljZW5zZXMvYW5kcm9pZC1zZGstbGljZW5zZVBLAQIUABQAAAAAAMVeN06RAmOwKgAAACoAAAAkAAAAAAAAAAEAIAAAAOYAAABsaWNlbnNlcy9hbmRyb2lkLXNkay1wcmV2aWV3LWxpY2Vuc2VQSwECFAAUAAAAAADMXjdOk6vQKCoAAAAqAAAAGwAAAAAAAAABACAAAABSAQAAbGljZW5zZXMvZ29vZ2xlLWdkay1saWNlbnNlUEsBAhQAFAAAAAAAz143TqxN4xEqAAAAKgAAACQAAAAAAAAAAQAgAAAAtQEAAGxpY2Vuc2VzL2ludGVsLWFuZHJvaWQtZXh0cmEtbGljZW5zZVBLAQIUABQAAAAAANJeN07tnnv/KgAAACoAAAAmAAAAAAAAAAEAIAAAACECAABsaWNlbnNlcy9taXBzLWFuZHJvaWQtc3lzaW1hZ2UtbGljZW5zZVBLBQYAAAAABgAGANoBAACPAgAAAAA=" +$content = [System.Convert]::FromBase64String($base64Content) +Set-Content -Path .\android-sdk-licenses.zip -Value $content -Encoding Byte +Expand-Archive -Path .\android-sdk-licenses.zip -DestinationPath 'C:\Program Files (x86)\Android\android-sdk' -Force + + +# run the updates. +# keep newer versions in descending order + +$sdk_root = "C:\Program Files (x86)\Android\android-sdk" + +# The NDK is installed by Visual Studio at this location: +$ndk_root = "C:\Microsoft\AndroidNDK64\" + +if(Test-Path $ndk_root){ + + $androidNDKs = Get-ChildItem -Path $ndk_root | Sort-Object -Property Name -Descending | Select-Object -First 1 + $latestAndroidNDK = $androidNDKs.FullName; + + setx ANDROID_HOME $sdk_root /M + setx ANDROID_NDK_HOME $latestAndroidNDK /M + setx ANDROID_NDK_PATH $latestAndroidNDK /M +} +else { + Write-Host "NDK is not installed at path $ndk_root" + exit 1 +} + + +Push-Location -Path $sdk.FullName + +& '.\tools\bin\sdkmanager.bat' --sdk_root=$sdk_root ` + "platform-tools" ` + "platforms;android-29" ` + "platforms;android-28" ` + "platforms;android-27" ` + "platforms;android-26" ` + "platforms;android-25" ` + "platforms;android-24" ` + "platforms;android-23" ` + "platforms;android-22" ` + "platforms;android-21" ` + "platforms;android-19" ` + "build-tools;29.0.2" ` + "build-tools;29.0.0" ` + "build-tools;28.0.3" ` + "build-tools;28.0.2" ` + "build-tools;28.0.1" ` + "build-tools;28.0.0" ` + "build-tools;27.0.3" ` + "build-tools;27.0.2" ` + "build-tools;27.0.1" ` + "build-tools;27.0.0" ` + "build-tools;26.0.3" ` + "build-tools;26.0.2" ` + "build-tools;26.0.1" ` + "build-tools;26.0.0" ` + "build-tools;25.0.3" ` + "build-tools;25.0.2" ` + "build-tools;25.0.1" ` + "build-tools;25.0.0" ` + "build-tools;24.0.3" ` + "build-tools;24.0.2" ` + "build-tools;24.0.1" ` + "build-tools;24.0.0" ` + "build-tools;23.0.3" ` + "build-tools;23.0.2" ` + "build-tools;23.0.1" ` + "build-tools;22.0.1" ` + "build-tools;21.1.2" ` + "build-tools;20.0.0" ` + "build-tools;19.1.0" ` + "extras;android;m2repository" ` + "extras;google;m2repository" ` + "extras;google;google_play_services" ` + "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2" ` + "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.1" ` + "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" ` + "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" ` + "add-ons;addon-google_apis-google-24" ` + "add-ons;addon-google_apis-google-23" ` + "add-ons;addon-google_apis-google-22" ` + "add-ons;addon-google_apis-google-21" ` + "cmake;3.6.4111459" ` + "patcher;v4" + +Pop-Location + + +# Adding description of the software to Markdown +$Header = @" + +## Android SDK Build Tools + +"@ + +Add-ContentToMarkdown -Content $Header + +$BuildTools =(Get-ChildItem "C:\Program Files (x86)\Android\android-sdk\build-tools\") ` + | Where { $_.Name -match "[0-9].*" } ` + | Sort-Object -Descending ` + | % { "#### $($_.Name)`n`n_Location:_ $($_.FullName)`n" } + +Add-ContentToMarkdown -Content $BuildTools + + +# Adding description of the software to Markdown +$Header = @" + +## Android SDK Platforms + +"@ + +Add-ContentToMarkdown -Content $Header + +$SdkList =(Get-ChildItem "C:\Program Files (x86)\Android\android-sdk\platforms\") | Sort-Object -Descending | %{ $_.FullName } + +foreach($sdk in $SdkList) +{ + $sdkProps = ConvertFrom-StringData (Get-Content "$sdk\source.properties" -Raw) + + $content = @" +#### $($sdkProps.'Platform.Version') (API $($sdkProps.'AndroidVersion.ApiLevel')) + +_Location:_ $sdk + +"@ + Add-ContentToMarkdown -Content $content +} diff --git a/images/win/scripts/Installers/Update-DotnetTLS.ps1 b/images/win/scripts/Installers/Update-DotnetTLS.ps1 new file mode 100644 index 000000000..82f464739 --- /dev/null +++ b/images/win/scripts/Installers/Update-DotnetTLS.ps1 @@ -0,0 +1,18 @@ +################################################################################ +## File: Update-DotnetTLS.ps1 +## Desc: Update DotNetFramework security protocol to TLS 1.2 +################################################################################ + +$registryPath = "HKLM:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319" +$name = "SchUseStrongCrypto" +$value = "1" +if(Test-Path $registryPath){ + Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD +} + +$registryPath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" +if(Test-Path $registryPath){ + Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD +} + + diff --git a/images/win/scripts/Installers/Validate-7zip.ps1 b/images/win/scripts/Installers/Validate-7zip.ps1 new file mode 100644 index 000000000..fb6bed229 --- /dev/null +++ b/images/win/scripts/Installers/Validate-7zip.ps1 @@ -0,0 +1,25 @@ +################################################################################ +## File: Validate-7zip.ps1 +## Desc: Validate 7zip +################################################################################ + +if (Get-Command -Name '7z') +{ + Write-Host "7zip on path" +} +else +{ + Write-Host '7zip is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "7zip" +$(7z --help).Split([System.Environment]::NewLine)[1] -match "\d+\.\d+" +$7zipVersion = $matches[0] + +$Description = @" +_Version:_ $7zipVersion
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-AzureCli.ps1 b/images/win/scripts/Installers/Validate-AzureCli.ps1 new file mode 100644 index 000000000..16d70e308 --- /dev/null +++ b/images/win/scripts/Installers/Validate-AzureCli.ps1 @@ -0,0 +1,28 @@ +################################################################################ +## File: Validate-AzureCli.ps1 +## Desc: Validate Azure CLI +################################################################################ + +if(Get-Command -Name 'az') +{ + Write-Host "Azure Cli $(az --version) on path" +} +else +{ + Write-Error "Azure Cli not on path" + exit 1 +} + +$azureCliVersion = az -v | findstr azure-cli +$azureCliVersion = $azureCliVersion.trim().Substring("azure-cli".Length).trim() + +# Adding description of the software to Markdown +$SoftwareName = "Azure CLI" + +$Description = @" +_Version:_ $azureCliVersion +_Environment:_ +* PATH: contains location of az.cmd +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 b/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 new file mode 100644 index 000000000..663609bd4 --- /dev/null +++ b/images/win/scripts/Installers/Validate-AzureCosmosDbEmulator.ps1 @@ -0,0 +1,47 @@ +################################################################################ +## File: Validate-AzureCosmosDbEmulator.ps1 +## Desc: Validate Azure CosmosDb Emulator installation. +################################################################################ + +$SoftwareName = 'Azure CosmosDb Emulator' +$regKey = gci HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | gp | ? { $_.DisplayName -eq 'Azure Cosmos DB Emulator' } + +if ($regKey -eq $null) +{ + Write-Host "The $regKey registry key is not set" + exit 1 +} +else +{ + Write-Host "The $regKey registry key is set" +} + +$installDir = $regKey.InstallLocation +if ($installDir -eq $null) +{ + Write-Host "The $SoftwareName installation directory registry value is not set" + exit 1 +} +else +{ + Write-Host "The $SoftwareName installation directory registry value is set to: $installDir" +} + +$exeFilePath = Join-Path $installDir 'CosmosDB.Emulator.exe' +if (!(Test-Path $exeFilePath)) +{ + Write-Host "$SoftwareName is not installed" + exit 1 +} +else +{ + $fileVersion = (Get-Item $exeFilePath).VersionInfo.FileVersion + Write-Host "$SoftwareName is successfully installed: $fileVersion" + + $Description = @" +_Version:_ $fileVersion
+_Location:_ $installDir +"@ + + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +} diff --git a/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 b/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 new file mode 100644 index 000000000..b494bd183 --- /dev/null +++ b/images/win/scripts/Installers/Validate-AzureDevOpsCli.ps1 @@ -0,0 +1,24 @@ +################################################################################ +## File: Validate-AzureDevOpsCli.ps1 +## Desc: Validate Azure DevOps CLI +################################################################################ + +az devops -h + +if($LastExitCode -ne 0) +{ + Write-Error "Azure DevOps Cli extension not present" + exit 1 +} +else +{ + Write-Host "Azure DevOps Cli extension is present" +} + +$azDevopsVer = az -v | findstr azure-devops + +$Description = @" +_Version:_ $azDevopsVer +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName 'Azure DevOps Cli extension' -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-AzureModules.ps1 b/images/win/scripts/Installers/Validate-AzureModules.ps1 new file mode 100644 index 000000000..a1456fac1 --- /dev/null +++ b/images/win/scripts/Installers/Validate-AzureModules.ps1 @@ -0,0 +1,71 @@ +################################################################################ +## File: Validate-AzureModules.ps1 +## Desc: Validate Azure PowerShell modules +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$DefaultModule = Get-Module -Name AzureRM -ListAvailable | Select-Object -First 1 + +$env:PSModulePath = $env:PSModulePath + ";C:\Modules" + +$azureModules = Get-Module -Name Azure -ListAvailable | Select-Object Name,Version,Path | Format-Table | Out-String + +Write-Host "The Azure Modules finally present are:" +$azureModules + +if( ($azureModules -match "2.1.0") -and ($azureModules -match "3.8.0") -and ($azureModules -match "4.2.1") -and ($azureModules -match "5.1.1")) +{ + Write-Host "Required Azure modules are present" +} +else { + Write-Host "One or more required Azure modules are not present" + throw "One or more required Azure modules are not present." +} + + +$azureRMModules = Get-Module -Name AzureRM -ListAvailable | Select-Object Name,Version,Path | Format-Table | Out-String + +Write-Host "The AzureRM Modules finally present are:" +$azureRMModules + +if( ($azureRMModules -match "2.1.0") -and ($azureRMModules -match "3.8.0") -and ($azureRMModules -match "4.2.1") -and ($azureRMModules -match "5.1.1")) +{ + Write-Host "Required AzureRM modules are present" + +} +else { + Write-Host "One or more required AzureRM modules are not present" + throw "One or more required AzureRM modules are not present." +} + + +$azureModules = Get-Module -Name AzureRM -ListAvailable + + +# Adding description of the software to Markdown +$SoftwareName = "Azure/AzureRM Powershell modules" + +$Description = @" +#### $($DefaultModule.Version) + +This version is installed and is available via `Get-Module -ListAvailable` +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +foreach( $module in $azureModules) +{ + if($module.Version -ne $DefaultModule.Version) + { + + $CurrentModule = @" +#### $($module.Version) + +This version is saved but not installed +_Location:_ $($module.Path) + +"@ + Add-ContentToMarkdown -Content $CurrentModule + } +} diff --git a/images/win/scripts/Installers/Validate-Boost.ps1 b/images/win/scripts/Installers/Validate-Boost.ps1 new file mode 100644 index 000000000..7da2aab80 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Boost.ps1 @@ -0,0 +1,75 @@ +################################################################################ +## File: Validate-Boost.ps1 +## Desc: Validate Boost +################################################################################ + +function Validate-BoostVersion +{ + Param + ( + [String]$BoostRootPath, + [String]$BoostRelease + ) + + $ReleasePath = Join-Path -Path $BoostRootPath -ChildPath $BoostRelease + + if ((Test-Path "$ReleasePath\b2.exe") -and (Test-Path "$ReleasePath\bjam.exe")) + { + Write-Host "Boost.Build $BoostRelease is successfully installed" + Write-Host "Boost.Jam $BoostRelease is successfully installed" + return + } + + Write-Host "$BoostRelease not found" + exit 1 +} + +# Verify that Boost is on the path +if ((Get-Command -Name 'b2') -and (Get-Command -Name 'bjam')) +{ + Write-Host "Boost is on the path" +} +else +{ + Write-Host "Boost is not on the path" + exit 1 +} + +# Adding description of the software to Markdown +$tmplMark = @" +#### {0} + +_Environment:_ +* {1}: root directory of the Boost version {0} installation + +"@ + +$tmplMarkRoot = @" +#### {0} + +* PATH: contains the location of Boost version {0} +* BOOST_ROOT: root directory of the Boost version {0} installation +* {1}: root directory of the Boost version {0} installation +"@ + +$SoftwareName = 'Boost' +$Description = New-Object System.Text.StringBuilder +$BoostRootDirectory = Join-Path -Path $env:ProgramFiles -ChildPath "Boost" +$BoostVersionsToInstall = $env:BOOST_VERSIONS.split(",") + +foreach($Boost in $BoostVersionsToInstall) +{ + Validate-BoostVersion -BoostRootPath $BoostRootDirectory -BoostRelease $Boost + $BoostVersionTag = "BOOST_ROOT_{0}" -f $Boost.Replace('.', '_') + + if($boost -eq $env:BOOST_DEFAULT) + { + $null = $Description.AppendLine(($tmplMarkRoot -f $BoostVersion, $BoostVersionTag)) + } + else + { + $null = $Description.AppendLine(($tmplMark -f $BoostVersion, $BoostVersionTag)) + } +} + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString() diff --git a/images/win/scripts/Installers/Validate-Chrome.ps1 b/images/win/scripts/Installers/Validate-Chrome.ps1 new file mode 100644 index 000000000..505976e44 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Chrome.ps1 @@ -0,0 +1,25 @@ +################################################################################ +## File: Validate-Chrome.ps1 +## Desc: Validate Google Chrome installation. +################################################################################ + +if(Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe") +{ + (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo + + $SoftwareName = "Google Chrome" + $fileVersion = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(Default)').VersionInfo.FileVersion + $Description = @" +_version:_ +$fileVersion +"@ + + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + exit 0 +} +else +{ + Write-Host "Google Chrome is not installed." + exit 1 +} diff --git a/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 b/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 new file mode 100644 index 000000000..5e92f8a51 --- /dev/null +++ b/images/win/scripts/Installers/Validate-CloudFoundryCli.ps1 @@ -0,0 +1,28 @@ +################################################################################ +## File: Validate-CloudFoundryCli.ps1 +## Desc: Validate Cloud Foundry CLI +################################################################################ + +if (Get-Command -Name 'cf') +{ + Write-Host "cf on path" +} +else +{ + Write-Host 'cf is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Cloud Foundry CLI" + +if( $(cf version) -match '\d+\.\d+\.\d+' ) +{ + $version = $Matches[0] +} + +$Description = @" +_Version:_ $version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Cmake.ps1 b/images/win/scripts/Installers/Validate-Cmake.ps1 new file mode 100644 index 000000000..49a7487c9 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Cmake.ps1 @@ -0,0 +1,31 @@ +################################################################################ +## File: Validate-Cmake.ps1 +## Desc: Validate Cmake +################################################################################ + +if(Get-Command -Name 'cmake') +{ + Write-Host "Cmake $(cmake -version) on path" +} +else +{ + Write-Host 'cmake not on path' + exit 1 +} + + +if( $( $(cmake -version) | Out-String) -match 'cmake version (?.*).*' ) +{ + $cmakeVersion = $Matches.version.Trim() +} + +# Adding description of the software to Markdown +$SoftwareName = "Cmake" + +$Description = @" +_Version:_ $cmakeVersion
+_Environment:_ +* PATH: contains location of cmake.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-DACFx.ps1 b/images/win/scripts/Installers/Validate-DACFx.ps1 new file mode 100644 index 000000000..587b2b0bb --- /dev/null +++ b/images/win/scripts/Installers/Validate-DACFx.ps1 @@ -0,0 +1,33 @@ +#################################################################################### +## File: Validate-DACFx.ps1 +## Desc: Validate SQL Server® Data-Tier Application Framework (DACFx) for Windows +#################################################################################### + +$env:PATH = $env:Path + ';C:\Program Files\Microsoft SQL Server\120\DAC\bin;C:\Program Files\Microsoft SQL Server\130\DAC\bin;C:\Program Files\Microsoft SQL Server\140\DAC\bin;C:\Program Files\Microsoft SQL Server\150\DAC\bin' + +if(Get-Command -Name 'SqlPackage') +{ + + Write-Host "DACFx is installed at path" (Get-Command -Name 'SqlPackage').Source +} +else +{ + throw "DACFx is not installed!" +} + +function Get-DacFxVersion +{ + $regKey = "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Data-Tier Application Framework\CurrentVersion" + $Version = (Get-ItemProperty -Path $regKey).'(Default)' + return $Version +} + + +# Adding description of the software to Markdown +$SoftwareName = "SQL Server Data Tier Application Framework (x64)" + +$Description = @" +_Version:_ $(Get-DacFxVersion)
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Docker.ps1 b/images/win/scripts/Installers/Validate-Docker.ps1 new file mode 100644 index 000000000..c3404fa9b --- /dev/null +++ b/images/win/scripts/Installers/Validate-Docker.ps1 @@ -0,0 +1,46 @@ +################################################################################ +## File: Validate-Docker.ps1 +## Desc: Validate Docker. +################################################################################ + + +if((Get-Command -Name 'docker') -and (Get-Command -Name 'docker-compose')) +{ + Write-Host "docker $(docker version) on path" + Write-Host "docker-compose $(docker-compose version) on path" +} +else +{ + Write-Host "docker or docker-compose are not on path" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Docker" + +$version = $(docker version --format '{{.Server.Version}}') + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of docker.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + + +$SoftwareName = "Docker-compose" + +if( $(docker-compose --version) -match 'docker-compose version (?.*), build.*' ) +{ + $dockerComposeVersion = $Matches.version +} + +$Description = @" +_Version:_ $dockerComposeVersion
+_Environment:_ +* PATH: contains location of docker-compose.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-DotnetSDK.ps1 b/images/win/scripts/Installers/Validate-DotnetSDK.ps1 new file mode 100644 index 000000000..a73133c3c --- /dev/null +++ b/images/win/scripts/Installers/Validate-DotnetSDK.ps1 @@ -0,0 +1,46 @@ +################################################################################ +## File: Validate-DotnetSDK.ps1 +## Desc: Validate dotnet +################################################################################ + +if(Get-Command -Name 'dotnet') +{ + Write-Host "dotnet $(dotnet --version) on path" +} +else +{ + Write-Host "dotnet is not on path" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = ".NET Core" + +$Description = @" +The following runtimes and SDKs are installed: + +_Environment:_ +* PATH: contains location of dotnet.exe + +_SDK:_ +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +$SdkList =(Get-ChildItem "C:\Program Files\dotnet\sdk") | Where { $_.Name -match "[0-9].*" } | Sort-Object -Descending | % { "* $($_.Name) $($_.FullName)" } + +Add-ContentToMarkdown -Content $SdkList + + + +$Runtimes = @" + +_Runtime:_ +"@ + +Add-ContentToMarkdown -Content $Runtimes + +$RuntimeList =(Get-ChildItem "C:\Program Files\dotnet\shared\Microsoft.NETCore.App") | Where { $_.Name -match "[0-9].*" } | Sort-Object -Descending | % { "* $($_.Name) $($_.FullName)" } + +Add-ContentToMarkdown -Content $RuntimeList + diff --git a/images/win/scripts/Installers/Validate-DotnetTLS.ps1 b/images/win/scripts/Installers/Validate-DotnetTLS.ps1 new file mode 100644 index 000000000..2ed4a4a08 --- /dev/null +++ b/images/win/scripts/Installers/Validate-DotnetTLS.ps1 @@ -0,0 +1,28 @@ +################################################################################ +## File: Validate-DotnetTLS.ps1 +## Desc: Validate DotNetFramework security protocol to TLS 1.2 +################################################################################ + +$protocols = [Net.ServicePointManager]::SecurityProtocol +$protocolArr = $protocols -split ', ' +if($protocolArr.Contains('Tls12')) +{ + Write-Host "Tls 1.2 has been enabled." +} +else +{ + Write-Host "Tls 1.2 has not been enabled." + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "TLS12" +$version = "1.2"; + +$Description = @" +_Version:_ $version
+_Description:_ .NET has been configured to use TLS 1.2 by default +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + diff --git a/images/win/scripts/Installers/Validate-Firefox.ps1 b/images/win/scripts/Installers/Validate-Firefox.ps1 new file mode 100644 index 000000000..afe717070 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Firefox.ps1 @@ -0,0 +1,25 @@ +################################################################################ +## File: Validate-Firefox.ps1 +## Desc: Validate Mozilla Firefox installation. +################################################################################ + +if(Test-Path "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe") +{ + (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo + + $fileVersion = (Get-Item (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe').'(Default)').VersionInfo.FileVersion + $SoftwareName = "Mozilla Firefox" + $Description = @" +_version:_ +$fileVersion +"@ + + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + exit 0 +} +else +{ + Write-Host "Mozilla Firefox is not installed." + exit 1 +} diff --git a/images/win/scripts/Installers/Validate-Git.ps1 b/images/win/scripts/Installers/Validate-Git.ps1 new file mode 100644 index 000000000..dacb967b7 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Git.ps1 @@ -0,0 +1,49 @@ +################################################################################ +## File: Validate-Git.ps1 +## Desc: Validate Git for Windows +################################################################################ + +if((Get-Command -Name 'git') -and (Get-Command -Name 'bash') -and (Get-Command -Name 'awk') -and (Get-Command -Name 'git-lfs')) +{ + Write-Host "$(git version) on path" + Write-Host "$(git-lfs version) on path" +} +else +{ + Write-Host "git or git-lfs are not on path." + exit 1 +} + + +if( $(git version) -match 'git version (?.*).win.*' ) +{ + $gitVersion = $Matches.version +} + +if( $(git-lfs version) -match 'git-lfs\/(?.*) \(Git.*' ) +{ + $gitLfsVersion = $Matches.version +} + +# Adding description of the software to Markdown +$SoftwareName = "Git" + +$Description = @" +_Version:_ $gitVersion
+_Environment:_ +* PATH: contains location of git.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +# Adding description of the software to Markdown +$SoftwareName = "Git Large File Storage (LFS)" + +$Description = @" +_Version:_ $gitLfsVersion
+_Environment:_ +* PATH: contains location of git-lfs.exe +* GIT_LFS_PATH: location of git-lfs.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-GitVersion.ps1 b/images/win/scripts/Installers/Validate-GitVersion.ps1 new file mode 100644 index 000000000..32aa2d88f --- /dev/null +++ b/images/win/scripts/Installers/Validate-GitVersion.ps1 @@ -0,0 +1,25 @@ +################################################################################ +## File: Validate-GitVersion.ps1 +## Desc: Validate GitVersion +################################################################################ + +$command = Get-Command -Name 'gitversion' +if ($command) +{ + Write-Host "gitversion on path" +} +else +{ + Write-Host 'gitversion is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "GitVersion" +$version = $command.Version.ToString() + +$Description = @" +_Version:_ $version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Go.ps1 b/images/win/scripts/Installers/Validate-Go.ps1 new file mode 100644 index 000000000..08c237475 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Go.ps1 @@ -0,0 +1,70 @@ +################################################################################ +## File: Validate-Go.ps1 +## Desc: Validate Go +################################################################################ + +# Function that gets the version of Go at the specified path +function Get-GoVersion +{ + Param + ( + [String]$goRootPath + ) + + $env:Path = "$goRootPath\bin;" + $env:Path + if( $(go version) -match 'go version go(?.*) win.*' ) + { + $goVersion = $Matches.version + return $goVersion + } + + Write-Host "Unable to determine Go version at " + $goRootPath + return "" +} + +# Verify that go.exe is on the path +if(Get-Command -Name 'go') +{ + Write-Host "$(go version) is on the path." +} +else +{ + Write-Host "Go is not on the path." + exit 1 +} + +# Add details of available versions in Markdown +$tmplMark = @" +#### {0} + +_Environment:_ +* {1}: root directory of the Go {0} installation + +"@ + +$tmplMarkRoot = @" +#### {0} + +_Environment:_ +* PATH: contains the location of go.exe version {0} +* GOROOT: root directory of the Go {0} installation +* {1}: root directory of the Go {0} installation +"@ + +$SoftwareName = "Go (x64)" +$Description = New-Object System.Text.StringBuilder +$goVersionsToInstall = $env:GO_VERSIONS.split(",") + +foreach($go in $goVersionsToInstall) { + $goVersion = Get-GoVersion -goRootPath "C:\Go${go}" + $goVersionTag = "GOROOT_{0}_{1}_X64" -f $go.split(".") + if ($goVersion -eq $go) { + if($go -eq $env:GO_DEFAULT) { + $null = $Description.AppendLine(($tmplMarkRoot -f $goVersion, $goVersionTag)) + } else { + $null = $Description.AppendLine(($tmplMark -f $goVersion, $goVersionTag)) + } + } +} + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString() diff --git a/images/win/scripts/Installers/Validate-InnoSetup.ps1 b/images/win/scripts/Installers/Validate-InnoSetup.ps1 new file mode 100644 index 000000000..3caa70165 --- /dev/null +++ b/images/win/scripts/Installers/Validate-InnoSetup.ps1 @@ -0,0 +1,27 @@ +################################################################################ +## File: Validate-InnoSetup.ps1 +## Desc: Validate Inno Setup +################################################################################ + +if (Get-Command -Name 'iscc') +{ + Write-Host "iscc is on PATH" +} +else +{ + Write-Host "iscc is not on PATH" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Inno Setup" + +$ChocoList = $(choco list --local-only innosetup) | Select-String -Pattern "InnoSetup" +$ChocoList -Match "\d+\.\d+\.\d+" +$Version = $Matches[0] + +$Description = @" +_Version:_ $Version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-JavaTools.ps1 b/images/win/scripts/Installers/Validate-JavaTools.ps1 new file mode 100644 index 000000000..91ffb42eb --- /dev/null +++ b/images/win/scripts/Installers/Validate-JavaTools.ps1 @@ -0,0 +1,113 @@ +################################################################################ +## File: Validate-JavaTools.ps1 +## Desc: Validate various JDKs and java tools +################################################################################ + +if((Get-Command -Name 'java') -and (Get-Command -Name 'mvn') -and (Get-Command -Name 'ant') -and (Get-Command -Name 'gradle')) +{ + Write-Host "Java $(java -version) on path" + Write-Host "Maven $(mvn -version) on path" + Write-Host "Ant $(ant -version) on path" + Write-Host "Gradle $(gradle -version) on path" +} +else +{ + Write-Host "one of Java,Maven,Ant,Gradle is not on path." + exit 1 +} + + +if( $( $(& $env:comspec "/s /c java -version 2>&1") | Out-String) -match '^(?.+) version "(?.+)".*' ) +{ + $javaVersion = $Matches.version +} + +$env:Path = $env:JAVA_HOME_7_X64 + "\bin;" + $env:Path + +if( $( $(& $env:comspec "/s /c java -version 2>&1") | Out-String) -match '^(?.+) version "(?.+)".*' ) +{ + $java7Version = $Matches.version +} + +$env:Path = $env:JAVA_HOME_11_X64 + "\bin;" + $env:Path + +if( $( $(& $env:comspec "/s /c java -version 2>&1") | Out-String) -match '^(?.+) version "(?.+)".*' ) +{ + $java11Version = $Matches.version +} + + +if( $(ant -version) -match 'Apache Ant\(TM\) version (?.*) compiled.*' ) +{ + $antVersion = $Matches.version +} + +if( $( $(mvn -version) | Out-String) -match 'Apache Maven (?.*) \(.*' ) +{ + $mvnVersion = $Matches.version +} + +if( $( $(gradle -version) | Out-String) -match 'Gradle (?.*)' ) +{ + $gradleVersion = $Matches.version.Trim() +} + +# Adding description of the software to Markdown +$SoftwareName = "Java Development Kit" + +$Description = @" +#### $javaVersion + +_Environment:_ +* JAVA_HOME: location of JDK +* PATH: contains bin folder of JDK + +#### $java7Version + +_Location:_ $env:JAVA_HOME_7_X64 + +#### $java11Version + +_Location:_ $env:JAVA_HOME_11_X64 +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + +# Adding description of the software to Markdown +$SoftwareName = "Ant" + +$Description = @" +_Version:_ $antVersion
+_Environment:_ +* PATH: contains location of ant.cmd +* ANT_HOME: location of ant.cmd +* COBERTURA_HOME: location of cobertura-2.1.1.jar +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + +# Adding description of the software to Markdown +$SoftwareName = "Maven" + +$Description = @" +_Version:_ $mvnVersion
+_Environment:_ +* PATH: contains location of mvn.bat +* M2_HOME: Maven installation root +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + +# Adding description of the software to Markdown +$SoftwareName = "Gradle" + +$Description = @" +_Version:_ $gradleVersion
+_Environment:_ +* PATH: contains location of gradle +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Jq.ps1 b/images/win/scripts/Installers/Validate-Jq.ps1 new file mode 100644 index 000000000..85bf2318a --- /dev/null +++ b/images/win/scripts/Installers/Validate-Jq.ps1 @@ -0,0 +1,23 @@ +################################################################################ +## File: Validate-Jq.ps1 +## Desc: Validate jq +################################################################################ + +if (Get-Command -Name 'jq') +{ + Write-Host "jq on path" +} +else +{ + Write-Host 'jq is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "jq" + +$Description = @" +_Version:_ $(jq --version)
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Kind.ps1 b/images/win/scripts/Installers/Validate-Kind.ps1 new file mode 100644 index 000000000..2a33e1de8 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Kind.ps1 @@ -0,0 +1,28 @@ +################################################################################ +## File: Validate-Kind.ps1 +## Desc: Validate Kind. +################################################################################ + + +if((Get-Command -Name 'kind')) +{ + Write-Host "kind $(kind version) in path" +} +else +{ + Write-Host "kind is not in path" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Kind" + +$version = $(kind version) + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of kind.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-KubernetesCli.ps1 b/images/win/scripts/Installers/Validate-KubernetesCli.ps1 new file mode 100644 index 000000000..05666c14a --- /dev/null +++ b/images/win/scripts/Installers/Validate-KubernetesCli.ps1 @@ -0,0 +1,28 @@ +################################################################################ +## File: Validate-KubernetesCli.ps1 +## Desc: Validate KubernetesCli. +################################################################################ + + +if((Get-Command -Name 'kubectl')) +{ + Write-Host "kubectl $(kubectl version --client=true --short=true) in path" +} +else +{ + Write-Host "kubectl is not in path" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Kubectl" + +$version = $(kubectl version --client=true --short=true) + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of kubectl.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Mercurial.ps1 b/images/win/scripts/Installers/Validate-Mercurial.ps1 new file mode 100644 index 000000000..7351fcab8 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Mercurial.ps1 @@ -0,0 +1,25 @@ +################################################################################ +## File: Validate-Mercurial.ps1 +## Desc: Validate Mercurial +################################################################################ + +if (Get-Command -Name 'hg') +{ + Write-Host "Mercurial on path" +} +else +{ + Write-Host 'Mercurial is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Mercurial" +$(hg --version).Split([System.Environment]::NewLine)[0] -match "\d+\.\d+\.\d+" +$MercurialVersion = $matches[0] + +$Description = @" +_Version:_ $MercurialVersion
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-MinGW.ps1 b/images/win/scripts/Installers/Validate-MinGW.ps1 new file mode 100644 index 000000000..78c5910f3 --- /dev/null +++ b/images/win/scripts/Installers/Validate-MinGW.ps1 @@ -0,0 +1,57 @@ +################################################################################ +## File: Validate-MinGW.ps1 +## Desc: Validate MinGW +################################################################################ + +if (Get-Command -Name 'gcc') +{ + Write-Host "gcc is successfully installed:" + gcc --version | Write-Host +} +else +{ + Write-Host "gcc is not on PATH" + exit 1 +} + +if (Get-Command -Name 'g++') +{ + Write-Host "g++ is successfully installed:" + g++ --version | Write-Host +} +else +{ + Write-Host "g++ is not on PATH" + exit 1 +} + +if (Get-Command -Name 'make') +{ + Write-Host "make is successfully installed:" + make --version | Write-Host +} +else +{ + Write-Host "make is not on PATH" + exit 1 +} + +# Adding description of the software to Markdown + +# `gcc --version` gives output like: +# gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.3.0 +# Copyright (C) 2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +$SoftwareName = "MinGW" +$(gcc --version).Split([System.Environment]::NewLine)[0] -match "\d\.\d\.\d$" +$minGwVersion = $matches[0] + +$Description = @" +_Version:_ $minGwVersion
+_Environment:_ +* PATH: contains location of the MinGW 'bin' directory +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Miniconda.ps1 b/images/win/scripts/Installers/Validate-Miniconda.ps1 new file mode 100644 index 000000000..defd8a73f --- /dev/null +++ b/images/win/scripts/Installers/Validate-Miniconda.ps1 @@ -0,0 +1,36 @@ +################################################################################ +## File: Validate-Miniconda.ps1 +## Desc: Validate Miniconda +################################################################################ + +if ($env:CONDA) +{ + Write-Host "The CONDA environment variable is set" + Write-Host $env:CONDA +} +else +{ + Write-Host "The CONDA environment variable is not set" + exit 1 +} + +if ((Test-Path "$env:CONDA\python.exe") -and (Test-Path "$env:CONDA\Scripts\conda.exe")) +{ + Write-Host "Miniconda is successfully installed:" + & "$env:CONDA\Scripts\conda.exe" --version | Write-Host +} +else +{ + Write-Host "Miniconda is not installed" + exit 1 +} + +$softwareName = "Miniconda" +$description = @" +_Version:_ $(& "$env:CONDA\Scripts\conda.exe" --version)
+_Environment:_ +* CONDA: contains location of the root of the Miniconda installation +"@ + +# Adding description of the software to Markdown +Add-SoftwareDetailsToMarkdown -SoftwareName $softwareName -DescriptionMarkdown $description diff --git a/images/win/scripts/Installers/Validate-MysqlCli.ps1 b/images/win/scripts/Installers/Validate-MysqlCli.ps1 new file mode 100644 index 000000000..2e4e82965 --- /dev/null +++ b/images/win/scripts/Installers/Validate-MysqlCli.ps1 @@ -0,0 +1,27 @@ +################################################################################ +## File: Validate-MysqlCli.ps1 +## Desc: Validate Mysql Cli +################################################################################ + +$command = Get-Command -Name 'mysql' +if($command) +{ + Write-Host "Mysql is on path" +} +else +{ + Write-Host 'Mysql not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Mysql" +$version = $command.Version.ToString(); + +$Description = @" +_Version:_ $version
+_Environment:_ +* PATH: contains location of mysql.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NET472.ps1 b/images/win/scripts/Installers/Validate-NET472.ps1 new file mode 100644 index 000000000..20c9d2c0f --- /dev/null +++ b/images/win/scripts/Installers/Validate-NET472.ps1 @@ -0,0 +1,27 @@ +################################################################################ +## File: Validate-NET472.ps1 +## Desc: Validate .NET 4.7.2 +################################################################################ + +Import-Module -Name ImageHelpers -Force + +# For reference, visit https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a +if(Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 461814 }) +{ + $version = Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Version + Write-Host "Installed .Net version " $version +} +else { + Write-Host ".Net 472 not found" + exit 1 +} + + +# Adding description of the software to Markdown +$SoftwareName = ".NET 4.7.2" + +$Description = @" +_Version:_ $version +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NET48.ps1 b/images/win/scripts/Installers/Validate-NET48.ps1 new file mode 100644 index 000000000..fce090bd9 --- /dev/null +++ b/images/win/scripts/Installers/Validate-NET48.ps1 @@ -0,0 +1,27 @@ +################################################################################ +## File: Validate-NET48.ps1 +## Desc: Validate .NET 4.8 +################################################################################ + +Import-Module -Name ImageHelpers -Force + +# For reference, visit https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a +if(Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 528049 }) +{ + $version = Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Version + Write-Host "Installed .Net version " $version +} +else { + Write-Host ".Net 48 not found" + exit 1 +} + + +# Adding description of the software to Markdown +$SoftwareName = ".NET 4.8" + +$Description = @" +_Version:_ $version +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-NSIS.ps1 b/images/win/scripts/Installers/Validate-NSIS.ps1 new file mode 100644 index 000000000..a9865e41c --- /dev/null +++ b/images/win/scripts/Installers/Validate-NSIS.ps1 @@ -0,0 +1,32 @@ +################################################################################ +## File: Validate-NSIS.ps1 +## Desc: Validate NSIS installation. +################################################################################ + +$SoftwareName = 'Nullsoft Install System (NSIS)' + +if (Get-Command -Name makensis) +{ + Write-Host "$SoftwareName is installed" +} +else +{ + Write-Host "$SoftwareName is not installed" + exit 1 +} + +# Adding description of the software to Markdown +$ChocoList = $(choco list --local-only nsis) | Select-String -Pattern "nsis" | Select-Object -First 1 + +if ($ChocoList -Match "\d+\.\d+") +{ + $Version = $Matches[0] +} + + +$Description = @" +_Version:_ $Version
+"@ + +#Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description +Write-Host $description diff --git a/images/win/scripts/Installers/Validate-NodeLts.ps1 b/images/win/scripts/Installers/Validate-NodeLts.ps1 new file mode 100644 index 000000000..49b10b65e --- /dev/null +++ b/images/win/scripts/Installers/Validate-NodeLts.ps1 @@ -0,0 +1,71 @@ +################################################################################ +## File: Validate-NodeLts.ps1 +## Desc: Validate nodejs-lts and other common node tools. +################################################################################ + +if((Get-Command -Name 'node') -and (Get-Command -Name 'npm')) +{ + Write-Host "Node $(node --version) on path" + Write-Host "Npm $(npm -version) on path" +} +else +{ + Write-Host "Node or npm is not on path" + exit 1 +} + +if((Get-Command -Name 'gulp') -and (Get-Command -Name 'grunt') -and (Get-Command -Name 'bower') -and (Get-Command -Name 'cordova') -and (Get-Command -Name 'yarn')) +{ + Write-Host "Gulp $(gulp -version) on path" + Write-Host "Grunt $(grunt -version) on path" + Write-Host "Bower $(bower -version) on path" + Write-Host "Yarn $(yarn -version) on path" +} +else +{ + Write-Host "One of Gulp, Grunt, Bower, Cordova, or Yarn is not on the path." + exit 1 +} + + + +if( $(node --version) -match 'v(?.*)' ) +{ + $nodeVersion = $Matches.version + $nodeArch = $(node -e "console.log(process.arch)") +} + +$npmVersion = $(npm -version) + +# Adding description of the software to Markdown +$SoftwareName = "Node.js" +$GulpInfo = "Gulp $(gulp -version)" +$GruntInfo = "Grunt $(grunt -version)" +$BowerInfo = "Bower $(bower -version)" +$YarnInfo = "Yarn $(yarn -version)" + +$Description = @" +_Version:_ $nodeVersion
+_Architecture:_ $nodeArch
+_Environment:_ +* PATH: contains location of node.exe
+* $GulpInfo
+* $GruntInfo
+* $BowerInfo
+* $YarnInfo
+ +> Note: You can install and use another version of Node.js on Microsoft-hosted agent pools using the [Node tool installer](https://docs.microsoft.com/vsts/pipelines/tasks/tool/node-js) task. +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +# Adding description of the software to Markdown +$SoftwareName = "npm" + +$Description = @" +_Version:_ $npmVersion
+_Environment:_ +* PATH: contains location of npm.cmd +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-OpenSSL.ps1 b/images/win/scripts/Installers/Validate-OpenSSL.ps1 new file mode 100644 index 000000000..fb7b79275 --- /dev/null +++ b/images/win/scripts/Installers/Validate-OpenSSL.ps1 @@ -0,0 +1,29 @@ +################################################################################ +## File: Validate-OpenSSL.ps1 +## Desc: Validate openssl +################################################################################ + +if (Get-Command -Name 'openssl') +{ + Write-Host "openssl on path" +} +else +{ + Write-Host 'openssl is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "OpenSSL" + +$versions = Get-Command openssl -All +foreach ($version in $versions) +{ + $command = "& `"$($version.Source)`" version" + if ( $(Invoke-Expression -Command $command) -match '\d+\.\d+\.\d+\w?' ) + { + $Description += "_Version:_ $($Matches[0]) at $($version.Source)
" + } +} + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-PHP.ps1 b/images/win/scripts/Installers/Validate-PHP.ps1 new file mode 100644 index 000000000..6f6044efe --- /dev/null +++ b/images/win/scripts/Installers/Validate-PHP.ps1 @@ -0,0 +1,49 @@ +################################################################################ +## File: Validate-PHP.ps1 +## Desc: Validate PHP +################################################################################ + +# Function that gets the version of php at the specified path +function Get-PHPVersion +{ + Param + ( + [String]$phpRootPath + ) + + $env:Path = "$phpRootPath;" + $env:Path + if($($(php --version)| Out-String) -match 'PHP (?.*) (.*cli).*') + { + $phpVersion = $Matches.version + return $phpVersion + } + + Write-Host "Unable to determine PHP version at " + $phpRootPath + exit 1 +} + +# Verify that php.exe is on the path +if(Get-Command -Name 'php') +{ + Write-Host "$(php --version) is on the path." +} +else +{ + Write-Host "php is not on the path." + exit 1 +} + +# Get available versions of PHP +$phpVersionOnPath = Get-PHPVersion -phpRootPath "C:\tools\php72" + +# Add details of available versions in Markdown +$SoftwareName = "PHP (x64)" +$Description = @" +#### $phpVersionOnPath + +_Environment:_ +* PATH: contains the location of php.exe version $phpVersionOnPath +* PHPROOT: root directory of the PHP $phpVersionOnPath installation +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Perl.ps1 b/images/win/scripts/Installers/Validate-Perl.ps1 new file mode 100644 index 000000000..95443640f --- /dev/null +++ b/images/win/scripts/Installers/Validate-Perl.ps1 @@ -0,0 +1,23 @@ +################################################################################ +## File: Validate-Perl.ps1 +## Desc: Validate perl +################################################################################ + +if (Get-Command -Name 'perl') +{ + Write-Host "perl on path" +} +else +{ + Write-Host 'perl is not on path' + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Perl" + +$Description = @" +_Version:_ $(perl -e 'print $^V')
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-PowershellCore.ps1 b/images/win/scripts/Installers/Validate-PowershellCore.ps1 new file mode 100644 index 000000000..088a55bfc --- /dev/null +++ b/images/win/scripts/Installers/Validate-PowershellCore.ps1 @@ -0,0 +1,28 @@ +################################################################################ +## File: Validate-PowershellCore.ps1 +## Desc: Validate Powershell Core +################################################################################ + +if (Get-Command -Name 'pwsh') +{ + Write-Host "pwsh is on PATH" +} +else +{ + Write-Host "pwsh is not on PATH" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "Powershell Core" + +if(($(pwsh --version) | Out-String) -match 'PowerShell (?.*)') +{ + $PowershellVersion = $Matches.version +} + +$Description = @" +_Version:_ $PowershellVersion
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Python.ps1 b/images/win/scripts/Installers/Validate-Python.ps1 new file mode 100644 index 000000000..425817644 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Python.ps1 @@ -0,0 +1,45 @@ +################################################################################ +## File: Validate-Python.ps1 +## Desc: Configure python on path based on what is installed in the tools cache +## Must run after tools cache is downloaded and validated +################################################################################ + +if(Get-Command -Name 'python') +{ + Write-Host "Python $(& python -V 2>&1) on path" +} +else +{ + Write-Host "Python is not on path" + exit 1 +} + +$Python3Version = $(& python -V 2>&1) + +if ($Python3Version -notlike "Python 3.*") +{ + Write-Error "Python 3 is not in the PATH" +} + + +$python2path = $Env:AGENT_TOOLSDIRECTORY + '/Python/2.7*/x64' +$python2Dir = Get-Item -Path $python2path + +$env:Path = $python2Dir.FullName + ";" + $env:Path + +$Python2Version = & $env:comspec "/s /c python --version 2>&1" + +# Adding description of the software to Markdown +$SoftwareName = "Python (64 bit)" + +$Description = @" +#### $Python3Version +_Environment:_ +* PATH: contains location of python.exe + +#### $Python2Version + +_Location:_ $Python2Path +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Ruby.ps1 b/images/win/scripts/Installers/Validate-Ruby.ps1 new file mode 100644 index 000000000..5243ab4d2 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Ruby.ps1 @@ -0,0 +1,53 @@ +################################################################################ +## File: Validate-Ruby.ps1 +## Desc: Verify that Ruby is on the path and output version information. +################################################################################ + +# Function that gets the version of Ruby at the specified path +function Get-RubyVersion +{ + Param + ( + [String]$rubyRootPath + ) + + # Prepend to the path like: C:\hostedtoolcache\windows\Ruby\2.5.0\x64\bin + $env:Path = "$rubyRootPath;" + $env:Path + + # Extract the version from Ruby output like: ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32] + if( $(ruby --version) -match 'ruby (?.*) \(.*' ) + { + $rubyVersion = $Matches.version + return $rubyVersion + } + + Write-Host "Unable to determine Ruby version at " + $rubyRootPath + exit 1 +} + +# Verify that ruby is on the path +if(Get-Command -Name 'ruby') +{ + Write-Host "$(ruby --version) is on the path." +} +else +{ + Write-Host "Ruby is not on the path." + exit 1 +} + +# Default Ruby Version on Path +$rubyExeOnPath = (Get-Command -Name 'ruby').Path +$rubyBinOnPath = Split-Path -Path $rubyExeOnPath +$rubyVersionOnPath = Get-RubyVersion -rubyRootPath $rubyBinOnPath + +# Add details of available versions in Markdown +$SoftwareName = "Ruby (x64)" +$Description = @" +#### $rubyVersionOnPath +_Environment:_ +* Location: $rubyBinOnPath +* PATH: contains the location of ruby.exe version $rubyVersionOnPath +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Rust.ps1 b/images/win/scripts/Installers/Validate-Rust.ps1 new file mode 100644 index 000000000..a1e8694d4 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Rust.ps1 @@ -0,0 +1,34 @@ +################################################################################ +## File: Validate-Rust.ps1 +## Desc: Verify that Rust is on the path and output version information. +################################################################################ + +if (Get-Command -Name 'rustc') +{ + Push-Location -Path $env:UserProfile + New-Item -Name ".rustup" -Value "C:\Rust\.rustup" -ItemType Junction + New-Item -Name ".cargo" -Value "C:\Rust\.cargo" -ItemType Junction + $RustcVersion = rustc --version + Write-Host "$RustcVersion is on the path" + Pop-Location +} +else +{ + Write-Host "rustc is not on the path" + exit 1 +} + +$RustPath = Split-Path (Get-Command -Name 'rustc').Path +$RustcVersion -Match "\d+\.\d+\.\d+" | Out-Null +$Version = $Matches[0] + +# Adding description of the software to Markdown +$SoftwareName = "Rust (64-bit)" +$Description = @" +#### $Version +_Location:_ $RustPath +_Environment:_ +* PATH: contains the location of rustc.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 b/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 new file mode 100644 index 000000000..2ca6b8fa8 --- /dev/null +++ b/images/win/scripts/Installers/Validate-SQLPowerShellTools.ps1 @@ -0,0 +1,37 @@ +# Validate the installation +$env:PSModulePath = Get-SystemVariable "PSModulePath" +$modules = Get-Module -Name SQLPS -ListAvailable +Write-Host "The SQLPS Modules present are:" +$modules | Select-Object Name,Version,Path | Format-Table + +if ($modules) { + $sqlPSVersion = $modules.Version +} + +# Validate the SQLserver PS module installation +$modules = Get-Module -Name SQLServer -ListAvailable +Write-Host "The SQLServer Modules present are:" +$modules | Select-Object Name,Version,Path | Format-Table + +if ($modules) { + $sqlServerPSModuleVersion = $modules.Version +} + + +# Adding description of the software to Markdown +$SoftwareName = "SQLPS" + +$Description = @" +_Version:_ $sqlPSVersion +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +# Adding description of the software to Markdown +$SoftwareName = "SQLServer PS" + +$Description = @" +_Version:_ $sqlServerPSModuleVersion +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Sbt.ps1 b/images/win/scripts/Installers/Validate-Sbt.ps1 new file mode 100644 index 000000000..ce213c557 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Sbt.ps1 @@ -0,0 +1,18 @@ +################################################################################ +## File: Validate-Sbt.ps1 +## Team: CI-Platform +## Desc: Validate sbt for Windows +################################################################################ + +if((Get-Command -Name 'sbt')) +{ + Write-Host "sbt is on the path" +} +else +{ + Write-Host "sbt is not on path." + exit 1 +} + +# This works around issue where sbt --script-version does some copies and breaks the build +Add-SoftwareDetailsToMarkdown -SoftwareName "sbt" -DescriptionMarkdown "" diff --git a/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 b/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 new file mode 100644 index 000000000..41a6266a0 --- /dev/null +++ b/images/win/scripts/Installers/Validate-SeleniumWebDrivers.ps1 @@ -0,0 +1,67 @@ +################################################################################ +## File: Validate-Chrome.ps1 +## Desc: Validate Google Chrome installation. +################################################################################ + +$IEDriverPath = $env:IEWebDriver +$GeckoDriverPath = $env:GeckoWebDriver +$ChromeDriverPath = $env:ChromeWebDriver + +if(($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and ($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and ($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver")) +{ + + Write-Host "IEDriver installed at " + (Get-Item "C:\SeleniumWebDrivers\IEDriver\IEDriverServer.exe").VersionInfo + + + Write-Host "Gecko Driver installed at " + (Get-Item "C:\SeleniumWebDrivers\GeckoDriver\geckodriver.exe").VersionInfo + + + Write-Host "Chrome Driver installed at " + (Get-Item "C:\SeleniumWebDrivers\ChromeDriver\chromedriver.exe").VersionInfo + + $chromedriverversion = Get-Content -Path "C:\SeleniumWebDrivers\ChromeDriver\versioninfo.txt" + $geckodriverversion = Get-Content -Path "C:\SeleniumWebDrivers\GeckoDriver\versioninfo.txt" + $iedriverversion = Get-Content -Path "C:\SeleniumWebDrivers\IEDriver\versioninfo.txt" + + # Adding description of the software to Markdown + $SoftwareName = "Selenium Web Drivers" + + $Description = @" + +#### Chrome Driver + +_version:_ +$chromedriverversion + +_Environment:_ +* ChromeWebDriver: location of chromedriver.exe + +#### Gecko Driver + +_version:_ +$geckodriverversion + +_Environment:_ +* GeckoWebDriver: location of geckodriver.exe + +#### IE Driver + +_version:_ +$iedriverversion + +_Environment:_ +* IEWebDriver: location of IEDriverServer.exe + +"@ + + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + + exit 0 +} +else +{ + Write-Host "Selenium Web Drivers are not installed." + exit 1 +} diff --git a/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 b/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 new file mode 100644 index 000000000..e893c0149 --- /dev/null +++ b/images/win/scripts/Installers/Validate-ServiceFabricSDK.ps1 @@ -0,0 +1,44 @@ +################################################################################ +## File: Validate-ServiceFabricSDK.ps1 +## Desc: Validate ServiceFabricSDK +################################################################################ + +$modules = Get-Module -Name ServiceFabric -ListAvailable + +if(($modules | Measure-Object).Count -gt 0) +{ + $modules +} +else { + Write-Host "ServiceFabric Module is not present, it might not be installed" + throw "ServiceFabric Module is not present, it might not be installed" +} + + +function Get-ServiceFabricSDKVersion +{ + $regKey = "HKLM:\Software\Microsoft\Service Fabric SDK" + $installedApplications = Get-ItemProperty -Path $regKey + $Version = (Get-ItemProperty -Path $regKey).FabricSDKVersion + return $Version +} + + +function Get-ServiceFabricVersion +{ + $regKey = "HKLM:\Software\Microsoft\Service Fabric" + $installedApplications = Get-ItemProperty -Path $regKey + $Version = (Get-ItemProperty -Path $regKey).FabricVersion + return $Version +} + + +# Adding description of the software to Markdown +$SoftwareName = "Azure Service Fabric" + +$Description = @" +_SDK Version:_ $(Get-ServiceFabricSDKVersion)
+_Runtime Version:_ $(Get-ServiceFabricVersion) +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Svn.ps1 b/images/win/scripts/Installers/Validate-Svn.ps1 new file mode 100644 index 000000000..1e9b141a8 --- /dev/null +++ b/images/win/scripts/Installers/Validate-Svn.ps1 @@ -0,0 +1,28 @@ +################################################################################ +## File: Validate-Svn.ps1 +## Desc: Validate Subversion +################################################################################ + +if(Get-Command -Name 'svn') +{ + Write-Host "Subversion $(svn --version --quiet) is on the path." +} +else +{ + Write-Host "Subversion is not on the path." + exit 1 +} + + +$svnVersion = $(svn --version --quiet) + +# Adding description of the software to Markdown +$SoftwareName = "Subversion" + +$Description = @" +_Version:_ $svnVersion
+_Environment:_ +* PATH: contains location of svn.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-ToolCache.ps1 b/images/win/scripts/Installers/Validate-ToolCache.ps1 new file mode 100644 index 000000000..028f13192 --- /dev/null +++ b/images/win/scripts/Installers/Validate-ToolCache.ps1 @@ -0,0 +1,94 @@ +################################################################################ +## File: Validate-ToolCache.ps1 +## Desc: Validate Tool Cache +################################################################################ + +# Helpers +function GetChildFolders { + param ( + [Parameter(Mandatory = $True)] + [string]$Path + ) + return Get-ChildItem -Path $Path -Directory -Name +} + +function ToolcacheTest { + param ( + [Parameter(Mandatory = $True)] + [string]$SoftwareName, + [Parameter(Mandatory = $True)] + [string[]]$ExecTests, + [Parameter(Mandatory = $True)] + [string]$Note + ) + if (Test-Path "$env:AGENT_TOOLSDIRECTORY\$SoftwareName") + { + $description = "" + [array]$versions = GetChildFolders -Path "$env:AGENT_TOOLSDIRECTORY\$SoftwareName" + if ($versions.count -gt 0){ + foreach ($version in $versions) + { + $architectures = GetChildFolders -Path "$env:AGENT_TOOLSDIRECTORY\$SoftwareName\$version" + + Write-Host "$SoftwareName version - $version : $([system.String]::Join(",", $architectures))" + + foreach ($arch in $architectures) + { + $path = "$env:AGENT_TOOLSDIRECTORY\$SoftwareName\$version\$arch" + foreach ($test in $ExecTests) + { + if (Test-Path "$path\$test") + { + Write-Host "$SoftwareName($test) $version($arch) is successfully installed:" + Write-Host (& "$path\$test" --version) + } + else + { + Write-Host "$SoftwareName($test) $version ($arch) is not installed" + exit 1 + } + } + + $description += "_Version:_ $version ($arch)
" + } + } + + $description += $Note + Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $description + } + else + { + Write-Host "$env:AGENT_TOOLSDIRECTORY\$SoftwareName does not include any folders" + exit 1 + } + } + else + { + Write-Host "$env:AGENT_TOOLSDIRECTORY\$SoftwareName does not exist" + exit 1 + } +} + +# Python test +$PythonNote += @" +
+> Note: These versions of Python are available through the [Use Python Version](https://go.microsoft.com/fwlink/?linkid=871498) task. +"@ +$PythonTests = @("python.exe", "Scripts\pip.exe") +ToolcacheTest -SoftwareName "Python" -ExecTests $PythonTests -Note $PythonNote + +# PyPy test +$PyPyNote += @" +
+> Note: These versions of PyPy are available through the [Use Python Version](https://go.microsoft.com/fwlink/?linkid=871498) task. +"@ +$PyPyTests = @("python.exe", "bin\pip.exe") +ToolcacheTest -SoftwareName "PyPy" -ExecTests $PyPyTests -Note $PyPyNote + +# Ruby test +$RubyNote += @" +
+> Note: These versions of Ruby are available through the [Use Ruby Version](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/use-ruby-version) task. +"@ +$RubyTests = @("bin\ruby.exe") +ToolcacheTest -SoftwareName "Ruby" -ExecTests $RubyTests -Note $RubyNote diff --git a/images/win/scripts/Installers/Validate-TypeScript.ps1 b/images/win/scripts/Installers/Validate-TypeScript.ps1 new file mode 100644 index 000000000..430e64561 --- /dev/null +++ b/images/win/scripts/Installers/Validate-TypeScript.ps1 @@ -0,0 +1,27 @@ +################################################################################ +## File: Validate-TypeScript.ps1 +## Team: CI Build +## Desc: Validate Typescript Installation +################################################################################ + +if(Get-Command -Name 'tsc') +{ + Write-Host "TypeScript $(tsc --version) is on the path." +} +else +{ + Write-Host "TypeScript is not on the path." + exit 1 +} + + +$typescriptVersion = $(tsc --version) + +# Adding description of the software to Markdown +$SoftwareName = "TypeScript" + +$Description = @" +_Version:_ $typescriptVersion
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-Vcpkg.ps1 b/images/win/scripts/Installers/Validate-Vcpkg.ps1 new file mode 100644 index 000000000..834acf0bb --- /dev/null +++ b/images/win/scripts/Installers/Validate-Vcpkg.ps1 @@ -0,0 +1,46 @@ +################################################################################ +## File: Validate-Vcpkg.ps1 +## Desc: Validate vcpkg Cli +################################################################################ + +if (Get-Command -Name 'Vcpkg') +{ + Write-Host 'Vcpkg is succesfully installed:' + vcpkg version | Write-Host +} +else +{ + Write-Host 'Vcpkg is not on PATH' + exit 1 +} + +if ($env:VCPKG_INSTALLATION_ROOT) +{ + Write-Host "The VCPKG_INSTALLATION_ROOT environment variable is set" + Write-Host $env:VCPKG_INSTALLATION_ROOT +} +else +{ + Write-Host "The VCPKG_INSTALLATION_ROOT environment variable is not set" + exit 1 +} + +# Adding description of the software to Markdown + +# `vcpkg version` gives output like: +# Vcpkg package management program version 2018.11.23-nohash +# +# See LICENSE.txt for license information. + +$SoftwareName = 'Vcpkg' +$(vcpkg version).Split([System.Environment]::NewLine)[0] -match "\d+.\d+.\d+.*" +$VcpkgVersion = $Matches[0] + +$Description = @" +_Version:_ $VcpkgVersion
+_Environment:_ +* PATH: contains location of the vcpkg directory +* VCPKG_INSTALLATION_ROOT: root directory of the vcpkg installation +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Validate-WinAppDriver.ps1 b/images/win/scripts/Installers/Validate-WinAppDriver.ps1 new file mode 100644 index 000000000..9852b3458 --- /dev/null +++ b/images/win/scripts/Installers/Validate-WinAppDriver.ps1 @@ -0,0 +1,45 @@ +################################################################################ +## File: Validate-WinAppDriver.ps1 +## Desc: Validate WinAppDriver installation +################################################################################ + +$wad = "Windows Application Driver"; +if (${Env:ProgramFiles(x86)}) +{ + $wadPath = "${Env:ProgramFiles(x86)}\$wad" +} +else +{ + $wadPath = "${Env:ProgramFiles}\$wad" +} + +if(Test-Path $wadPath -PathType Any) +{ + Write-Host "WinAppDriver directory found." +} +else +{ + Write-Host "Failed to locate WinAppDriver directory. Exiting." + exit 1 +} + +#Validate if Developer Mode is enabled +$path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"; +if((Get-ItemProperty -Path $path | Select-Object -ExpandProperty "AllowDevelopmentWithoutDevLicense") -eq 1) +{ + Write-Host "Developer Mode is successfully provisioned." +} +else +{ + Write-Host "Developer Mode was not successfully provisioned." + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "WinAppDriver" +$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe").FileVersion +$Description = @" +_Version:_ $version
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 b/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 new file mode 100644 index 000000000..0cbb5c771 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Initialize-VM.ps1 @@ -0,0 +1,145 @@ +################################################################################ +## File: Initialize-VM.ps1 +## Desc: VM initialization script, machine level configuration +################################################################################ + +function Disable-InternetExplorerESC { + $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" + $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" + Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force + Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force + Stop-Process -Name Explorer -Force -ErrorAction Continue + Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." +} + +function Disable-InternetExplorerWelcomeScreen { + $AdminKey = "HKLM:\Software\Policies\Microsoft\Internet Explorer\Main" + New-Item -Path $AdminKey -Value 1 -Force + Set-ItemProperty -Path $AdminKey -Name "DisableFirstRunCustomize" -Value 1 -Force + Write-Host "Disabled IE Welcome screen" +} + +function Disable-UserAccessControl { + Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 00000000 -Force + Write-Host "User Access Control (UAC) has been disabled." +} + +Import-Module -Name ImageHelpers -Force + +Write-Host "Setup PowerShellGet" +# Set-PSRepository -InstallationPolicy Trusted -Name PSGallery +Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force +Install-Module -Name PowerShellGet -Force +Set-PSRepository -InstallationPolicy Trusted -Name PSGallery + + +Write-Host "Disable Antivirus" +Set-MpPreference -DisableRealtimeMonitoring $true + +# Disable Windows Update +$AutoUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" +If (Test-Path -Path $AutoUpdatePath) { + Set-ItemProperty -Path $AutoUpdatePath -Name NoAutoUpdate -Value 1 + Write-Host "Disabled Windows Update" +} +else { + Write-Host "Windows Update key does not exist" +} + +# Install .NET Framework 3.5 (required by Chocolatey) +Install-WindowsFeature -Name NET-Framework-Features -IncludeAllSubFeature +# Explicitly install all 4.7 sub features to include ASP.Net. +# As of 1/16/2019, WinServer 19 lists .Net 4.7 as NET-Framework-45-Features +Install-WindowsFeature -Name NET-Framework-45-Features -IncludeAllSubFeature + +Write-Host "Disable UAC" +Disable-UserAccessControl + +Write-Host "Disable IE Welcome Screen" +Disable-InternetExplorerWelcomeScreen + +Write-Host "Disable IE ESC" +Disable-InternetExplorerESC + +Write-Host "Setting local execution policy" +Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope LocalMachine -ErrorAction Continue | Out-Null +Get-ExecutionPolicy -List + +Write-Host "Enable long path behavior" +# See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation +Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 + +Write-Host "Install chocolatey" +$chocoExePath = 'C:\ProgramData\Chocolatey\bin' + +if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower())) { + Write-Host "Chocolatey found in PATH, skipping install..." + Exit +} + +# Add to system PATH +$systemPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine) +$systemPath += ';' + $chocoExePath +[Environment]::SetEnvironmentVariable("PATH", $systemPath, [System.EnvironmentVariableTarget]::Machine) + +# Update local process' path +$userPath = [Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User) +if ($userPath) { + $env:Path = $systemPath + ";" + $userPath +} +else { + $env:Path = $systemPath +} + +# Run the installer +Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) + +# Turn off confirmation +choco feature enable -n allowGlobalConfirmation + +# Install webpi +choco install webpicmd -y + +# Expand disk size of OS drive + +New-Item -Path d:\ -Name cmds.txt -ItemType File -Force + +Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" + +$expandResult = (diskpart /s 'd:\cmds.txt') + +Write-Host $expandResult + +Write-Host "Disk sizes after expansion" + +wmic logicaldisk get size,freespace,caption + + +# Adding description of the software to Markdown + +$Content = @" +# Azure Pipelines Hosted Windows 2019 + +The following software is installed on machines in the Azure Pipelines **Hosted Windows 2019** (v$env:ImageVersion) pool. + +Components marked with **\*** have been upgraded since the previous version of the image. + +"@ + +Add-ContentToMarkdown -Content $Content + + +$SoftwareName = "Chocolatey" + +if( $( $(choco version) | Out-String) -match 'Chocolatey v(?.*).*' ) +{ + $chocoVersion = $Matches.version.Trim() +} + +$Description = @" +_Version:_ $chocoVersion
+_Environment:_ +* PATH: contains location for choco.exe +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2019/Install-Python.ps1 b/images/win/scripts/Installers/Windows2019/Install-Python.ps1 new file mode 100644 index 000000000..4bc73c567 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Install-Python.ps1 @@ -0,0 +1,28 @@ +################################################################################ +## File: Install-Python.ps1 +## Desc: Configure python on path with 3.7.* version from the tools cache +## Must run after tools cache is setup +################################################################################ + +Import-Module -Name ImageHelpers -Force + +$python37path = $Env:AGENT_TOOLSDIRECTORY + '/Python/3.7*/x64' +$pythonDir = Get-Item -Path $python37path + +if($pythonDir -is [array]) +{ + Write-Host "More than one python 3.7.* installations found" + Write-Host $pythonDir + exit 1 +} + +$currentPath = Get-MachinePath + +if ($currentPath | Select-String -SimpleMatch $pythonDir.FullName) +{ + Write-Host $pythonDir.FullName ' is already in PATH' + exit 0 +} + +Add-MachinePathItem -PathItem $pythonDir.FullName +Add-MachinePathItem -PathItem "$($pythonDir.FullName)\Scripts" diff --git a/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 new file mode 100644 index 000000000..3e64e6fd9 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Install-VS2019.ps1 @@ -0,0 +1,188 @@ +################################################################################ +## File: Install-VS2019.ps1 +## Desc: Install Visual Studio 2019 +################################################################################ +$ErrorActionPreference = "Stop" + +Function InstallVS +{ + Param + ( + [String]$WorkLoads, + [String]$Sku, + [String] $VSBootstrapperURL + ) + + $exitCode = -1 + + try + { + Write-Host "Enable short name support on Windows needed for Xamarin Android AOT, defaults appear to have been changed in Azure VMs" + $shortNameEnableProcess = Start-Process -FilePath fsutil.exe -ArgumentList ('8dot3name', 'set', '0') -Wait -PassThru + $shortNameEnableExitCode = $shortNameEnableProcess.ExitCode + + if ($shortNameEnableExitCode -ne 0) + { + Write-Host -Object 'Enabling short name support on Windows failed. This needs to be enabled prior to VS 2017 install for Xamarin Andriod AOT to work.' + exit $shortNameEnableExitCode + } + + Write-Host "Downloading Bootstrapper ..." + Invoke-WebRequest -Uri $VSBootstrapperURL -OutFile "${env:Temp}\vs_$Sku.exe" + + $FilePath = "${env:Temp}\vs_$Sku.exe" + $Arguments = ('/c', $FilePath, $WorkLoads, '--quiet', '--norestart', '--wait', '--nocache' ) + + Write-Host "Starting Install ..." + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + + # this wont work because of log size limitation in extension manager + # Get-Content $customLogFilePath | Write-Host + + exit $exitCode + } + } + catch + { + Write-Host -Object "Failed to install Visual Studio. Check the logs for details in $customLogFilePath" + Write-Host -Object $_.Exception.Message + exit -1 + } +} + +$WorkLoads = '--allWorkloads --includeRecommended ' + ` + '--add Component.Dotfuscator ' + ` + '--add Component.Linux.CMake ' + ` + '--add Component.UnityEngine.x64 ' + ` + '--add Component.UnityEngine.x86 ' + ` + '--add Component.Unreal.Android ' + ` + '--add Microsoft.Component.Azure.DataLake.Tools ' + ` + '--add Microsoft.Component.CookiecutterTools ' + ` + '--add Microsoft.Component.PythonTools.Miniconda ' + ` + '--add Microsoft.Component.PythonTools.Web ' + ` + '--add Microsoft.Component.VC.Runtime.UCRTSDK ' + ` + '--add Microsoft.Net.ComponentGroup.4.6.2.DeveloperTools ' + ` + '--add Microsoft.Net.ComponentGroup.4.7.1.DeveloperTools ' + ` + '--add Microsoft.Net.ComponentGroup.4.7.DeveloperTools ' + ` + '--add Microsoft.VisualStudio.Component.AspNet45 ' + ` + '--add Microsoft.VisualStudio.Component.Azure.Kubernetes.Tools ' + ` + '--add Microsoft.VisualStudio.Component.Azure.MobileAppsSdk ' + ` + '--add Microsoft.VisualStudio.Component.Azure.ServiceFabric.Tools ' + ` + '--add Microsoft.VisualStudio.Component.Azure.Storage.AzCopy ' + ` + '--add Microsoft.VisualStudio.Component.Debugger.JustInTime ' + ` + '--add Microsoft.VisualStudio.Component.DslTools ' + ` + '--add Microsoft.VisualStudio.Component.EntityFramework ' + ` + '--add Microsoft.VisualStudio.Component.FSharp.Desktop ' + ` + '--add Microsoft.VisualStudio.Component.LinqToSql ' + ` + '--add Microsoft.VisualStudio.Component.PortableLibrary ' + ` + '--add Microsoft.VisualStudio.Component.TeamOffice ' + ` + '--add Microsoft.VisualStudio.Component.TestTools.CodedUITest ' + ` + '--add Microsoft.VisualStudio.Component.TestTools.WebLoadTest ' + ` + '--add Microsoft.VisualStudio.Component.UWP.VC.ARM64 ' + ` + '--add Microsoft.VisualStudio.Component.VC.140 ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATL.ARM ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATLMFC ' + ` + '--add Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.CLI.Support ' + ` + '--add Microsoft.VisualStudio.Component.VC.CMake.Project ' + ` + '--add Microsoft.VisualStudio.Component.VC.DiagnosticTools ' + ` + '--add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ' + ` + '--add Microsoft.VisualStudio.Component.VC.MFC.ARM ' + ` + '--add Microsoft.VisualStudio.Component.VC.MFC.ARM.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.MFC.ARM64 ' + ` + '--add Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre ' + ` + '--add Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest ' + ` + '--add Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest ' + ` + '--add Microsoft.VisualStudio.Component.VC.v141 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.16299 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.17134 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ' + ` + '--add Microsoft.VisualStudio.Component.Windows10SDK.18362 ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.Azure.CloudServices ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.Azure.ResourceManager.Tools ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang ' + ` + '--add Microsoft.VisualStudio.ComponentGroup.Web.CloudTools ' + ` + '--add Microsoft.VisualStudio.Workload.Azure ' + ` + '--add Microsoft.VisualStudio.Workload.Data ' + ` + '--add Microsoft.VisualStudio.Workload.DataScience ' + ` + '--add Microsoft.VisualStudio.Workload.ManagedDesktop ' + ` + '--add Microsoft.VisualStudio.Workload.ManagedGame ' + ` + '--add Microsoft.VisualStudio.Workload.NativeCrossPlat ' + ` + '--add Microsoft.VisualStudio.Workload.NativeDesktop ' + ` + '--add Microsoft.VisualStudio.Workload.NativeGame ' + ` + '--add Microsoft.VisualStudio.Workload.NativeMobile ' + ` + '--add Microsoft.VisualStudio.Workload.NetCoreTools ' + ` + '--add Microsoft.VisualStudio.Workload.NetCrossPlat ' + ` + '--add Microsoft.VisualStudio.Workload.NetWeb ' + ` + '--add Microsoft.VisualStudio.Workload.Node ' + ` + '--add Microsoft.VisualStudio.Workload.Office ' + ` + '--add Microsoft.VisualStudio.Workload.Python ' + ` + '--remove Component.CPython3.x64 ' + ` + '--add Microsoft.VisualStudio.Workload.Universal ' + ` + '--add Microsoft.VisualStudio.Workload.VisualStudioExtension' + + +$ReleaseInPath = 'Enterprise' +$Sku = 'Enterprise' +$VSBootstrapperURL = 'https://aka.ms/vs/16/release/vs_Enterprise.exe' + +$ErrorActionPreference = 'Stop' + +# Install VS +$exitCode = InstallVS -WorkLoads $WorkLoads -Sku $Sku -VSBootstrapperURL $VSBootstrapperURL + +# Find the version of VS installed for this instance +# Only supports a single instance +$vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" +$instanceFolders = Get-ChildItem -Path $vsProgramData.FullName + +if($instanceFolders -is [array]) +{ + Write-Host "More than one instance installed" + exit 1 +} + +$catalogContent = Get-Content -Path ($instanceFolders.FullName + '\catalog.json') +$catalog = $catalogContent | ConvertFrom-Json +$version = $catalog.info.id +Write-Host "Visual Studio version" $version "installed" + +# Initialize Visual Studio Experimental Instance +&"C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings /Command File.Exit + +# Updating content of MachineState.json file to disable autoupdate of VSIX extensions +$newContent = '{"Extensions":[{"Key":"1e906ff5-9da8-4091-a299-5c253c55fdc9","Value":{"ShouldAutoUpdate":false}},{"Key":"Microsoft.VisualStudio.Web.AzureFunctions","Value":{"ShouldAutoUpdate":false}}],"ShouldAutoUpdate":false,"ShouldCheckForUpdates":false}' +Set-Content -Path "C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath\Common7\IDE\Extensions\MachineState.json" -Value $newContent + + +# Adding description of the software to Markdown + +$SoftwareName = "Visual Studio 2019 Enterprise" + +$Description = @" +_Version:_ $version
+_Location:_ C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath + +The following workloads and components are installed with Visual Studio 2019: +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +# Adding explicitly added Workloads details to markdown by parsing $Workloads +Add-ContentToMarkdown -Content $($WorkLoads.Split('--') | % { if( ($_.Split(" "))[0] -like "add") { "* " +($_.Split(" "))[1] } } ) + + +exit $exitCode diff --git a/images/win/scripts/Installers/Windows2019/Install-WDK.ps1 b/images/win/scripts/Installers/Windows2019/Install-WDK.ps1 new file mode 100644 index 000000000..192e47892 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Install-WDK.ps1 @@ -0,0 +1,53 @@ +################################################################################ +## File: Install-WDK.ps1 +## Desc: Install the Windows Driver Kit +################################################################################ + +# Version: 10.0.17763.0 +# Update Validate-WDK.ps1 if the version changes! +# There doesn't seem to be any way to check the version programmatically + +# Requires Windows SDK with the same version number as the WDK +$winSdkUrl = "https://go.microsoft.com/fwlink/p/?LinkID=2023014" +$wdkUrl = "https://go.microsoft.com/fwlink/?linkid=2026156" + +# `winsdksetup.exe /features + /quiet` installs all features without showing the GUI +$sdkExitCode = Install-EXE -Url $winSdkUrl -Name "winsdksetup.exe" -ArgumentList ("/features", "+", "/quiet") + +if ($sdkExitCode -ne 0) +{ + Write-Host "Failed to install the Windows SDK." + exit $sdkExitCode +} + +# `wdksetup.exe /features + /quiet` installs all features without showing the GUI +$wdkExitCode = Install-EXE -Url $wdkUrl -Name "wdksetup.exe" -ArgumentList ("/features", "+", "/quiet") + +if ($wdkExitCode -ne 0) +{ + Write-Host "Failed to install the Windows Driver Kit." + exit $wdkExitCode +} + +# Need to install the VSIX to get the build targets when running VSBuild +# Write-Host "Installing WDK.vsix" +<# ISSUE - VSIX installer failing on VS2019 + $process = Start-Process ` + -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VSIXInstaller.exe" ` + -ArgumentList ("/quiet", '"C:\Program Files (x86)\Windows Kits\10\Vsix\WDK.vsix"') ` + -Wait ` + -PassThru + + $exitCode = $process.ExitCode + +if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed +{ + Write-Host "WDK.vsix installed successfully" +} +else +{ + Write-Host "Unsuccessful exit code returned by the installation process: $exitCode." +} + +exit $exitCode +#> diff --git a/images/win/scripts/Installers/Windows2019/Install-Wix.ps1 b/images/win/scripts/Installers/Windows2019/Install-Wix.ps1 new file mode 100644 index 000000000..1e4332890 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Install-Wix.ps1 @@ -0,0 +1,53 @@ +################################################################################ +## File: Install-Wix.ps1 +## Desc: Install WIX. +################################################################################ +function Install-VsixExtension +{ + Param + ( + [String]$Url, + [String]$Name + ) + + $ReleaseInPath = 'Enterprise' + $exitCode = -1 + + try + { + Write-Host "Downloading $Name..." + $FilePath = "${env:Temp}\$Name" + + Invoke-WebRequest -Uri $Url -OutFile $FilePath + + $ArgumentList = ('/quiet', $FilePath) + + Write-Host "Starting Install $Name..." + $process = Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\$ReleaseInPath\Common7\IDE\VSIXInstaller.exe" -ArgumentList $ArgumentList -Wait -PassThru + $exitCode = $process.ExitCode + + if ($exitCode -eq 0 -or $exitCode -eq 3010) + { + Write-Host -Object 'Installation successful' + return $exitCode + } + else + { + Write-Host -Object "Non zero exit code returned by the installation process : $exitCode." + return $exitCode + } + } + catch + { + Write-Host -Object "Failed to install the Extension $Name" + Write-Host -Object $_.Exception.Message + return -1 + } +} + + +choco install wixtoolset -y --force + +#Installing VS extension 'Wix Toolset Visual Studio 2019 Extension' +$exitCode = Install-VsixExtension -Url 'https://wixtoolset.gallerycdn.vsassets.io/extensions/wixtoolset/wixtoolsetvisualstudio2019extension/1.0.0.4/1563296438961/Votive2019.vsix' -Name 'Votive2019.vsix' +#return $exitCode diff --git a/images/win/scripts/Installers/Windows2019/Run-Antivirus.ps1 b/images/win/scripts/Installers/Windows2019/Run-Antivirus.ps1 new file mode 100644 index 000000000..bf57ed306 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Run-Antivirus.ps1 @@ -0,0 +1,27 @@ +################################################################################ +## File: Run-Antivirus.ps1 +## Desc: Run a full antivirus scan. +## Run right after cleanup before we sysprep +################################################################################ + +Write-Host "Make sure windefend is going to start" +Start-Service windefend -ErrorAction Continue + +Write-Host "Waiting for windefend to report as running" +$service = Get-Service "Windefend" +$service.WaitForStatus("Running","00:10:00") + +Write-Host "Run antivirus" +Push-Location "C:\Program Files\Windows Defender" + +# Tell Defender to use 100% of the CPU during the scan +Set-MpPreference -ScanAvgCPULoadFactor 100 + +# Full Scan +.\MpCmdRun.exe -Scan -ScanType 2 +Pop-Location + +Update-MpSignature +Write-Host "Set antivirus parmeters" +Set-MpPreference -ScanAvgCPULoadFactor 5 ` + -ExclusionPath "D:\", "C:\" diff --git a/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 b/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 new file mode 100644 index 000000000..8aa369f2f --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Update-DockerImages.ps1 @@ -0,0 +1,36 @@ +################################################################################ +## File: Update-DockerImages.ps1 +## Desc: Pull some standard docker images. +## Must be run after docker is installed. +################################################################################ + +function DockerPull { + Param ([string]$image) + + Write-Host Installing $image ... + docker pull $image + + if (!$?) { + echo "Docker pull failed with a non-zero exit code" + exit 1 + } +} + +DockerPull mcr.microsoft.com/windows/servercore:ltsc2019 +DockerPull mcr.microsoft.com/windows/nanoserver:1809 +DockerPull microsoft/aspnetcore-build:1.0-2.0 +DockerPull mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 +DockerPull mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019 + + +# Adding description of the software to Markdown + +$SoftwareName = "Docker images" + +$Description = @" +The following container images have been cached: +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description + +Add-ContentToMarkdown -Content $(docker images --digests --format "* {{.Repository}}:{{.Tag}} (Digest: {{.Digest}})") diff --git a/images/win/scripts/Installers/Windows2019/Validate-WDK.ps1 b/images/win/scripts/Installers/Windows2019/Validate-WDK.ps1 new file mode 100644 index 000000000..3d2b8c6a4 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Validate-WDK.ps1 @@ -0,0 +1,13 @@ +################################################################################ +## File: Validate-WDK.ps1 +## Desc: Validate the installation of the Windows Driver Kit +################################################################################ + +# Adding description of the software to Markdown +$SoftwareName = "Windows Driver Kit" + +$Description = @" +_Version:_ 10.0.17763.0
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/Installers/Windows2019/Validate-Wix.ps1 b/images/win/scripts/Installers/Windows2019/Validate-Wix.ps1 new file mode 100644 index 000000000..1eddcd6a6 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Validate-Wix.ps1 @@ -0,0 +1,61 @@ +################################################################################ +## File: Validate-Wix.ps1 +## Desc: Validate WIX. +################################################################################ + +Import-Module -Name ImageHelpers -Force +function Get-WixVersion { + $regKey = "HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" + $installedApplications = Get-ItemProperty -Path $regKey + $Version = ($installedApplications | Where-Object { $_.DisplayName -and $_.DisplayName.toLower().Contains("wix") } | Select-Object -First 1).DisplayVersion + return $Version +} + +#Gets the extension details from state.json +function Get-WixExtensionPackage { + $vsProgramData = Get-Item -Path "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances" + $instanceFolders = Get-ChildItem -Path $vsProgramData.FullName + + if($instanceFolders -is [array]) + { + Write-Host "More than one instance installed" + exit 1 + } + + $stateContent = Get-Content -Path ($instanceFolders.FullName + '\state.packages.json') + $state = $stateContent | ConvertFrom-Json + $WixPackage = $state.packages | where { $_.id -eq "WixToolset.VisualStudioExtension.Dev16" } + return $WixPackage +} + +$WixToolSetVersion = Get-WixVersion + +if($WixToolSetVersion) { + Write-Host "Wix Toolset version" $WixPackage.version "installed" +} +else { + Write-Host "Wix Toolset is not installed" + exit 1 +} + +$WixPackage = Get-WixExtensionPackage + +if($WixPackage) { + Write-Host "Wix Extension version" $WixPackage.version "installed" +} +else { + Write-Host "Wix Extension is not installed" + exit 1 +} + +# Adding description of the software to Markdown +$SoftwareName = "WIX Tools" + +$Description = @" +_Toolset Version:_ $WixToolSetVersion
+_WIX Toolset Visual Studio Extension Version:_ $($WixPackage.version)
+_Environment:_ +* WIX: Installation root of WIX +"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description diff --git a/images/win/scripts/README.md b/images/win/scripts/README.md new file mode 100644 index 000000000..cde361cd4 --- /dev/null +++ b/images/win/scripts/README.md @@ -0,0 +1 @@ +Common scripts for all Windows images. \ No newline at end of file