diff --git a/.github/workflows/packer-build-and-publish.yml b/.github/workflows/packer-build-and-publish.yml index 2531c90df76c..ca7f17cd2956 100644 --- a/.github/workflows/packer-build-and-publish.yml +++ b/.github/workflows/packer-build-and-publish.yml @@ -98,8 +98,8 @@ jobs: fail-fast: false matrix: template: - - images/ubuntu/templates/ubuntu-22.04.pkr.hcl - - images/ubuntu/templates/ubuntu-22.04.arm64.pkr.hcl + - images/ubuntu/templates/ubuntu-24.04.pkr.hcl + - images/ubuntu/templates/ubuntu-24.04.arm64.pkr.hcl steps: - name: Checkout repository @@ -183,15 +183,14 @@ jobs: - name: Preapre artifacts id: artifacts run: | - git add -N . mkdir -p artifacts name=$(basename -s .pkr.hcl ${{ matrix.template }}) - readme=$(git diff --name-only -- '*.md') - mv "$readme" artifacts/readme-${name}.md + readme=$(git ls-files --others --exclude-standard -- '**/software-report.md') + mv "$readme" artifacts/${name}-software-report.md report=$(git ls-files --others --exclude-standard -- '**/software-report.json') - mv "$report" artifacts/software-report-${name}.json + mv "$report" artifacts/${name}-software-report.json manifest=$(git ls-files --others --exclude-standard -- '**/build-manifest.json') - mv "$manifest" artifacts/build-manifest-${name}.json + mv "$manifest" artifacts/${name}-build-manifest.json echo "name=$name" >> "${GITHUB_OUTPUT}" - name: Upload artifacts diff --git a/images/ubuntu/Ubuntu2204-arm64-Readme.md b/images/ubuntu/Ubuntu2204-arm64-Readme.md deleted file mode 100644 index eb99b5031d1a..000000000000 --- a/images/ubuntu/Ubuntu2204-arm64-Readme.md +++ /dev/null @@ -1,350 +0,0 @@ -# Ubuntu 22.04 -- OS Version: 22.04.4 LTS -- Kernel Version: 6.5.0-1020-aws -- Image Version: dev -- Systemd version: 249.11-0ubuntu3.12 - -## Installed Software - -### Language and Runtime -- Bash 5.1.16(1)-release -- Clang: 13.0.1, 14.0.0, 15.0.7 -- Clang-format: 13.0.1, 14.0.0, 15.0.7 -- Clang-tidy: 13.0.1, 14.0.0, 15.0.7 -- Dash 0.5.11+git20210903+057cd650a4ed-3build1 -- GNU C++: 10.5.0, 11.4.0, 12.3.0 -- GNU Fortran: 10.5.0, 12.3.0 -- Julia 1.10.3 -- Kotlin 1.9.24-release-822 -- Mono 6.12.0.200 -- MSBuild 16.10.1.31701 (Mono 6.12.0.200) -- Node.js 18.20.2 -- Perl 5.34.0 -- Python 3.10.12 -- Ruby 3.0.2p107 -- Swift 5.10 - -### Package Management -- cpan 1.64 -- Miniconda 24.3.0 -- Npm 10.5.0 -- NuGet 6.6.1.2 -- Pip 22.0.2 -- Pip3 22.0.2 -- Pipx 1.5.0 -- RubyGems 3.3.5 -- Vcpkg (build from commit 28c4ec867) -- Yarn 1.22.22 - -#### Environment variables -| Name | Value | -| ----------------------- | ---------------------- | -| CONDA | /usr/share/miniconda | -| VCPKG_INSTALLATION_ROOT | /usr/local/share/vcpkg | - -### Project Management -- Ant 1.10.12 -- Gradle 8.7 -- Lerna 8.1.3 -- Maven 3.8.8 -- Sbt 1.10.0 - -### Tools -- Ansible 2.16.6 -- AzCopy 10.24.0 - available by `azcopy` and `azcopy10` aliases -- Bazel 7.1.2 -- Bazelisk 1.19.0 -- Bicep 0.27.1 -- Buildah 1.23.1 -- CMake 3.29.3 -- Docker Amazon ECR Credential Helper 0.8.0 -- Docker Compose v2 2.23.3 -- Docker-Buildx 0.14.0 -- Docker Client 24.0.9 -- Docker Server 24.0.9 -- Fastlane 2.220.0 -- Git 2.43.2 -- Git LFS 3.3.0 -- Git-ftp 1.6.0 -- Haveged 1.9.14 -- jq 1.6 -- Kind 0.23.0 -- Kubectl 1.30.1 -- Kustomize 5.4.1 -- Leiningen 2.11.2 -- MediaInfo 21.09 -- Mercurial 6.1.1 -- Minikube 1.33.1 -- n 9.2.3 -- Newman 6.1.2 -- nvm 0.39.7 -- OpenSSL 3.0.2-0ubuntu1.15 -- Packer 1.10.3 -- Parcel 2.12.0 -- Podman 3.4.4 -- Pulumi 3.116.1 -- Skopeo 1.4.1 -- Sphinx Open Source Search Server 2.2.11 -- SVN 1.14.1 -- Terraform 1.8.3 -- yamllint 1.35.1 -- yq 4.44.1 -- zstd 1.5.6 - -### CLI Tools -- Alibaba Cloud CLI 3.0.205 -- AWS CLI 2.15.51 -- AWS CLI Session Manager Plugin 1.2.553.0 -- AWS SAM CLI 1.116.0 -- Azure CLI 2.60.0 -- Azure CLI (azure-devops) 1.0.0 -- GitHub CLI 2.49.2 -- Google Cloud CLI 476.0.0 -- Netlify CLI 17.23.5 -- OpenShift CLI 4.15.13 -- ORAS CLI 1.1.0 -- Vercel CLI 34.2.0 - -### Java -| Version | Environment Variable | -| ------------------- | -------------------- | -| 8.0.412+8 | JAVA_HOME_8_ARM64 | -| 11.0.23+9 (default) | JAVA_HOME_11_ARM64 | -| 17.0.11+9 | JAVA_HOME_17_ARM64 | -| 21.0.3+9 | JAVA_HOME_21_ARM64 | - -### PHP Tools -- PHP: 8.1.2 -- Composer 2.7.6 -- PHPUnit 8.5.38 -``` -Both Xdebug and PCOV extensions are installed, but only Xdebug is enabled. -``` - -### Haskell Tools -- Cabal 3.10.3.0 -- GHC 9.10.1 -- GHCup 0.1.22.0 -- Stack 2.15.7 - -### Rust Tools -- Cargo 1.78.0 -- Rust 1.78.0 -- Rustdoc 1.78.0 -- Rustup 1.27.1 - -#### Packages -- Bindgen 0.69.4 -- Cargo audit 0.20.0 -- Cargo clippy 0.1.78 -- Cargo outdated 0.15.0 -- Cbindgen 0.26.0 -- Rustfmt 1.7.0 - -### Browsers and Drivers -- Selenium server 4.20.0 -- Mozilla Firefox 125.0.3 -- Geckodriver 0.34.0 - -#### Environment variables -| Name | Value | -| ----------------- | ----------------------------------- | -| CHROMEWEBDRIVER | | -| EDGEWEBDRIVER | | -| GECKOWEBDRIVER | /usr/local/share/gecko_driver | -| SELENIUM_JAR_PATH | /usr/share/java/selenium-server.jar | - -### .NET Tools -- .NET Core SDK: 6.0.100-preview.3.21168.18, 6.0.422, 7.0.119, 7.0.203, 7.0.316, 7.0.409, 8.0.105, 8.0.205, 8.0.300 -- nbgv 3.6.133+2d32d93cb1 - -### Databases -- sqlite3 3.37.2 - -#### PostgreSQL -- PostgreSQL 14.12 -``` -User: postgres -PostgreSQL service is disabled by default. -Use the following command as a part of your job to start the service: 'sudo systemctl start postgresql.service' -``` - -#### MySQL -- MySQL 8.0.36-0ubuntu0.22.04.1 -``` -User: root -Password: root -MySQL service is disabled by default. -Use the following command as a part of your job to start the service: 'sudo systemctl start mysql.service' -``` - -#### MS SQL -- sqlcmd version - -### Cached Tools - -#### Go -- 1.21.10 -- 1.22.3 - -#### Node.js -- 18.20.2 -- 20.13.1 - -#### PyPy -- 3.7.13 [PyPy 7.3.9] -- 3.8.16 [PyPy 7.3.11] -- 3.9.19 [PyPy 7.3.16] -- 3.10.14 [PyPy 7.3.16] - -#### Ruby -- 3.1.5 - -### PowerShell Tools -- PowerShell 7.4.1 - -#### PowerShell Modules -- Az: 11.3.1 -- MarkdownPS: 1.9 -- Microsoft.Graph: 2.19.0 -- Pester: 5.5.0 -- PSScriptAnalyzer: 1.22.0 - -### Web Servers -| Name | Version | ConfigFile | ServiceStatus | ListenPort | -| ------- | ------- | ------------------------- | ------------- | ---------- | -| apache2 | 2.4.52 | /etc/apache2/apache2.conf | inactive | 80 | -| nginx | 1.18.0 | /etc/nginx/nginx.conf | inactive | 80 | - -### Android -| Package Name | Version | -| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Android Command Line Tools | 9.0 | -| Android SDK Build-tools | 34.0.0
33.0.0 33.0.1 33.0.2 33.0.3
32.0.0
31.0.0 | -| Android SDK Platforms | android-34-ext8 (rev 1)
android-34-ext11 (rev 1)
android-34 (rev 3)
android-33-ext5 (rev 1)
android-33-ext4 (rev 1)
android-33 (rev 3)
android-32 (rev 1)
android-31 (rev 1) | -| Android Support Repository | 47.0.0 | -| Google Play services | 49 | -| Google Repository | 58 | -| NDK | 24.0.8215888
25.2.9519653 (default)
26.3.11579264 | - -#### Environment variables -| Name | Value | -| ----------------------- | -------------------------------------------- | -| ANDROID_ARCH | arm64 | -| ANDROID_HOME | /usr/local/lib/android/sdk | -| ANDROID_NDK | /usr/local/lib/android/sdk/ndk/25.2.9519653 | -| ANDROID_NDK_HOME | /usr/local/lib/android/sdk/ndk/25.2.9519653 | -| ANDROID_NDK_LATEST_HOME | /usr/local/lib/android/sdk/ndk/26.3.11579264 | -| ANDROID_NDK_ROOT | /usr/local/lib/android/sdk/ndk/25.2.9519653 | -| ANDROID_SDK_ROOT | /usr/local/lib/android/sdk | - -### Cached Docker images -| Repository:Tag | Digest | Created | -| -------------------- | ------------------------------------------------------------------------ | ---------- | -| alpine:3.16 | sha256:452e7292acee0ee16c332324d7de05fa2c99f9994ecc9f0779c602916a672ae4 | 2024-01-26 | -| alpine:3.17 | sha256:53cf9478b76f4c8fae126acbdfb79bed6e69e628faff572ebe4a029d3d247d98 | 2024-01-26 | -| alpine:3.18 | sha256:11e21d7b981a59554b3f822c49f6e9f57b6068bb74f49c4cd5cc4c663c7e5160 | 2024-01-26 | -| debian:10 | sha256:6e7bd55a5705914837aad8db01b349f4617510c11e47ccae8e87f6f14e489626 | 2024-05-14 | -| debian:11 | sha256:2c7a92a41cb814c00e7d455b2bc0c90ccdb9a4ced2ffdc10e562c7a84a186032 | 2024-05-14 | -| moby/buildkit:latest | sha256:9194b5ec1be368f41c516df7f93f7f540630ea06136056b2ffebb62226ed4ad6 | 2024-04-25 | -| node:16 | sha256:f77a1aef2da8d83e45ec990f45df50f1a286c5fe8bbfb8c6e4246c6389705c0b | 2023-09-07 | -| node:16-alpine | sha256:a1f9d027912b58a7c75be7716c97cfbc6d3099f3a97ed84aa490be9dee20e787 | 2023-08-10 | -| node:18 | sha256:5bac3a1edff13e76586b8eaef1d411fcd80e4f18cce5bc40ea6993245e0721ec | 2024-05-14 | -| node:18-alpine | sha256:4837c2ac8998cf172f5892fb45f229c328e4824c43c8506f8ba9c7996d702430 | 2024-04-24 | -| node:20 | sha256:d6925dc84f8c0d1c1f8df4ea6a9a54e57d430241cb734b1b0c45ed6d26e8e9c0 | 2024-05-14 | -| node:20-alpine | sha256:291e84d956f1aff38454bbd3da38941461ad569a185c20aa289f71f37ea08e23 | 2024-05-09 | -| ubuntu:20.04 | sha256:874aca52f79ae5f8258faff03e10ce99ae836f6e7d2df6ecd3da5c1cad3a912b | 2024-04-27 | -| ubuntu:22.04 | sha256:a6d2b38300ce017add71440577d5b0a90460d0e57fd7aec21dd0d1b0761bbfb2 | 2024-04-27 | - -### Installed apt packages -| Name | Version | -| ---------------------- | ----------------------------------- | -| acl | 2.3.1-1 | -| aria2 | 1.36.0-1 | -| autoconf | 2.71-2 | -| automake | 1:1.16.5-1.3 | -| binutils | 2.38-4ubuntu2.6 | -| bison | 2:3.8.2+dfsg-1build1 | -| brotli | 1.0.9-2build6 | -| bzip2 | 1.0.8-5build1 | -| coreutils | 8.32-4.1ubuntu1.2 | -| curl | 7.81.0-1ubuntu1.16 | -| dbus | 1.12.20-2ubuntu4.1 | -| dnsutils | 1:9.18.18-0ubuntu0.22.04.2 | -| dpkg | 1.21.1ubuntu2.3 | -| dpkg-dev | 1.21.1ubuntu2.3 | -| fakeroot | 1.28-1ubuntu1 | -| file | 1:5.41-3ubuntu0.1 | -| findutils | 4.8.0-1ubuntu3 | -| flex | 2.6.4-8build2 | -| fonts-noto-color-emoji | 2.042-0ubuntu0.22.04.1 | -| ftp | 20210827-4build1 | -| g++ | 4:11.2.0-1ubuntu1 | -| gcc | 4:11.2.0-1ubuntu1 | -| gnupg2 | 2.2.27-3ubuntu2.1 | -| haveged | 1.9.14-1ubuntu1 | -| imagemagick | 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3 | -| iproute2 | 5.15.0-1ubuntu2 | -| iputils-ping | 3:20211215-1 | -| jq | 1.6-2.1ubuntu3 | -| libc++-dev | 1:14.0-55\~exp2 | -| libc++abi-dev | 1:14.0-55\~exp2 | -| libc6-dev | 2.35-0ubuntu3.7 | -| libcurl4 | 7.81.0-1ubuntu1.16 | -| libgbm-dev | 23.2.1-1ubuntu3.1\~22.04.2 | -| libgconf-2-4 | 3.2.6-7ubuntu2 | -| libgsl-dev | 2.7.1+dfsg-3 | -| libgtk-3-0 | 3.24.33-1ubuntu2.1 | -| libmagic-dev | 1:5.41-3ubuntu0.1 | -| libmagickcore-dev | 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3 | -| libmagickwand-dev | 8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3 | -| libsecret-1-dev | 0.20.5-2 | -| libsqlite3-dev | 3.37.2-2ubuntu0.3 | -| libssl-dev | 3.0.2-0ubuntu1.15 | -| libtool | 2.4.6-15build2 | -| libunwind8 | 1.3.2-2build2.1 | -| libxkbfile-dev | 1:1.1.0-1build3 | -| libxss1 | 1:1.2.3-1build2 | -| libyaml-dev | 0.2.2-1build2 | -| locales | 2.35-0ubuntu3.7 | -| lz4 | 1.9.3-2build2 | -| m4 | 1.4.18-5ubuntu2 | -| make | 4.3-4.1build1 | -| mediainfo | 22.03-1 | -| mercurial | 6.1.1-1ubuntu1 | -| net-tools | 1.60+git20181103.0eebece-1ubuntu5 | -| netcat | 1.218-4ubuntu1 | -| openssh-client | 1:8.9p1-3ubuntu0.7 | -| p7zip-full | 16.02+dfsg-8 | -| p7zip-rar | 16.02-3build1 | -| parallel | 20210822+ds-2 | -| pass | 1.7.4-5 | -| patchelf | 0.14.3-1 | -| pigz | 2.6-1 | -| pkg-config | 0.29.2-1ubuntu3 | -| pollinate | 4.33-3ubuntu2 | -| python-is-python3 | 3.9.2-2 | -| rpm | 4.17.0+dfsg1-4build1 | -| rsync | 3.2.7-0ubuntu0.22.04.2 | -| shellcheck | 0.8.0-2 | -| sphinxsearch | 2.2.11-8 | -| sqlite3 | 3.37.2-2ubuntu0.3 | -| ssh | 1:8.9p1-3ubuntu0.7 | -| sshpass | 1.09-1 | -| subversion | 1.14.1-3ubuntu0.22.04.1 | -| sudo | 1.9.9-1ubuntu2.4 | -| swig | 4.0.2-1ubuntu1 | -| tar | 1.34+dfsg-1ubuntu0.1.22.04.2 | -| telnet | 0.17-44build1 | -| texinfo | 6.8-4build1 | -| time | 1.9-0.1build2 | -| tk | 8.6.11+1build2 | -| tzdata | 2024a-0ubuntu0.22.04 | -| unzip | 6.0-26ubuntu3.2 | -| upx | 3.96-3 | -| wget | 1.21.2-2ubuntu1 | -| xorriso | 1.5.4-2 | -| xvfb | 2:21.1.4-2ubuntu1.7\~22.04.10 | -| xz-utils | 5.2.5-2ubuntu1 | -| zip | 3.0-12build2 | -| zsync | 0.6.2-3ubuntu1 | diff --git a/images/ubuntu/scripts/build/install-dotnetcore-sdk.sh b/images/ubuntu/scripts/build/install-dotnetcore-sdk.sh index c10ac4b3f07d..ede7c7574198 100644 --- a/images/ubuntu/scripts/build/install-dotnetcore-sdk.sh +++ b/images/ubuntu/scripts/build/install-dotnetcore-sdk.sh @@ -22,6 +22,7 @@ extract_dotnet_sdk() { destination="./tmp-$(basename -s .tar.gz $archive_name)" echo "Extracting $archive_name to $destination" + mkdir -p /usr/share/dotnet mkdir "$destination" && tar -C "$destination" -xzf "$archive_name" rsync -qav --remove-source-files "$destination/shared/" /usr/share/dotnet/shared/ rsync -qav --remove-source-files "$destination/host/" /usr/share/dotnet/host/ @@ -80,16 +81,6 @@ done sorted_sdks=$(echo ${sdks[@]} | tr ' ' '\n' | sort -r | uniq -w 5) -# Manually install SDK for arm64 in case it's not available in the apt repository -if [[ $arch == "arm64" && ! -d "/usr/share/dotnet" ]]; then - curl -SL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm64.tar.gz - mkdir -p /usr/share/dotnet - tar -zxf dotnet.tar.gz -C /usr/share/dotnet - rm -f /usr/bin/dotnet - ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet -fi - - # Download/install additional SDKs in parallel export -f download_with_retry export -f extract_dotnet_sdk diff --git a/images/ubuntu/scripts/build/install-powershell.sh b/images/ubuntu/scripts/build/install-powershell.sh index debb3f9c1829..ca067fa355b7 100644 --- a/images/ubuntu/scripts/build/install-powershell.sh +++ b/images/ubuntu/scripts/build/install-powershell.sh @@ -17,16 +17,8 @@ fi pwsh_version=$(get_toolset_value .pwsh.version) # Install Powershell -if is_ubuntu24; then - dependency_path=$(download_with_retry "http://mirrors.kernel.org/ubuntu/pool/main/i/icu/libicu72_72.1-3ubuntu2_amd64.deb") - sudo dpkg -i "$dependency_path" - package_path=$(download_with_retry "https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell-lts_7.4.2-1.deb_amd64.deb") - sudo dpkg -i "$package_path" -else - # apt-get install powershell=$pwsh_version* - package_path=$(download_with_retry https://github.com/PowerShell/PowerShell/releases/download/v$pwsh_version/powershell-$pwsh_version-linux-$arch.tar.gz) - mkdir -p /opt/microsoft/powershell/7 - tar zxf "$package_path" -C /opt/microsoft/powershell/7 - chmod +x /opt/microsoft/powershell/7/pwsh - ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh -fi +package_path=$(download_with_retry https://github.com/PowerShell/PowerShell/releases/download/v$pwsh_version/powershell-$pwsh_version-linux-$arch.tar.gz) +mkdir -p /opt/microsoft/powershell/7 +tar zxf "$package_path" -C /opt/microsoft/powershell/7 +chmod +x /opt/microsoft/powershell/7/pwsh +ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh diff --git a/images/ubuntu/templates/ubuntu-20.04.pkr.hcl b/images/ubuntu/templates/ubuntu-20.04.pkr.hcl index e5a33e547f84..ac66bca6022b 100644 --- a/images/ubuntu/templates/ubuntu-20.04.pkr.hcl +++ b/images/ubuntu/templates/ubuntu-20.04.pkr.hcl @@ -553,7 +553,7 @@ build { } provisioner "file" { - destination = "${path.root}/../Ubuntu2004-Readme.md" + destination = "${path.root}/../software-report.md" direction = "download" source = "${var.image_folder}/software-report.md" } diff --git a/images/ubuntu/templates/ubuntu-22.04.arm64.pkr.hcl b/images/ubuntu/templates/ubuntu-22.04.arm64.pkr.hcl index 24dd9545276c..3d4c27247bc2 100644 --- a/images/ubuntu/templates/ubuntu-22.04.arm64.pkr.hcl +++ b/images/ubuntu/templates/ubuntu-22.04.arm64.pkr.hcl @@ -544,7 +544,7 @@ build { } provisioner "file" { - destination = "${path.root}/../Ubuntu2204-arm64-Readme.md" + destination = "${path.root}/../software-report.md" direction = "download" source = "${var.image_folder}/software-report.md" } diff --git a/images/ubuntu/templates/ubuntu-22.04.pkr.hcl b/images/ubuntu/templates/ubuntu-22.04.pkr.hcl index 2ef9ad0fab4d..a14e2a4b0605 100644 --- a/images/ubuntu/templates/ubuntu-22.04.pkr.hcl +++ b/images/ubuntu/templates/ubuntu-22.04.pkr.hcl @@ -542,7 +542,7 @@ build { } provisioner "file" { - destination = "${path.root}/../Ubuntu2204-Readme.md" + destination = "${path.root}/../software-report.md" direction = "download" source = "${var.image_folder}/software-report.md" } diff --git a/images/ubuntu/templates/ubuntu-24.04.arm64.pkr.hcl b/images/ubuntu/templates/ubuntu-24.04.arm64.pkr.hcl new file mode 100644 index 000000000000..5dc92fd3b096 --- /dev/null +++ b/images/ubuntu/templates/ubuntu-24.04.arm64.pkr.hcl @@ -0,0 +1,558 @@ +packer { + required_plugins { + azure = { + source = "github.com/hashicorp/azure" + version = "1.4.5" + } + amazon = { + source = "github.com/hashicorp/amazon" + version = "~> 1" + } + } +} + +locals { + timestamp = formatdate("YYYYMMDDhhmmss", timestamp()) + image_version = "${var.image_version}-${local.timestamp}" + managed_image_name = var.managed_image_name != "" ? var.managed_image_name : "packer-${var.image_os}-arm64-${local.image_version}" + cloud_providers = { + "aws" = "amazon-ebs", + "azure" = "azure-arm" + } +} + +variable "provider" { + type = string +} + +variable "azure_allowed_inbound_ip_addresses" { + type = list(string) + default = [] +} + +variable "azure_tags" { + type = map(string) + default = {} +} + +variable "azure_build_resource_group_name" { + type = string + default = "${env("BUILD_RESOURCE_GROUP_NAME")}" +} + +variable "azure_client_cert_path" { + type = string + default = "${env("ARM_CLIENT_CERT_PATH")}" +} + +variable "azure_client_id" { + type = string + default = "${env("ARM_CLIENT_ID")}" +} + +variable "azure_client_secret" { + type = string + default = "${env("ARM_CLIENT_SECRET")}" + sensitive = true +} + +variable "dockerhub_login" { + type = string + default = "${env("DOCKERHUB_LOGIN")}" +} + +variable "dockerhub_password" { + type = string + default = "${env("DOCKERHUB_PASSWORD")}" +} + +variable "helper_script_folder" { + type = string + default = "/imagegeneration/helpers" +} + +variable "image_folder" { + type = string + default = "/imagegeneration" +} + +variable "image_os" { + type = string + default = "ubuntu24" +} + +variable "image_version" { + type = string + default = "dev" +} + +variable "imagedata_file" { + type = string + default = "/imagegeneration/imagedata.json" +} + +variable "installer_script_folder" { + type = string + default = "/imagegeneration/installers" +} + +variable "install_password" { + type = string + default = "" + sensitive = true +} + +variable "azure_location" { + type = string + default = "${env("ARM_RESOURCE_LOCATION")}" +} + +variable "managed_image_name" { + type = string + default = "" +} + +variable "azure_managed_image_resource_group_name" { + type = string + default = "${env("ARM_RESOURCE_GROUP")}" +} + +variable "azure_private_virtual_network_with_public_ip" { + type = bool + default = false +} + +variable "azure_subscription_id" { + type = string + default = "${env("ARM_SUBSCRIPTION_ID")}" +} + +variable "azure_temp_resource_group_name" { + type = string + default = "${env("TEMP_RESOURCE_GROUP_NAME")}" +} + +variable "azure_tenant_id" { + type = string + default = "${env("ARM_TENANT_ID")}" +} + +variable "azure_virtual_network_name" { + type = string + default = "${env("VNET_NAME")}" +} + +variable "azure_virtual_network_resource_group_name" { + type = string + default = "${env("VNET_RESOURCE_GROUP")}" +} + +variable "azure_virtual_network_subnet_name" { + type = string + default = "${env("VNET_SUBNET")}" +} + +variable "azure_vm_size" { + type = string + default = "Standard_D4s_v4" +} + +variable "aws_subnet_id" { + type = string + default = "${env("SUBNET_ID")}" +} + +variable "aws_volume_size" { + type = number + default = 75 +} + +variable "aws_volume_type" { + type = string + default = "gp3" +} + +variable "aws_region" { + type = string + default = "${env("AWS_DEFAULT_REGION")}" +} + +variable "aws_tags" { + type = map(string) + default = {} +} + +variable "aws_private_ami" { + type = bool + default = false +} + +variable "aws_force_deregister" { + type = bool + default = false +} + +variable "aws_assume_role_arn" { + type = string + default = "" +} + +variable "aws_assume_role_session_name" { + type = string + default = "" +} + +variable "github_event_name" { + type = string + default = "${env("GITHUB_EVENT_NAME")}" +} + +variable "github_repository_owner" { + type = string + default = "${env("GITHUB_REPOSITORY_OWNER")}" +} + +variable "github_repository_name" { + type = string + default = "${env("GITHUB_REPOSITORY_NAME")}" +} + +variable "github_job_workflow_ref" { + type = string + default = "${env("GITHUB_JOB_WORKFLOW_REF")}" +} + +variable "github_ref" { + type = string + default = "${env("GITHUB_REF")}" +} + +source "azure-arm" "build_image" { + allowed_inbound_ip_addresses = "${var.azure_allowed_inbound_ip_addresses}" + build_resource_group_name = "${var.azure_build_resource_group_name}" + client_cert_path = "${var.azure_client_cert_path}" + client_id = "${var.azure_client_id}" + client_secret = "${var.azure_client_secret}" + image_offer = "ubuntu-24_04-lts" + image_publisher = "canonical" + image_sku = "server-gen1" + location = "${var.azure_location}" + managed_image_name = "${local.managed_image_name}" + managed_image_resource_group_name = "${var.azure_managed_image_resource_group_name}" + os_disk_size_gb = "75" + os_type = "Linux" + private_virtual_network_with_public_ip = "${var.azure_private_virtual_network_with_public_ip}" + subscription_id = "${var.azure_subscription_id}" + temp_resource_group_name = "${var.azure_temp_resource_group_name}" + tenant_id = "${var.azure_tenant_id}" + virtual_network_name = "${var.azure_virtual_network_name}" + virtual_network_resource_group_name = "${var.azure_virtual_network_resource_group_name}" + virtual_network_subnet_name = "${var.azure_virtual_network_subnet_name}" + vm_size = "${var.azure_vm_size}" + + dynamic "azure_tag" { + for_each = var.azure_tags + content { + name = azure_tag.key + value = azure_tag.value + } + } +} + +source "amazon-ebs" "build_image" { + aws_polling { + delay_seconds = 30 + max_attempts = 300 + } + + temporary_security_group_source_public_ip = true + ami_name = "${local.managed_image_name}" + ami_virtualization_type = "hvm" + ami_groups = var.aws_private_ami ? [] : ["all"] + ebs_optimized = true + spot_instance_types = ["m7g.xlarge"] + spot_price = "1.00" + region = "${var.aws_region}" + ssh_username = "ubuntu" + subnet_id = "${var.aws_subnet_id}" + associate_public_ip_address = "true" + force_deregister = "${var.aws_force_deregister}" + force_delete_snapshot = "${var.aws_force_deregister}" + + ami_regions = [ + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + ] + + snapshot_groups = var.aws_private_ami ? [] : ["all"] + + tags = var.aws_tags + + launch_block_device_mappings { + device_name = "/dev/sda1" + volume_type = "${var.aws_volume_type}" + volume_size = "${var.aws_volume_size}" + delete_on_termination = "true" + iops = 6000 + throughput = 1000 + encrypted = "false" + } + + source_ami_filter { + filters = { + virtualization-type = "hvm" + name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-arm64-server-*" + root-device-type = "ebs" + } + owners = ["099720109477"] + most_recent = true + } + + assume_role { + role_arn = "${var.aws_assume_role_arn}" + session_name = "${var.aws_assume_role_session_name}" + tags = { + event_name = "${var.github_event_name}" + repository_owner = "${var.github_repository_owner}" + repository_name = "${var.github_repository_name}" + job_workflow_ref = "${var.github_job_workflow_ref}" + ref = "${var.github_ref}" + } + } +} + +build { + sources = ["source.${local.cloud_providers[var.provider]}.build_image"] + + post-processor "manifest" { + output = "${path.root}/../build-manifest.json" + strip_path = true + custom_data = { + image_name = "${local.managed_image_name}" + } + } + + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + inline = ["mkdir ${var.image_folder}", "chmod 777 ${var.image_folder}"] + } + + provisioner "file" { + destination = "${var.helper_script_folder}" + source = "${path.root}/../scripts/helpers" + } + + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + script = "${path.root}/../scripts/build/configure-apt-mock.sh" + } + + provisioner "shell" { + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}","DEBIAN_FRONTEND=noninteractive"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = [ + "${path.root}/../scripts/build/install-ms-repos.sh", + "${path.root}/../scripts/build/configure-apt-sources.sh", + "${path.root}/../scripts/build/configure-apt.sh" + ] + } + + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + script = "${path.root}/../scripts/build/configure-limits.sh" + } + + provisioner "file" { + destination = "${var.installer_script_folder}" + source = "${path.root}/../scripts/build" + } + + provisioner "file" { + destination = "${var.image_folder}" + sources = [ + "${path.root}/../assets/post-gen", + "${path.root}/../scripts/tests", + "${path.root}/../scripts/docs-gen" + ] + } + + provisioner "file" { + destination = "${var.image_folder}/docs-gen/" + source = "${path.root}/../../../helpers/software-report-base" + } + + provisioner "file" { + destination = "${var.installer_script_folder}/toolset.json" + source = "${path.root}/../toolsets/toolset-2404.json" + } + + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + inline = [ + "mv ${var.image_folder}/docs-gen ${var.image_folder}/SoftwareReport", + "mv ${var.image_folder}/post-gen ${var.image_folder}/post-generation" + ] + } + + provisioner "shell" { + environment_vars = ["IMAGE_VERSION=${var.image_version}", "IMAGEDATA_FILE=${var.imagedata_file}"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/configure-image-data.sh"] + } + + provisioner "shell" { + environment_vars = ["IMAGE_VERSION=${var.image_version}", "IMAGE_OS=${var.image_os}", "HELPER_SCRIPTS=${var.helper_script_folder}"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/configure-environment.sh"] + } + + provisioner "shell" { + environment_vars = ["DEBIAN_FRONTEND=noninteractive", "HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/install-apt-vital.sh"] + } + + provisioner "shell" { + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/install-powershell.sh"] + } + + provisioner "shell" { + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] + execute_command = "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/Install-PowerShellModules.ps1", "${path.root}/../scripts/build/Install-PowerShellAzModules.ps1"] + } + + provisioner "shell" { + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}", "DEBIAN_FRONTEND=noninteractive"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = [ + // Commented scripts are unavailable on ARM64 + "${path.root}/../scripts/build/install-actions-cache.sh", + "${path.root}/../scripts/build/install-runner-package.sh", + "${path.root}/../scripts/build/install-apt-common.sh", + "${path.root}/../scripts/build/install-azcopy.sh", + "${path.root}/../scripts/build/install-azure-cli.sh", + "${path.root}/../scripts/build/install-azure-devops-cli.sh", + "${path.root}/../scripts/build/install-bicep.sh", + "${path.root}/../scripts/build/install-apache.sh", + "${path.root}/../scripts/build/install-aws-tools.sh", + "${path.root}/../scripts/build/install-clang.sh", + "${path.root}/../scripts/build/install-swift.sh", + "${path.root}/../scripts/build/install-cmake.sh", + // "${path.root}/../scripts/build/install-codeql-bundle.sh", + "${path.root}/../scripts/build/install-container-tools.sh", + "${path.root}/../scripts/build/install-dotnetcore-sdk.sh", + // "${path.root}/../scripts/build/install-microsoft-edge.sh", + "${path.root}/../scripts/build/install-gcc-compilers.sh", + "${path.root}/../scripts/build/install-firefox.sh", + "${path.root}/../scripts/build/install-gfortran.sh", + "${path.root}/../scripts/build/install-git.sh", + "${path.root}/../scripts/build/install-git-lfs.sh", + "${path.root}/../scripts/build/install-github-cli.sh", + // "${path.root}/../scripts/build/install-google-chrome.sh", + "${path.root}/../scripts/build/install-google-cloud-cli.sh", + "${path.root}/../scripts/build/install-haskell.sh", + "${path.root}/../scripts/build/install-java-tools.sh", + "${path.root}/../scripts/build/install-kubernetes-tools.sh", + "${path.root}/../scripts/build/install-miniconda.sh", + "${path.root}/../scripts/build/install-kotlin.sh", + "${path.root}/../scripts/build/install-mysql.sh", + "${path.root}/../scripts/build/install-nginx.sh", + "${path.root}/../scripts/build/install-nvm.sh", + "${path.root}/../scripts/build/install-nodejs.sh", + "${path.root}/../scripts/build/install-bazel.sh", + "${path.root}/../scripts/build/install-php.sh", + "${path.root}/../scripts/build/install-postgresql.sh", + "${path.root}/../scripts/build/install-pulumi.sh", + "${path.root}/../scripts/build/install-ruby.sh", + "${path.root}/../scripts/build/install-rust.sh", + "${path.root}/../scripts/build/install-julia.sh", + "${path.root}/../scripts/build/install-selenium.sh", + "${path.root}/../scripts/build/install-packer.sh", + "${path.root}/../scripts/build/install-vcpkg.sh", + "${path.root}/../scripts/build/configure-dpkg.sh", + "${path.root}/../scripts/build/install-yq.sh", + "${path.root}/../scripts/build/install-android-sdk.sh", + "${path.root}/../scripts/build/install-pypy.sh", + "${path.root}/../scripts/build/install-python.sh", + "${path.root}/../scripts/build/install-zstd.sh" + ] + } + + provisioner "shell" { + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}", "DOCKERHUB_PULL_IMAGES=NO"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/install-docker.sh"] + } + + provisioner "shell" { + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] + execute_command = "sudo sh -c '{{ .Vars }} pwsh -f {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/Install-Toolset.ps1", "${path.root}/../scripts/build/Configure-Toolset.ps1"] + } + + provisioner "shell" { + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/install-pipx-packages.sh"] + } + + // Homebrew on Linux is not supported on ARM processors. + // provisioner "shell" { + // environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "DEBIAN_FRONTEND=noninteractive", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] + // execute_command = "/bin/sh -c '{{ .Vars }} {{ .Path }}'" + // scripts = ["${path.root}/../scripts/build/install-homebrew.sh"] + // } + + provisioner "shell" { + environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/configure-snap.sh"] + } + + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + expect_disconnect = true + inline = ["echo 'Reboot VM'", "sudo reboot"] + } + + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + pause_before = "1m0s" + scripts = ["${path.root}/../scripts/build/cleanup.sh"] + start_retry_timeout = "10m" + } + + provisioner "shell" { + environment_vars = ["IMAGE_VERSION=${var.image_version}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] + inline = ["pwsh -File ${var.image_folder}/SoftwareReport/Generate-SoftwareReport.ps1 -OutputDirectory ${var.image_folder}", "pwsh -File ${var.image_folder}/tests/RunAll-Tests.ps1 -OutputDirectory ${var.image_folder}"] + } + + provisioner "file" { + destination = "${path.root}/../software-report.md" + direction = "download" + source = "${var.image_folder}/software-report.md" + } + + provisioner "file" { + destination = "${path.root}/../software-report.json" + direction = "download" + source = "${var.image_folder}/software-report.json" + } + + provisioner "shell" { + environment_vars = ["HELPER_SCRIPT_FOLDER=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}", "IMAGE_FOLDER=${var.image_folder}"] + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + scripts = ["${path.root}/../scripts/build/configure-system.sh"] + } + + provisioner "shell" { + execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" + inline = ["sleep 30", "test '${var.provider}' = 'azure' && /usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync || echo 'Not Azure'"] + } + +} diff --git a/images/ubuntu/templates/ubuntu-24.04.pkr.hcl b/images/ubuntu/templates/ubuntu-24.04.pkr.hcl index 7f02ff162321..8ca0f44d1fd8 100644 --- a/images/ubuntu/templates/ubuntu-24.04.pkr.hcl +++ b/images/ubuntu/templates/ubuntu-24.04.pkr.hcl @@ -4,14 +4,28 @@ packer { source = "github.com/hashicorp/azure" version = "1.4.5" } + amazon = { + source = "github.com/hashicorp/amazon" + version = "~> 1" + } } } locals { - managed_image_name = var.managed_image_name != "" ? var.managed_image_name : "packer-${var.image_os}-${var.image_version}" + timestamp = formatdate("YYYYMMDDhhmmss", timestamp()) + image_version = "${var.image_version}-${local.timestamp}" + managed_image_name = var.managed_image_name != "" ? var.managed_image_name : "packer-${var.image_os}-${local.image_version}" + cloud_providers = { + "aws" = "amazon-ebs", + "azure" = "azure-arm" + } +} + +variable "provider" { + type = string } -variable "allowed_inbound_ip_addresses" { +variable "azure_allowed_inbound_ip_addresses" { type = list(string) default = [] } @@ -21,22 +35,22 @@ variable "azure_tags" { default = {} } -variable "build_resource_group_name" { +variable "azure_build_resource_group_name" { type = string default = "${env("BUILD_RESOURCE_GROUP_NAME")}" } -variable "client_cert_path" { +variable "azure_client_cert_path" { type = string default = "${env("ARM_CLIENT_CERT_PATH")}" } -variable "client_id" { +variable "azure_client_id" { type = string default = "${env("ARM_CLIENT_ID")}" } -variable "client_secret" { +variable "azure_client_secret" { type = string default = "${env("ARM_CLIENT_SECRET")}" sensitive = true @@ -88,7 +102,7 @@ variable "install_password" { sensitive = true } -variable "location" { +variable "azure_location" { type = string default = "${env("ARM_RESOURCE_LOCATION")}" } @@ -98,73 +112,143 @@ variable "managed_image_name" { default = "" } -variable "managed_image_resource_group_name" { +variable "azure_managed_image_resource_group_name" { type = string default = "${env("ARM_RESOURCE_GROUP")}" } -variable "private_virtual_network_with_public_ip" { +variable "azure_private_virtual_network_with_public_ip" { type = bool default = false } -variable "subscription_id" { +variable "azure_subscription_id" { type = string default = "${env("ARM_SUBSCRIPTION_ID")}" } -variable "temp_resource_group_name" { +variable "azure_temp_resource_group_name" { type = string default = "${env("TEMP_RESOURCE_GROUP_NAME")}" } -variable "tenant_id" { +variable "azure_tenant_id" { type = string default = "${env("ARM_TENANT_ID")}" } -variable "virtual_network_name" { +variable "azure_virtual_network_name" { type = string default = "${env("VNET_NAME")}" } -variable "virtual_network_resource_group_name" { +variable "azure_virtual_network_resource_group_name" { type = string default = "${env("VNET_RESOURCE_GROUP")}" } -variable "virtual_network_subnet_name" { +variable "azure_virtual_network_subnet_name" { type = string default = "${env("VNET_SUBNET")}" } -variable "vm_size" { +variable "azure_vm_size" { type = string default = "Standard_D4s_v4" } +variable "aws_subnet_id" { + type = string + default = "${env("SUBNET_ID")}" +} + +variable "aws_volume_size" { + type = number + default = 80 +} + +variable "aws_volume_type" { + type = string + default = "gp3" +} + +variable "aws_region" { + type = string + default = "${env("AWS_DEFAULT_REGION")}" +} + +variable "aws_tags" { + type = map(string) + default = {} +} + +variable "aws_private_ami" { + type = bool + default = false +} + +variable "aws_force_deregister" { + type = bool + default = false +} + +variable "aws_assume_role_arn" { + type = string + default = "" +} + +variable "aws_assume_role_session_name" { + type = string + default = "" +} + +variable "github_event_name" { + type = string + default = "${env("GITHUB_EVENT_NAME")}" +} + +variable "github_repository_owner" { + type = string + default = "${env("GITHUB_REPOSITORY_OWNER")}" +} + +variable "github_repository_name" { + type = string + default = "${env("GITHUB_REPOSITORY_NAME")}" +} + +variable "github_job_workflow_ref" { + type = string + default = "${env("GITHUB_JOB_WORKFLOW_REF")}" +} + +variable "github_ref" { + type = string + default = "${env("GITHUB_REF")}" +} + source "azure-arm" "build_image" { - allowed_inbound_ip_addresses = "${var.allowed_inbound_ip_addresses}" - build_resource_group_name = "${var.build_resource_group_name}" - client_cert_path = "${var.client_cert_path}" - client_id = "${var.client_id}" - client_secret = "${var.client_secret}" + allowed_inbound_ip_addresses = "${var.azure_allowed_inbound_ip_addresses}" + build_resource_group_name = "${var.azure_build_resource_group_name}" + client_cert_path = "${var.azure_client_cert_path}" + client_id = "${var.azure_client_id}" + client_secret = "${var.azure_client_secret}" image_offer = "ubuntu-24_04-lts" image_publisher = "canonical" image_sku = "server-gen1" - location = "${var.location}" + location = "${var.azure_location}" managed_image_name = "${local.managed_image_name}" - managed_image_resource_group_name = "${var.managed_image_resource_group_name}" + managed_image_resource_group_name = "${var.azure_managed_image_resource_group_name}" os_disk_size_gb = "75" os_type = "Linux" - private_virtual_network_with_public_ip = "${var.private_virtual_network_with_public_ip}" - subscription_id = "${var.subscription_id}" - temp_resource_group_name = "${var.temp_resource_group_name}" - tenant_id = "${var.tenant_id}" - virtual_network_name = "${var.virtual_network_name}" - virtual_network_resource_group_name = "${var.virtual_network_resource_group_name}" - virtual_network_subnet_name = "${var.virtual_network_subnet_name}" - vm_size = "${var.vm_size}" + private_virtual_network_with_public_ip = "${var.azure_private_virtual_network_with_public_ip}" + subscription_id = "${var.azure_subscription_id}" + temp_resource_group_name = "${var.azure_temp_resource_group_name}" + tenant_id = "${var.azure_tenant_id}" + virtual_network_name = "${var.azure_virtual_network_name}" + virtual_network_resource_group_name = "${var.azure_virtual_network_resource_group_name}" + virtual_network_subnet_name = "${var.azure_virtual_network_subnet_name}" + vm_size = "${var.azure_vm_size}" dynamic "azure_tag" { for_each = var.azure_tags @@ -175,8 +259,80 @@ source "azure-arm" "build_image" { } } +source "amazon-ebs" "build_image" { + aws_polling { + delay_seconds = 30 + max_attempts = 300 + } + + temporary_security_group_source_public_ip = true + ami_name = "${local.managed_image_name}" + ami_virtualization_type = "hvm" + ami_groups = var.aws_private_ami ? [] : ["all"] + ebs_optimized = true + spot_instance_types = ["m7i.xlarge"] + spot_price = "1.00" + region = "${var.aws_region}" + ssh_username = "ubuntu" + subnet_id = "${var.aws_subnet_id}" + associate_public_ip_address = "true" + force_deregister = "${var.aws_force_deregister}" + force_delete_snapshot = "${var.aws_force_deregister}" + + ami_regions = [ + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + ] + + snapshot_groups = var.aws_private_ami ? [] : ["all"] + + tags = var.aws_tags + + launch_block_device_mappings { + device_name = "/dev/sda1" + volume_type = "${var.aws_volume_type}" + volume_size = "${var.aws_volume_size}" + delete_on_termination = "true" + iops = 6000 + throughput = 1000 + encrypted = "false" + } + + source_ami_filter { + filters = { + virtualization-type = "hvm" + name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*" + root-device-type = "ebs" + } + owners = ["099720109477"] + most_recent = true + } + + assume_role { + role_arn = "${var.aws_assume_role_arn}" + session_name = "${var.aws_assume_role_session_name}" + tags = { + event_name = "${var.github_event_name}" + repository_owner = "${var.github_repository_owner}" + repository_name = "${var.github_repository_name}" + job_workflow_ref = "${var.github_job_workflow_ref}" + ref = "${var.github_ref}" + } + } +} + build { - sources = ["source.azure-arm.build_image"] + sources = ["source.${local.cloud_providers[var.provider]}.build_image"] + + post-processor "manifest" { + output = "${path.root}/../build-manifest.json" + strip_path = true + custom_data = { + image_name = "${local.managed_image_name}" + } + } provisioner "shell" { execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" @@ -258,7 +414,7 @@ build { scripts = ["${path.root}/../scripts/build/install-apt-vital.sh"] } -provisioner "shell" { + provisioner "shell" { environment_vars = ["HELPER_SCRIPTS=${var.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${var.installer_script_folder}"] execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" scripts = ["${path.root}/../scripts/build/install-powershell.sh"] @@ -375,7 +531,7 @@ provisioner "shell" { } provisioner "file" { - destination = "${path.root}/../Ubuntu2404-Readme.md" + destination = "${path.root}/../software-report.md" direction = "download" source = "${var.image_folder}/software-report.md" } @@ -394,7 +550,7 @@ provisioner "shell" { provisioner "shell" { execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'" - inline = ["sleep 30", "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"] + inline = ["sleep 30", "test '${var.provider}' = 'azure' && /usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync || echo 'Not Azure'"] } } diff --git a/images/ubuntu/toolsets/toolset-2404.json b/images/ubuntu/toolsets/toolset-2404.json index a4f7b857e6f7..91792aba7950 100644 --- a/images/ubuntu/toolsets/toolset-2404.json +++ b/images/ubuntu/toolsets/toolset-2404.json @@ -199,12 +199,18 @@ { "plugin": "buildx", "version": "latest", - "asset": "linux-amd64" - }, + "asset": { + "amd64": "linux-amd64", + "arm64": "linux-arm64" + } + }, { "plugin": "compose", "version": "2.27.1", - "asset": "linux-x86_64" + "asset": { + "amd64": "linux-x86_64", + "arm64": "linux-aarch64" + } } ] }, @@ -314,6 +320,6 @@ "version": "16" }, "pwsh": { - "version": "7.4" + "version": "7.4.2" } }