[Ubuntu] Add Ubuntu Server 22.04 LTS template (#5454)

This commit is contained in:
Aleksandr Chebotov
2022-05-02 10:46:10 +02:00
committed by GitHub
parent 623df76820
commit 9d80842cc3
23 changed files with 833 additions and 89 deletions

View File

@@ -0,0 +1,20 @@
schedules:
- cron: "0 0 * * *"
displayName: Daily
branches:
include:
- main
always: true
trigger: none
pr:
autoCancel: true
branches:
include:
- main
jobs:
- template: image-generation.yml
parameters:
image_type: ubuntu2204
image_readme_name: Ubuntu2204-Readme.md

View File

@@ -0,0 +1,2 @@
# Name of pool supported by this image
POOL_NAME="Ubuntu 2204"

View File

@@ -47,17 +47,21 @@ function Build-CachedToolsSection {
$output += New-MDHeader "Go" -Level 4
$output += New-MDList -Lines (Get-ToolcacheGoVersions) -Style Unordered
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$output += New-MDHeader "Node.js" -Level 4
$output += New-MDList -Lines (Get-ToolcacheNodeVersions) -Style Unordered
}
$output += New-MDHeader "PyPy" -Level 4
$output += New-MDList -Lines (Get-ToolcachePyPyVersions) -Style Unordered
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$output += New-MDHeader "Python" -Level 4
$output += New-MDList -Lines (Get-ToolcachePythonVersions) -Style Unordered
$output += New-MDHeader "Ruby" -Level 4
$output += New-MDList -Lines (Get-ToolcacheRubyVersions) -Style Unordered
}
return $output
}

View File

@@ -17,7 +17,7 @@ function Get-SqliteVersion {
function Get-MySQLVersion {
$mySQLVersion = mysqld --version | Take-OutputPart -Part 2
if (-not (Test-IsUbuntu20)) {
if (Test-IsUbuntu18) {
$mySQLVersion = $mySQLVersion | Take-OutputPart -Part 0 -Delimiter "-"
}
return "MySQL $mySQLVersion"

View File

@@ -41,22 +41,27 @@ $runtimesList = @(
(Get-BashVersion),
(Get-CPPVersions),
(Get-FortranVersions),
(Get-ErlangVersion),
(Get-ErlangRebar3Version),
(Get-MonoVersion),
(Get-MsbuildVersion),
(Get-NodeVersion),
(Get-PerlVersion),
(Get-PythonVersion),
(Get-Python3Version),
(Get-RubyVersion),
(Get-SwiftVersion),
(Get-JuliaVersion),
(Get-KotlinVersion),
(Get-ClangVersions),
(Get-ClangFormatVersions)
)
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$runtimesList += @(
(Get-MsbuildVersion),
(Get-KotlinVersion),
(Get-MonoVersion),
(Get-ErlangVersion),
(Get-ErlangRebar3Version),
(Get-SwiftVersion)
)
}
$markdown += New-MDList -Style Unordered -Lines ($runtimesList | Sort-Object)
$markdown += New-MDHeader "Package Management" -Level 3
@@ -81,14 +86,17 @@ $markdown += Build-PackageManagementEnvironmentTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Project Management" -Level 3
$projectManagementList = @(
$projectManagementList = @()
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$projectManagementList += @(
(Get-AntVersion),
(Get-GradleVersion),
(Get-MavenVersion),
(Get-SbtVersion)
)
}
if (Test-IsUbuntu20) {
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
$projectManagementList += @(
(Get-LernaVersion)
)
@@ -103,7 +111,6 @@ $toolsList = @(
(Get-BazelVersion),
(Get-BazeliskVersion),
(Get-BicepVersion),
(Get-BuildahVersion),
(Get-CodeQLBundleVersion),
(Get-CMakeVersion),
(Get-DockerMobyClientVersion),
@@ -116,14 +123,12 @@ $toolsList = @(
(Get-GitFTPVersion),
(Get-HavegedVersion),
(Get-HerokuVersion),
(Get-HHVMVersion),
(Get-SVNVersion),
(Get-JqVersion),
(Get-YqVersion),
(Get-KindVersion),
(Get-KubectlVersion),
(Get-KustomizeVersion),
(Get-LeiningenVersion),
(Get-MediainfoVersion),
(Get-HGVersion),
(Get-MinikubeVersion),
@@ -133,18 +138,26 @@ $toolsList = @(
(Get-OpensslVersion),
(Get-PackerVersion),
(Get-ParcelVersion),
(Get-PhantomJSVersion),
(Get-PodManVersion),
(Get-PulumiVersion),
(Get-RVersion),
(Get-SkopeoVersion),
(Get-SphinxVersion),
(Get-TerraformVersion),
(Get-YamllintVersion),
(Get-ZstdVersion)
)
if (Test-IsUbuntu20) {
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$toolsList += @(
(Get-BuildahVersion),
(Get-PhantomJSVersion),
(Get-LeiningenVersion),
(Get-HHVMVersion),
(Get-PodManVersion),
(Get-SkopeoVersion)
)
}
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
$toolsList += (Get-FastlaneVersion)
}
@@ -168,11 +181,13 @@ $markdown += New-MDList -Style Unordered -Lines (@(
) | Sort-Object
)
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$markdown += New-MDHeader "Java" -Level 3
$markdown += Get-JavaVersions | New-MDTable
$markdown += New-MDNewLine
}
if (Test-IsUbuntu20) {
if ((Test-IsUbuntu20) -or (Test-IsUbuntu22)) {
$markdown += New-MDHeader "GraalVM" -Level 3
$markdown += Build-GraalVMTable | New-MDTable
$markdown += New-MDNewLine
@@ -214,11 +229,16 @@ $markdown += New-MDHeader "Browsers and Drivers" -Level 3
$browsersAndDriversList = @(
(Get-ChromeVersion),
(Get-ChromeDriverVersion),
(Get-ChromiumVersion)
)
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$browsersAndDriversList += @(
(Get-FirefoxVersion),
(Get-GeckodriverVersion),
(Get-ChromiumVersion),
(Get-SeleniumVersion)
)
}
$markdown += New-MDList -Style Unordered -Lines $browsersAndDriversList
$markdown += New-MDHeader "Environment variables" -Level 4
@@ -235,15 +255,23 @@ $tools = Get-DotnetTools
$markdown += New-MDList -Lines $tools -Style Unordered
$markdown += New-MDHeader "Databases" -Level 3
$markdown += New-MDList -Style Unordered -Lines (@(
(Get-MongoDbVersion),
$databaseLists = @(
(Get-SqliteVersion)
) | Sort-Object
)
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$databaseLists += @(
(Get-MongoDbVersion)
)
}
$markdown += New-MDList -Style Unordered -Lines ( $databaseLists | Sort-Object )
$markdown += Build-PostgreSqlSection
$markdown += Build-MySQLSection
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$markdown += Build-MSSQLToolsSection
}
$markdown += New-MDHeader "Cached Tools" -Level 3
$markdown += Build-CachedToolsSection
@@ -265,12 +293,14 @@ $markdown += New-MDList -Style Unordered -Lines @(
$markdown += Build-WebServersSection
if ((Test-IsUbuntu18) -or (Test-IsUbuntu20)) {
$markdown += New-MDHeader "Android" -Level 3
$markdown += Build-AndroidTable | New-MDTable
$markdown += New-MDNewLine
$markdown += New-MDHeader "Environment variables" -Level 4
$markdown += Build-AndroidEnvironmentTable | New-MDTable
$markdown += New-MDNewLine
}
$markdown += New-MDHeader "Cached Docker images" -Level 3
$markdown += Get-CachedDockerImagesTableData | New-MDTable

View File

@@ -0,0 +1,4 @@
#!/bin/bash -e
# https://github.com/hashicorp/packer/issues/11656
echo PubkeyAcceptedKeyTypes=+ssh-rsa >> /etc/ssh/sshd_config
systemctl reload sshd.service

View File

@@ -46,6 +46,10 @@ function Test-IsUbuntu20 {
return (lsb_release -rs) -eq "20.04"
}
function Test-IsUbuntu22 {
return (lsb_release -rs) -eq "22.04"
}
function Get-ToolsetContent {
$toolset = Join-Path $env:INSTALLER_SCRIPT_FOLDER "toolset.json"
Get-Content $toolset -Raw | ConvertFrom-Json
@@ -69,7 +73,7 @@ function Get-ToolsetValue {
function Get-AndroidPackages {
$androidSDKManagerPath = "/usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager"
$androidPackages = & $androidSDKManagerPath --list --verbose
$androidPackages = & $androidSDKManagerPath --list --verbose 2>&1
return $androidPackages
}

View File

@@ -14,6 +14,11 @@ function isUbuntu20
lsb_release -d | grep -q 'Ubuntu 20'
}
function isUbuntu22
{
lsb_release -d | grep -q 'Ubuntu 22'
}
function getOSVersionLabel
{
lsb_release -cs

View File

@@ -102,7 +102,7 @@ filter_components_by_version $minimumBuildToolVersion "${availableBuildTools[@]}
echo "y" | $SDKMANAGER ${components[@]}
# Old skdmanager from sdk tools doesn't work with Java > 8, set version 8 explicitly
if isUbuntu20; then
if isUbuntu20 || isUbuntu22; then
sed -i "2i export JAVA_HOME=${JAVA_HOME_8_X64}" ${ANDROID_SDK_ROOT}/tools/bin/sdkmanager
fi

View File

@@ -8,18 +8,16 @@
source $HELPER_SCRIPTS/os.sh
source $HELPER_SCRIPTS/install.sh
# Install the AWS CLI v1 Ubuntu18 and AWS CLI v2 on Ubuntu20
if isUbuntu20 ; then
download_with_retries "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" "/tmp" "awscliv2.zip"
unzip -qq /tmp/awscliv2.zip -d /tmp
/tmp/aws/install -i /usr/local/aws-cli -b /usr/local/bin
fi
# Install the AWS CLI v1 Ubuntu18 and AWS CLI v2 on Ubuntu20, Ubuntu22
# The installation should be run after python3 is installed as aws-cli V1 dropped python2 support
if isUbuntu18 ; then
download_with_retries "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" "/tmp" "awscli-bundle.zip"
unzip -qq /tmp/awscli-bundle.zip -d /tmp
python3 /tmp/awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
else
download_with_retries "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" "/tmp" "awscliv2.zip"
unzip -qq /tmp/awscliv2.zip -d /tmp
/tmp/aws/install -i /usr/local/aws-cli -b /usr/local/bin
fi
download_with_retries "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" "/tmp" "session-manager-plugin.deb"

View File

@@ -103,8 +103,8 @@ mv phpunit /usr/local/bin/phpunit
# ubuntu 20.04 libzip-dev is libzip5 based and is not compatible libzip-dev of ppa:ondrej/php
# see https://github.com/actions/virtual-environments/issues/1084
if isUbuntu20 ; then
rm /etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list
if isUbuntu20 || isUbuntu22; then
rm /etc/apt/sources.list.d/ondrej-*.list
apt-get update
fi

View File

@@ -4,5 +4,19 @@
## Desc: Installs powershellcore
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/os.sh
source $HELPER_SCRIPTS/install.sh
if isUbuntu22; then
# Install libssl1.1
download_with_retries "http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.2_amd64.deb" "/tmp"
dpkg -i /tmp/libssl1.1_1.1.1l-1ubuntu1.2_amd64.deb
# Install Powershell
download_with_retries "https://github.com/PowerShell/PowerShell/releases/download/v7.2.3/powershell-lts_7.2.3-1.deb_amd64.deb" "/tmp"
dpkg -i /tmp/powershell-lts_7.2.3-1.deb_amd64.deb
else
# Install Powershell
apt-get install -y powershell
fi

View File

@@ -6,6 +6,7 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/etc-environment.sh
source $HELPER_SCRIPTS/os.sh
export RUSTUP_HOME=/etc/skel/.rustup
export CARGO_HOME=/etc/skel/.cargo
@@ -17,7 +18,12 @@ source $CARGO_HOME/env
# Install common tools
rustup component add rustfmt clippy
if isUbuntu22; then
cargo install bindgen cbindgen cargo-audit cargo-outdated
else
cargo install --locked bindgen cbindgen cargo-audit cargo-outdated
fi
# Cleanup Cargo cache
rm -rf ${CARGO_HOME}/registry/*

View File

@@ -1,4 +1,6 @@
Describe "Android" {
if (Test-IsUbuntu22) { return }
$androidSdkManagerPackages = Get-AndroidPackages
[int]$platformMinVersion = Get-ToolsetValue "android.platform_min_version"
[version]$buildToolsMinVersion = Get-ToolsetValue "android.build_tools_min_version"

View File

@@ -1,4 +1,4 @@
Describe "Firefox" {
Describe "Firefox" -Skip:(Test-IsUbuntu22) {
It "Firefox" {
"sudo -i firefox --version" | Should -ReturnZeroExitCode
}

View File

@@ -29,7 +29,7 @@ Describe "PHP" {
}
}
Describe "Swift" {
Describe "Swift" -Skip:(Test-IsUbuntu22) {
It "swift" {
"swift --version" | Should -ReturnZeroExitCode
}

View File

@@ -1,4 +1,4 @@
Describe "MongoDB" {
Describe "MongoDB" -Skip:(Test-IsUbuntu22) {
It "<ToolName>" -TestCases @(
@{ ToolName = "mongo" }
@{ ToolName = "mongod" }

View File

@@ -1,6 +1,6 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1" -DisableNameChecking
Describe "Java" {
Describe "Java" -Skip:(Test-IsUbuntu22) {
$toolsetJava = (Get-ToolsetContent).java
$defaultVersion = $toolsetJava.default
$defaultVendor = $toolsetJava.default_vendor

View File

@@ -126,7 +126,7 @@ Describe "Cmake" {
}
}
Describe "erlang" {
Describe "erlang" -Skip:(Test-IsUbuntu22) {
$testCases = @("erl -version", "erlc -v", "rebar3 -v") | ForEach-Object { @{ErlangCommand = $_} }
It "erlang <ErlangCommand>" -TestCases $testCases {
@@ -162,7 +162,7 @@ Describe "gfortran" {
}
}
Describe "Mono" {
Describe "Mono" -Skip:(Test-IsUbuntu22) {
It "mono" {
"mono --version" | Should -ReturnZeroExitCode
}
@@ -176,7 +176,7 @@ Describe "Mono" {
}
}
Describe "MSSQLCommandLineTools" {
Describe "MSSQLCommandLineTools" -Skip:(Test-IsUbuntu22) {
It "sqlcmd" {
"sqlcmd -?" | Should -ReturnZeroExitCode
}
@@ -200,7 +200,7 @@ Describe "Sbt" {
}
}
Describe "Selenium" {
Describe "Selenium" -Skip:(Test-IsUbuntu22) {
It "Selenium is installed" {
$seleniumBinaryName = (Get-ToolsetContent).selenium.binary_name
$seleniumPath = Join-Path "/usr/share/java" "$seleniumBinaryName.jar"
@@ -244,7 +244,7 @@ Describe "Heroku" {
}
}
Describe "HHVM" {
Describe "HHVM" -Skip:(Test-IsUbuntu22) {
It "hhvm" {
"hhvm --version" | Should -ReturnZeroExitCode
}
@@ -292,7 +292,7 @@ Describe "Kubernetes tools" {
}
}
Describe "Leiningen" {
Describe "Leiningen" -Skip:(Test-IsUbuntu22) {
It "leiningen" {
"lein --version" | Should -ReturnZeroExitCode
}
@@ -316,13 +316,13 @@ Describe "Pulumi" {
}
}
Describe "Phantomjs" {
Describe "Phantomjs" -Skip:(Test-IsUbuntu22) {
It "phantomjs" {
"phantomjs --version" | Should -ReturnZeroExitCode
}
}
Describe "GraalVM" -Skip:(-not (Test-IsUbuntu20)) {
Describe "GraalVM" -Skip:(Test-IsUbuntu18) {
It "graalvm" {
'$GRAALVM_11_ROOT/bin/java -version' | Should -ReturnZeroExitCode
}
@@ -332,7 +332,7 @@ Describe "GraalVM" -Skip:(-not (Test-IsUbuntu20)) {
}
}
Describe "Containers" {
Describe "Containers" -Skip:(Test-IsUbuntu22) {
$testCases = @("podman", "buildah", "skopeo") | ForEach-Object { @{ContainerCommand = $_} }
It "<ContainerCommand>" -TestCases $testCases {
@@ -391,7 +391,7 @@ Describe "yq" {
}
}
Describe "Kotlin" {
Describe "Kotlin" -Skip:(Test-IsUbuntu22) {
It "kapt" {
"kapt -version"| Should -ReturnZeroExitCode
}

View File

@@ -0,0 +1,301 @@
{
"toolcache": [
{
"name": "PyPy",
"arch": "x64",
"platform" : "linux",
"versions": [
"3.7",
"3.8",
"3.9"
]
},
{
"name": "go",
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
"arch": "x64",
"platform" : "linux",
"versions": [
"1.17.*",
"1.18.*"
],
"default": "1.18.*"
},
{
"name": "CodeQL",
"platform" : "linux",
"arch": "x64",
"versions": [
"*"
]
}
],
"java": {
"default": "11",
"default_vendor": "Temurin-Hotspot",
"vendors": [
{
"name": "Temurin-Hotspot",
"versions": [ "8", "11", "17" ]
}
],
"maven": "3.8.5"
},
"android": {
"platform_min_version": "27",
"build_tools_min_version": "27.0.0",
"extra_list": [
"android;m2repository",
"google;m2repository",
"google;google_play_services"
],
"addon_list": [
],
"additional_tools": [
"cmake;3.10.2.4988404",
"cmake;3.18.1"
],
"ndk": {
"default": "21",
"versions": [
"21", "22", "23"
]
}
},
"powershellModules": [
{"name": "MarkdownPS"},
{"name": "Microsoft.Graph"},
{"name": "Pester"},
{"name": "PSScriptAnalyzer"}
],
"azureModules": [
{
"name": "az",
"url" : "https://raw.githubusercontent.com/Azure/az-ps-module-versions/main/versions-manifest.json",
"versions": [
"7.3.2"
],
"zip_versions": [
]
}
],
"apt": {
"common_packages": [
"autoconf",
"automake",
"build-essential",
"dbus",
"dnsutils",
"dpkg",
"fakeroot",
"fonts-noto-color-emoji",
"gnupg2",
"imagemagick",
"iproute2",
"iputils-ping",
"lib32z1",
"libc++abi-dev",
"libc++-dev",
"libcurl4",
"libgbm-dev",
"libgconf-2-4",
"libgsl-dev",
"libgtk-3-0",
"libmagic-dev",
"libmagickcore-dev",
"libmagickwand-dev",
"libsecret-1-dev",
"libsqlite3-dev",
"libtool",
"libunwind8",
"libxkbfile-dev",
"libxss1",
"libssl-dev",
"locales",
"mercurial",
"openssh-client",
"p7zip-rar",
"pkg-config",
"python-is-python3",
"rpm",
"texinfo",
"tk",
"tzdata",
"upx",
"xorriso",
"xvfb",
"xz-utils",
"zsync"
],
"cmd_packages": [
"acl",
"aria2",
"binutils",
"bison",
"brotli",
"bzip2",
"coreutils",
"curl",
"file",
"flex",
"ftp",
"haveged",
"jq",
"m4",
"mediainfo",
"netcat",
"net-tools",
"p7zip-full",
"parallel",
"pass",
"patchelf",
"pollinate",
"rsync",
"shellcheck",
"sphinxsearch",
"sqlite3",
"ssh",
"sshpass",
"subversion",
"sudo",
"swig",
"telnet",
"time",
"unzip",
"wget",
"zip"
]
},
"brew": [
{"name": "zstd"}
],
"docker": {
"images": [
"alpine:3.14",
"alpine:3.15",
"buildpack-deps:buster",
"buildpack-deps:bullseye",
"debian:10",
"debian:11",
"moby/buildkit:latest",
"node:14",
"node:16",
"node:14-alpine",
"node:16-alpine",
"ubuntu:18.04",
"ubuntu:20.04",
"ubuntu:22.04"
]
},
"pipx": [
{
"package": "yamllint",
"cmd": "yamllint"
},
{
"package": "ansible-core",
"cmd": "ansible"
}
],
"dotnet": {
"aptPackages": [
"dotnet-sdk-6.0"
],
"versions": [
"6.0"
],
"tools": [
{ "name": "nbgv", "test": "nbgv --version", "getversion" : "nbgv --version" }
]
},
"clang": {
"versions": [
"11",
"12"
],
"default_version": "11"
},
"gcc": {
"versions": [
"g++-9",
"g++-10"
]
},
"gfortran": {
"versions": [
"gfortran-9",
"gfortran-10"
]
},
"php": {
"versions": [
"8.1"
]
},
"rubygems": [
{"name": "fastlane"}
],
"selenium": {
"version": "4",
"binary_name": "selenium-server"
},
"node": {
"default": "16"
},
"node_modules": [
{
"name": "grunt",
"command": "grunt"
},
{
"name": "gulp",
"command": "gulp"
},
{
"name": "n",
"command": "n"
},
{
"name": "parcel",
"command": "parcel"
},
{
"name": "typescript",
"command": "tsc"
},
{
"name": "newman",
"command": "newman"
},
{
"name": "vercel",
"command": "vercel"
},
{
"name": "webpack",
"command": "webpack"
},
{
"name": "webpack-cli",
"command": "webpack-cli"
},
{
"name": "netlify-cli",
"command": "netlify"
},
{
"name": "lerna",
"command": "lerna"
},
{
"name": "yarn",
"command": "yarn"
}
],
"mongodb": {
"version": "5.0"
},
"postgresql": {
"version": "14"
}
}

View File

@@ -149,20 +149,14 @@
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/complete-snap-setup.sh"
"{{template_dir}}/scripts/installers/complete-snap-setup.sh",
"{{template_dir}}/scripts/installers/powershellcore.sh"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/powershellcore.sh"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [

View File

@@ -149,20 +149,14 @@
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/complete-snap-setup.sh"
"{{template_dir}}/scripts/installers/complete-snap-setup.sh",
"{{template_dir}}/scripts/installers/powershellcore.sh"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/powershellcore.sh"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [

View File

@@ -0,0 +1,366 @@
{
"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`}}",
"resource_group": "{{env `ARM_RESOURCE_GROUP`}}",
"storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}",
"build_resource_group_name": "{{env `BUILD_RESOURCE_GROUP_NAME`}}",
"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`}}",
"allowed_inbound_ip_addresses": "{{env `AGENT_IP`}}",
"image_folder": "/imagegeneration",
"imagedata_file": "/imagegeneration/imagedata.json",
"installer_script_folder": "/imagegeneration/installers",
"helper_script_folder": "/imagegeneration/helpers",
"vm_size": "Standard_D4s_v4",
"capture_name_prefix": "packer",
"image_version": "dev",
"image_os": "ubuntu22",
"run_validation_diskspace": "false",
"dockerhub_login": "{{env `DOCKERHUB_LOGIN`}}",
"dockerhub_password": "{{env `DOCKERHUB_PASSWORD`}}"
},
"sensitive-variables": [
"client_secret"
],
"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`}}",
"build_resource_group_name": "{{user `build_resource_group_name`}}",
"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`}}",
"allowed_inbound_ip_addresses": "{{user `allowed_inbound_ip_addresses`}}",
"user_data_file": "./images/linux/scripts/base/configure-legacy-ssh.sh",
"os_type": "Linux",
"image_publisher": "canonical",
"image_offer": "0001-com-ubuntu-server-jammy",
"image_sku": "22_04-lts",
"os_disk_size_gb": "86"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"mkdir {{user `image_folder`}}",
"chmod 777 {{user `image_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"script": "{{template_dir}}/scripts/base/apt-mock.sh",
"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",
"script": "{{template_dir}}/scripts/base/apt.sh",
"environment_vars": [
"DEBIAN_FRONTEND=noninteractive"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"script": "{{template_dir}}/scripts/base/limits.sh",
"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": "file",
"source": "{{ template_dir }}/post-generation",
"destination": "{{user `image_folder`}}"
},
{
"type": "file",
"source": "{{template_dir}}/scripts/tests",
"destination": "{{user `image_folder`}}"
},
{
"type": "file",
"source": "{{ template_dir }}/scripts/SoftwareReport",
"destination": "{{user `image_folder`}}"
},
{
"type": "file",
"source": "{{template_dir}}/toolsets/toolset-2204.json",
"destination": "{{user `installer_script_folder`}}/toolset.json"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/preimagedata.sh"
],
"environment_vars": [
"IMAGE_VERSION={{user `image_version`}}",
"IMAGEDATA_FILE={{user `imagedata_file`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/configure-environment.sh"
],
"environment_vars": [
"IMAGE_VERSION={{user `image_version`}}",
"IMAGE_OS={{user `image_os`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/complete-snap-setup.sh",
"{{template_dir}}/scripts/installers/powershellcore.sh"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/Install-PowerShellModules.ps1",
"{{template_dir}}/scripts/installers/Install-AzureModules.ps1"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/docker-compose.sh",
"{{template_dir}}/scripts/installers/docker-moby.sh"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}",
"DOCKERHUB_LOGIN={{user `dockerhub_login`}}",
"DOCKERHUB_PASSWORD={{user `dockerhub_password`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{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/basic.sh",
"{{template_dir}}/scripts/installers/bicep.sh",
"{{template_dir}}/scripts/installers/aliyun-cli.sh",
"{{template_dir}}/scripts/installers/apache.sh",
"{{template_dir}}/scripts/installers/aws.sh",
"{{template_dir}}/scripts/installers/clang.sh",
"{{template_dir}}/scripts/installers/cmake.sh",
"{{template_dir}}/scripts/installers/codeql-bundle.sh",
"{{template_dir}}/scripts/installers/dotnetcore-sdk.sh",
"{{template_dir}}/scripts/installers/gcc.sh",
"{{template_dir}}/scripts/installers/gfortran.sh",
"{{template_dir}}/scripts/installers/git.sh",
"{{template_dir}}/scripts/installers/github-cli.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/kubernetes-tools.sh",
"{{template_dir}}/scripts/installers/oc.sh",
"{{template_dir}}/scripts/installers/miniconda.sh",
"{{template_dir}}/scripts/installers/mysql.sh",
"{{template_dir}}/scripts/installers/sqlpackage.sh",
"{{template_dir}}/scripts/installers/nginx.sh",
"{{template_dir}}/scripts/installers/nvm.sh",
"{{template_dir}}/scripts/installers/nodejs.sh",
"{{template_dir}}/scripts/installers/bazel.sh",
"{{template_dir}}/scripts/installers/oras-cli.sh",
"{{template_dir}}/scripts/installers/php.sh",
"{{template_dir}}/scripts/installers/postgresql.sh",
"{{template_dir}}/scripts/installers/pulumi.sh",
"{{template_dir}}/scripts/installers/ruby.sh",
"{{template_dir}}/scripts/installers/r.sh",
"{{template_dir}}/scripts/installers/rust.sh",
"{{template_dir}}/scripts/installers/julia.sh",
"{{template_dir}}/scripts/installers/sbt.sh",
"{{template_dir}}/scripts/installers/terraform.sh",
"{{template_dir}}/scripts/installers/packer.sh",
"{{template_dir}}/scripts/installers/vcpkg.sh",
"{{template_dir}}/scripts/installers/dpkg-config.sh",
"{{template_dir}}/scripts/installers/yq.sh",
"{{template_dir}}/scripts/installers/pypy.sh",
"{{template_dir}}/scripts/installers/python.sh",
"{{template_dir}}/scripts/installers/graalvm.sh"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}",
"DEBIAN_FRONTEND=noninteractive"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/Install-Toolset.ps1",
"{{template_dir}}/scripts/installers/Configure-Toolset.ps1"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/pipx-packages.sh"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts": [
"{{template_dir}}/scripts/installers/homebrew.sh"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
"DEBIAN_FRONTEND=noninteractive",
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}"
],
"execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"script": "{{template_dir}}/scripts/base/snap.sh",
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"expect_disconnect": true,
"scripts": [
"{{template_dir}}/scripts/base/reboot.sh"
],
"execute_command": "/bin/sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"pause_before": "60s",
"start_retry_timeout": "10m",
"scripts": [
"{{template_dir}}/scripts/installers/cleanup.sh"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"script": "{{template_dir}}/scripts/base/apt-mock-remove.sh",
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"inline": [
"pwsh -File {{user `image_folder`}}/SoftwareReport/SoftwareReport.Generator.ps1 -OutputDirectory {{user `image_folder`}}",
"pwsh -File {{user `image_folder`}}/tests/RunAll-Tests.ps1 -OutputDirectory {{user `image_folder`}}"
],
"environment_vars": [
"IMAGE_VERSION={{user `image_version`}}",
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}"
]
},
{
"type": "file",
"source": "{{user `image_folder`}}/Ubuntu-Readme.md",
"destination": "{{template_dir}}/Ubuntu2204-Readme.md",
"direction": "download"
},
{
"type": "shell",
"scripts":[
"{{template_dir}}/scripts/installers/post-deployment.sh"
],
"environment_vars":[
"HELPER_SCRIPT_FOLDER={{user `helper_script_folder`}}",
"INSTALLER_SCRIPT_FOLDER={{user `installer_script_folder`}}",
"IMAGE_FOLDER={{user `image_folder`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts":[
"{{template_dir}}/scripts/installers/validate-disk-space.sh"
],
"environment_vars": [
"RUN_VALIDATION={{user `run_validation_diskspace`}}"
]
},
{
"type": "file",
"source": "{{template_dir}}/config/ubuntu2204.conf",
"destination": "/tmp/"
},
{
"type": "shell",
"inline": [
"mkdir -p /etc/vsts",
"cp /tmp/ubuntu2204.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 }}'"
}
]
}