mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-10 19:50:37 +00:00
[ubuntu] Change packer templates from json to hcl (#8991)
* [ubuntu] Change packer tempaltes from json to hcl * Add packer init * Fix variable types for Ubuntu20 template
This commit is contained in:
committed by
GitHub
parent
ea64263b41
commit
a5519ebed0
@@ -25,7 +25,7 @@ Function Get-PackerTemplatePath {
|
||||
$relativeTemplatePath = Join-Path (Join-Path "windows" "templates") "windows-2022.pkr.hcl"
|
||||
}
|
||||
([ImageType]::Ubuntu2004) {
|
||||
$relativeTemplatePath = Join-Path (Join-Path "ubuntu" "templates") "ubuntu-20.04.json"
|
||||
$relativeTemplatePath = Join-Path (Join-Path "ubuntu" "templates") "ubuntu-20.04.pkr.hcl"
|
||||
}
|
||||
([ImageType]::Ubuntu2204) {
|
||||
$relativeTemplatePath = Join-Path (Join-Path "ubuntu" "templates") "ubuntu-22.04.pkr.hcl"
|
||||
|
||||
@@ -18,4 +18,4 @@ jobs:
|
||||
parameters:
|
||||
image_type: ubuntu2004
|
||||
image_readme_name: Ubuntu2004-Readme.md
|
||||
image_template_name: ubuntu-20.04.json
|
||||
image_template_name: ubuntu-20.04.pkr.hcl
|
||||
|
||||
@@ -1,395 +0,0 @@
|
||||
{
|
||||
"variables": {
|
||||
"client_id": "{{env `ARM_CLIENT_ID`}}",
|
||||
"client_secret": "{{env `ARM_CLIENT_SECRET`}}",
|
||||
"client_cert_path": "{{env `ARM_CLIENT_CERT_PATH`}}",
|
||||
"subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}",
|
||||
"tenant_id": "{{env `ARM_TENANT_ID`}}",
|
||||
"managed_image_resource_group_name": "{{env `ARM_RESOURCE_GROUP`}}",
|
||||
"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",
|
||||
"managed_image_name": "packer-ubuntu20-dev",
|
||||
"image_version": "dev",
|
||||
"image_os": "ubuntu20",
|
||||
"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`}}",
|
||||
"client_cert_path": "{{user `client_cert_path`}}",
|
||||
"subscription_id": "{{user `subscription_id`}}",
|
||||
"tenant_id": "{{user `tenant_id`}}",
|
||||
"location": "{{user `location`}}",
|
||||
"vm_size": "{{user `vm_size`}}",
|
||||
"managed_image_name": "{{user `managed_image_name`}}",
|
||||
"managed_image_resource_group_name": "{{user `managed_image_resource_group_name`}}",
|
||||
"build_resource_group_name": "{{user `build_resource_group_name`}}",
|
||||
"temp_resource_group_name": "{{user `temp_resource_group_name`}}",
|
||||
"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`}}",
|
||||
"os_type": "Linux",
|
||||
"image_publisher": "canonical",
|
||||
"image_offer": "0001-com-ubuntu-server-focal",
|
||||
"image_sku": "20_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/build/configure-apt-mock.sh",
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts": [
|
||||
"{{template_dir}}/../scripts/build/install-ms-repos.sh",
|
||||
"{{template_dir}}/../scripts/build/configure-apt-sources.sh",
|
||||
"{{template_dir}}/../scripts/build/configure-apt.sh"
|
||||
],
|
||||
"environment_vars": [
|
||||
"DEBIAN_FRONTEND=noninteractive"
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "{{template_dir}}/../scripts/build/configure-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/build",
|
||||
"destination": "{{user `installer_script_folder`}}"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"sources": [
|
||||
"{{template_dir}}/../scripts/tests",
|
||||
"{{template_dir}}/../scripts/docs-gen",
|
||||
"{{template_dir}}/../assets/post-gen"
|
||||
],
|
||||
"destination": "{{user `image_folder`}}"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{template_dir}}/../../../helpers/software-report-base",
|
||||
"destination": "{{user `image_folder`}}/docs-gen/"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{template_dir}}/../toolsets/toolset-2004.json",
|
||||
"destination": "{{user `installer_script_folder`}}/toolset.json"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"mv {{user `image_folder`}}/docs-gen {{user `image_folder`}}/SoftwareReport",
|
||||
"mv {{user `image_folder`}}/post-gen {{user `image_folder`}}/post-generation"
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts": [
|
||||
"{{template_dir}}/../scripts/build/configure-image-data.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/build/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/build/install-apt-vital.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/build/install-powershell.sh"
|
||||
],
|
||||
"environment_vars": [
|
||||
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts": [
|
||||
"{{template_dir}}/../scripts/build/Install-PowerShellModules.ps1",
|
||||
"{{template_dir}}/../scripts/build/Install-PowerShellAzModules.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/build/install-actions-cache.sh",
|
||||
"{{template_dir}}/../scripts/build/install-runner-package.sh",
|
||||
"{{template_dir}}/../scripts/build/install-apt-common.sh",
|
||||
"{{template_dir}}/../scripts/build/install-azcopy.sh",
|
||||
"{{template_dir}}/../scripts/build/install-azure-cli.sh",
|
||||
"{{template_dir}}/../scripts/build/install-azure-devops-cli.sh",
|
||||
"{{template_dir}}/../scripts/build/install-bicep.sh",
|
||||
"{{template_dir}}/../scripts/build/install-aliyun-cli.sh",
|
||||
"{{template_dir}}/../scripts/build/install-apache.sh",
|
||||
"{{template_dir}}/../scripts/build/install-aws-tools.sh",
|
||||
"{{template_dir}}/../scripts/build/install-clang.sh",
|
||||
"{{template_dir}}/../scripts/build/install-swift.sh",
|
||||
"{{template_dir}}/../scripts/build/install-cmake.sh",
|
||||
"{{template_dir}}/../scripts/build/install-codeql-bundle.sh",
|
||||
"{{template_dir}}/../scripts/build/install-container-tools.sh",
|
||||
"{{template_dir}}/../scripts/build/install-dotnetcore-sdk.sh",
|
||||
"{{template_dir}}/../scripts/build/install-erlang.sh",
|
||||
"{{template_dir}}/../scripts/build/install-firefox.sh",
|
||||
"{{template_dir}}/../scripts/build/install-microsoft-edge.sh",
|
||||
"{{template_dir}}/../scripts/build/install-gcc-compilers.sh",
|
||||
"{{template_dir}}/../scripts/build/install-gfortran.sh",
|
||||
"{{template_dir}}/../scripts/build/install-git.sh",
|
||||
"{{template_dir}}/../scripts/build/install-git-lfs.sh",
|
||||
"{{template_dir}}/../scripts/build/install-github-cli.sh",
|
||||
"{{template_dir}}/../scripts/build/install-google-chrome.sh",
|
||||
"{{template_dir}}/../scripts/build/install-google-cloud-cli.sh",
|
||||
"{{template_dir}}/../scripts/build/install-haskell.sh",
|
||||
"{{template_dir}}/../scripts/build/install-heroku.sh",
|
||||
"{{template_dir}}/../scripts/build/install-hhvm.sh",
|
||||
"{{template_dir}}/../scripts/build/install-java-tools.sh",
|
||||
"{{template_dir}}/../scripts/build/install-kubernetes-tools.sh",
|
||||
"{{template_dir}}/../scripts/build/install-oc-cli.sh",
|
||||
"{{template_dir}}/../scripts/build/install-leiningen.sh",
|
||||
"{{template_dir}}/../scripts/build/install-miniconda.sh",
|
||||
"{{template_dir}}/../scripts/build/install-mono.sh",
|
||||
"{{template_dir}}/../scripts/build/install-kotlin.sh",
|
||||
"{{template_dir}}/../scripts/build/install-mysql.sh",
|
||||
"{{template_dir}}/../scripts/build/install-mssql-tools.sh",
|
||||
"{{template_dir}}/../scripts/build/install-sqlpackage.sh",
|
||||
"{{template_dir}}/../scripts/build/install-nginx.sh",
|
||||
"{{template_dir}}/../scripts/build/install-nvm.sh",
|
||||
"{{template_dir}}/../scripts/build/install-nodejs.sh",
|
||||
"{{template_dir}}/../scripts/build/install-bazel.sh",
|
||||
"{{template_dir}}/../scripts/build/install-oras-cli.sh",
|
||||
"{{template_dir}}/../scripts/build/install-phantomjs.sh",
|
||||
"{{template_dir}}/../scripts/build/install-php.sh",
|
||||
"{{template_dir}}/../scripts/build/install-postgresql.sh",
|
||||
"{{template_dir}}/../scripts/build/install-pulumi.sh",
|
||||
"{{template_dir}}/../scripts/build/install-ruby.sh",
|
||||
"{{template_dir}}/../scripts/build/install-rlang.sh",
|
||||
"{{template_dir}}/../scripts/build/install-rust.sh",
|
||||
"{{template_dir}}/../scripts/build/install-julia.sh",
|
||||
"{{template_dir}}/../scripts/build/install-sbt.sh",
|
||||
"{{template_dir}}/../scripts/build/install-selenium.sh",
|
||||
"{{template_dir}}/../scripts/build/install-terraform.sh",
|
||||
"{{template_dir}}/../scripts/build/install-packer.sh",
|
||||
"{{template_dir}}/../scripts/build/install-vcpkg.sh",
|
||||
"{{template_dir}}/../scripts/build/configure-dpkg.sh",
|
||||
"{{template_dir}}/../scripts/build/install-mongodb.sh",
|
||||
"{{template_dir}}/../scripts/build/install-yq.sh",
|
||||
"{{template_dir}}/../scripts/build/install-android-sdk.sh",
|
||||
"{{template_dir}}/../scripts/build/install-pypy.sh",
|
||||
"{{template_dir}}/../scripts/build/install-python.sh",
|
||||
"{{template_dir}}/../scripts/build/install-zstd.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/build/install-docker-compose.sh",
|
||||
"{{template_dir}}/../scripts/build/install-docker.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/build/Install-Toolset.ps1",
|
||||
"{{template_dir}}/../scripts/build/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/build/install-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/build/install-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",
|
||||
"scripts": [
|
||||
"{{template_dir}}/../scripts/build/configure-snap.sh"
|
||||
],
|
||||
"environment_vars": [
|
||||
"HELPER_SCRIPTS={{user `helper_script_folder`}}"
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"expect_disconnect": true,
|
||||
"inline": [
|
||||
"echo 'Reboot VM'",
|
||||
"sudo reboot"
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"pause_before": "60s",
|
||||
"start_retry_timeout": "10m",
|
||||
"scripts": [
|
||||
"{{template_dir}}/../scripts/build/cleanup.sh"
|
||||
],
|
||||
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"max_retries": 3,
|
||||
"start_retry_timeout": "2m",
|
||||
"inline": [
|
||||
"pwsh -Command Write-Host Running Generate-SoftwareReport.ps1 script",
|
||||
"pwsh -File {{user `image_folder`}}/SoftwareReport/Generate-SoftwareReport.ps1 -OutputDirectory {{user `image_folder`}}",
|
||||
"pwsh -Command Write-Host Running RunAll-Tests.ps1 script",
|
||||
"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`}}/software-report.md",
|
||||
"destination": "{{template_dir}}/../Ubuntu2004-Readme.md",
|
||||
"direction": "download"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "{{user `image_folder`}}/software-report.json",
|
||||
"destination": "{{template_dir}}/../software-report.json",
|
||||
"direction": "download"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"scripts":[
|
||||
"{{template_dir}}/../scripts/build/configure-system.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": "file",
|
||||
"source": "{{template_dir}}/../assets/ubuntu2004.conf",
|
||||
"destination": "/tmp/"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"mkdir -p /etc/vsts",
|
||||
"cp /tmp/ubuntu2004.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 }}'"
|
||||
}
|
||||
]
|
||||
}
|
||||
432
images/ubuntu/templates/ubuntu-20.04.pkr.hcl
Normal file
432
images/ubuntu/templates/ubuntu-20.04.pkr.hcl
Normal file
@@ -0,0 +1,432 @@
|
||||
packer {
|
||||
required_plugins {
|
||||
azure = {
|
||||
source = "github.com/hashicorp/azure"
|
||||
version = "~> 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
managed_image_name = var.managed_image_name != "" ? var.managed_image_name : "packer-${var.image_os}-${var.image_version}"
|
||||
}
|
||||
|
||||
variable "allowed_inbound_ip_addresses" {
|
||||
type = list(string)
|
||||
default = []
|
||||
}
|
||||
|
||||
variable "azure_tags" {
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "build_resource_group_name" {
|
||||
type = string
|
||||
default = "${env("BUILD_RESOURCE_GROUP_NAME")}"
|
||||
}
|
||||
|
||||
variable "client_cert_path" {
|
||||
type = string
|
||||
default = "${env("ARM_CLIENT_CERT_PATH")}"
|
||||
}
|
||||
|
||||
variable "client_id" {
|
||||
type = string
|
||||
default = "${env("ARM_CLIENT_ID")}"
|
||||
}
|
||||
|
||||
variable "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 = "ubuntu20"
|
||||
}
|
||||
|
||||
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 "location" {
|
||||
type = string
|
||||
default = "${env("ARM_RESOURCE_LOCATION")}"
|
||||
}
|
||||
|
||||
variable "managed_image_name" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "managed_image_resource_group_name" {
|
||||
type = string
|
||||
default = "${env("ARM_RESOURCE_GROUP")}"
|
||||
}
|
||||
|
||||
variable "private_virtual_network_with_public_ip" {
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "subscription_id" {
|
||||
type = string
|
||||
default = "${env("ARM_SUBSCRIPTION_ID")}"
|
||||
}
|
||||
|
||||
variable "temp_resource_group_name" {
|
||||
type = string
|
||||
default = "${env("TEMP_RESOURCE_GROUP_NAME")}"
|
||||
}
|
||||
|
||||
variable "tenant_id" {
|
||||
type = string
|
||||
default = "${env("ARM_TENANT_ID")}"
|
||||
}
|
||||
|
||||
variable "virtual_network_name" {
|
||||
type = string
|
||||
default = "${env("VNET_NAME")}"
|
||||
}
|
||||
|
||||
variable "virtual_network_resource_group_name" {
|
||||
type = string
|
||||
default = "${env("VNET_RESOURCE_GROUP")}"
|
||||
}
|
||||
|
||||
variable "virtual_network_subnet_name" {
|
||||
type = string
|
||||
default = "${env("VNET_SUBNET")}"
|
||||
}
|
||||
|
||||
variable "vm_size" {
|
||||
type = string
|
||||
default = "Standard_D4s_v4"
|
||||
}
|
||||
|
||||
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}"
|
||||
image_offer = "0001-com-ubuntu-server-focal"
|
||||
image_publisher = "canonical"
|
||||
image_sku = "20_04-lts"
|
||||
location = "${var.location}"
|
||||
managed_image_name = "${local.managed_image_name}"
|
||||
managed_image_resource_group_name = "${var.managed_image_resource_group_name}"
|
||||
os_disk_size_gb = "86"
|
||||
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}"
|
||||
|
||||
dynamic "azure_tag" {
|
||||
for_each = var.azure_tags
|
||||
content {
|
||||
name = azure_tag.key
|
||||
value = azure_tag.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
sources = ["source.azure-arm.build_image"]
|
||||
|
||||
provisioner "shell" {
|
||||
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
inline = ["mkdir ${var.image_folder}", "chmod 777 ${var.image_folder}"]
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
script = "${path.root}/../scripts/build/configure-apt-mock.sh"
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
environment_vars = ["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.helper_script_folder}"
|
||||
source = "${path.root}/../scripts/helpers"
|
||||
}
|
||||
|
||||
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-2004.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}"]
|
||||
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 = [
|
||||
"${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-aliyun-cli.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-erlang.sh",
|
||||
"${path.root}/../scripts/build/install-firefox.sh",
|
||||
"${path.root}/../scripts/build/install-microsoft-edge.sh",
|
||||
"${path.root}/../scripts/build/install-gcc-compilers.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-heroku.sh",
|
||||
"${path.root}/../scripts/build/install-hhvm.sh",
|
||||
"${path.root}/../scripts/build/install-java-tools.sh",
|
||||
"${path.root}/../scripts/build/install-kubernetes-tools.sh",
|
||||
"${path.root}/../scripts/build/install-oc-cli.sh",
|
||||
"${path.root}/../scripts/build/install-leiningen.sh",
|
||||
"${path.root}/../scripts/build/install-miniconda.sh",
|
||||
"${path.root}/../scripts/build/install-mono.sh",
|
||||
"${path.root}/../scripts/build/install-kotlin.sh",
|
||||
"${path.root}/../scripts/build/install-mysql.sh",
|
||||
"${path.root}/../scripts/build/install-mssql-tools.sh",
|
||||
"${path.root}/../scripts/build/install-sqlpackage.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-oras-cli.sh",
|
||||
"${path.root}/../scripts/build/install-phantomjs.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-rlang.sh",
|
||||
"${path.root}/../scripts/build/install-rust.sh",
|
||||
"${path.root}/../scripts/build/install-julia.sh",
|
||||
"${path.root}/../scripts/build/install-sbt.sh",
|
||||
"${path.root}/../scripts/build/install-selenium.sh",
|
||||
"${path.root}/../scripts/build/install-terraform.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-mongodb.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_LOGIN=${var.dockerhub_login}", "DOCKERHUB_PASSWORD=${var.dockerhub_password}"]
|
||||
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
scripts = ["${path.root}/../scripts/build/install-docker-compose.sh", "${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"]
|
||||
}
|
||||
|
||||
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 -Command Write-Host Running Generate-SoftwareReport.ps1 script",
|
||||
"pwsh -File ${var.image_folder}/SoftwareReport/Generate-SoftwareReport.ps1 -OutputDirectory ${var.image_folder}",
|
||||
"pwsh -Command Write-Host Running RunAll-Tests.ps1 script",
|
||||
"pwsh -File ${var.image_folder}/tests/RunAll-Tests.ps1 -OutputDirectory ${var.image_folder}"
|
||||
]
|
||||
max_retries = "3"
|
||||
start_retry_timeout = "2m"
|
||||
}
|
||||
|
||||
provisioner "file" {
|
||||
destination = "${path.root}/../Ubuntu2004-Readme.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 "file" {
|
||||
destination = "/tmp/"
|
||||
source = "${path.root}/../assets/ubuntu2004.conf"
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
inline = ["mkdir -p /etc/vsts", "cp /tmp/ubuntu2004.conf /etc/vsts/machine_instance.conf"]
|
||||
}
|
||||
|
||||
provisioner "shell" {
|
||||
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
inline = ["sleep 30", "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,12 @@
|
||||
packer {
|
||||
required_plugins {
|
||||
azure = {
|
||||
source = "github.com/hashicorp/azure"
|
||||
version = "~> 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
managed_image_name = var.managed_image_name != "" ? var.managed_image_name : "packer-${var.image_os}-${var.image_version}"
|
||||
}
|
||||
@@ -17,9 +26,9 @@ variable "build_resource_group_name" {
|
||||
default = "${env("BUILD_RESOURCE_GROUP_NAME")}"
|
||||
}
|
||||
|
||||
variable "managed_image_name" {
|
||||
variable "client_cert_path" {
|
||||
type = string
|
||||
default = ""
|
||||
default = "${env("ARM_CLIENT_CERT_PATH")}"
|
||||
}
|
||||
|
||||
variable "client_id" {
|
||||
@@ -33,16 +42,6 @@ variable "client_secret" {
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "client_cert_path" {
|
||||
type = string
|
||||
default = "${env("ARM_CLIENT_CERT_PATH")}"
|
||||
}
|
||||
|
||||
variable "commit_url" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "dockerhub_login" {
|
||||
type = string
|
||||
default = "${env("DOCKERHUB_LOGIN")}"
|
||||
@@ -84,8 +83,9 @@ variable "installer_script_folder" {
|
||||
}
|
||||
|
||||
variable "install_password" {
|
||||
type = string
|
||||
default = ""
|
||||
type = string
|
||||
default = ""
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "location" {
|
||||
@@ -93,9 +93,9 @@ variable "location" {
|
||||
default = "${env("ARM_RESOURCE_LOCATION")}"
|
||||
}
|
||||
|
||||
variable "private_virtual_network_with_public_ip" {
|
||||
type = bool
|
||||
default = false
|
||||
variable "managed_image_name" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "managed_image_resource_group_name" {
|
||||
@@ -103,6 +103,11 @@ variable "managed_image_resource_group_name" {
|
||||
default = "${env("ARM_RESOURCE_GROUP")}"
|
||||
}
|
||||
|
||||
variable "private_virtual_network_with_public_ip" {
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "subscription_id" {
|
||||
type = string
|
||||
default = "${env("ARM_SUBSCRIPTION_ID")}"
|
||||
@@ -141,18 +146,18 @@ variable "vm_size" {
|
||||
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}"
|
||||
client_cert_path = "${var.client_cert_path}"
|
||||
image_offer = "0001-com-ubuntu-server-jammy"
|
||||
image_publisher = "canonical"
|
||||
image_sku = "22_04-lts"
|
||||
location = "${var.location}"
|
||||
managed_image_name = "${local.managed_image_name}"
|
||||
managed_image_resource_group_name = "${var.managed_image_resource_group_name}"
|
||||
os_disk_size_gb = "86"
|
||||
os_type = "Linux"
|
||||
private_virtual_network_with_public_ip = "${var.private_virtual_network_with_public_ip}"
|
||||
managed_image_name = "${local.managed_image_name}"
|
||||
managed_image_resource_group_name = "${var.managed_image_resource_group_name}"
|
||||
subscription_id = "${var.subscription_id}"
|
||||
temp_resource_group_name = "${var.temp_resource_group_name}"
|
||||
tenant_id = "${var.tenant_id}"
|
||||
@@ -187,9 +192,9 @@ build {
|
||||
environment_vars = ["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"
|
||||
"${path.root}/../scripts/build/install-ms-repos.sh",
|
||||
"${path.root}/../scripts/build/configure-apt-sources.sh",
|
||||
"${path.root}/../scripts/build/configure-apt.sh"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -269,67 +274,67 @@ build {
|
||||
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 = [
|
||||
"${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-aliyun-cli.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-firefox.sh",
|
||||
"${path.root}/../scripts/build/install-microsoft-edge.sh",
|
||||
"${path.root}/../scripts/build/install-gcc-compilers.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-heroku.sh",
|
||||
"${path.root}/../scripts/build/install-java-tools.sh",
|
||||
"${path.root}/../scripts/build/install-kubernetes-tools.sh",
|
||||
"${path.root}/../scripts/build/install-oc-cli.sh",
|
||||
"${path.root}/../scripts/build/install-leiningen.sh",
|
||||
"${path.root}/../scripts/build/install-miniconda.sh",
|
||||
"${path.root}/../scripts/build/install-mono.sh",
|
||||
"${path.root}/../scripts/build/install-kotlin.sh",
|
||||
"${path.root}/../scripts/build/install-mysql.sh",
|
||||
"${path.root}/../scripts/build/install-mssql-tools.sh",
|
||||
"${path.root}/../scripts/build/install-sqlpackage.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-oras-cli.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-rlang.sh",
|
||||
"${path.root}/../scripts/build/install-rust.sh",
|
||||
"${path.root}/../scripts/build/install-julia.sh",
|
||||
"${path.root}/../scripts/build/install-sbt.sh",
|
||||
"${path.root}/../scripts/build/install-selenium.sh",
|
||||
"${path.root}/../scripts/build/install-terraform.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"
|
||||
]
|
||||
"${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-aliyun-cli.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-firefox.sh",
|
||||
"${path.root}/../scripts/build/install-microsoft-edge.sh",
|
||||
"${path.root}/../scripts/build/install-gcc-compilers.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-heroku.sh",
|
||||
"${path.root}/../scripts/build/install-java-tools.sh",
|
||||
"${path.root}/../scripts/build/install-kubernetes-tools.sh",
|
||||
"${path.root}/../scripts/build/install-oc-cli.sh",
|
||||
"${path.root}/../scripts/build/install-leiningen.sh",
|
||||
"${path.root}/../scripts/build/install-miniconda.sh",
|
||||
"${path.root}/../scripts/build/install-mono.sh",
|
||||
"${path.root}/../scripts/build/install-kotlin.sh",
|
||||
"${path.root}/../scripts/build/install-mysql.sh",
|
||||
"${path.root}/../scripts/build/install-mssql-tools.sh",
|
||||
"${path.root}/../scripts/build/install-sqlpackage.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-oras-cli.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-rlang.sh",
|
||||
"${path.root}/../scripts/build/install-rust.sh",
|
||||
"${path.root}/../scripts/build/install-julia.sh",
|
||||
"${path.root}/../scripts/build/install-sbt.sh",
|
||||
"${path.root}/../scripts/build/install-selenium.sh",
|
||||
"${path.root}/../scripts/build/install-terraform.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" {
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
packer {
|
||||
required_plugins {
|
||||
azure = {
|
||||
source = "github.com/hashicorp/azure"
|
||||
version = "~> 2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
locals {
|
||||
image_os = "ubuntu22"
|
||||
|
||||
@@ -26,9 +35,9 @@ variable "build_resource_group_name" {
|
||||
default = "${env("BUILD_RESOURCE_GROUP_NAME")}"
|
||||
}
|
||||
|
||||
variable "managed_image_name" {
|
||||
variable "client_cert_path" {
|
||||
type = string
|
||||
default = ""
|
||||
default = "${env("ARM_CLIENT_CERT_PATH")}"
|
||||
}
|
||||
|
||||
variable "client_id" {
|
||||
@@ -42,24 +51,15 @@ variable "client_secret" {
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "client_cert_path" {
|
||||
type = string
|
||||
default = "${env("ARM_CLIENT_CERT_PATH")}"
|
||||
}
|
||||
|
||||
variable "commit_url" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "image_version" {
|
||||
type = string
|
||||
default = "dev"
|
||||
}
|
||||
|
||||
variable "install_password" {
|
||||
type = string
|
||||
default = ""
|
||||
type = string
|
||||
default = ""
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "location" {
|
||||
@@ -67,9 +67,9 @@ variable "location" {
|
||||
default = "${env("ARM_RESOURCE_LOCATION")}"
|
||||
}
|
||||
|
||||
variable "private_virtual_network_with_public_ip" {
|
||||
type = bool
|
||||
default = false
|
||||
variable "managed_image_name" {
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "managed_image_resource_group_name" {
|
||||
@@ -77,6 +77,11 @@ variable "managed_image_resource_group_name" {
|
||||
default = "${env("ARM_RESOURCE_GROUP")}"
|
||||
}
|
||||
|
||||
variable "private_virtual_network_with_public_ip" {
|
||||
type = bool
|
||||
default = false
|
||||
}
|
||||
|
||||
variable "subscription_id" {
|
||||
type = string
|
||||
default = "${env("ARM_SUBSCRIPTION_ID")}"
|
||||
@@ -162,8 +167,7 @@ build {
|
||||
// Create folder to store temporary data
|
||||
provisioner "shell" {
|
||||
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
inline = ["mkdir ${local.image_folder}",
|
||||
"chmod 777 ${local.image_folder}"]
|
||||
inline = ["mkdir ${local.image_folder}", "chmod 777 ${local.image_folder}"]
|
||||
}
|
||||
|
||||
// Add apt wrapper to implement retries
|
||||
@@ -177,8 +181,8 @@ build {
|
||||
environment_vars = ["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.sh"
|
||||
"${path.root}/../scripts/build/install-ms-repos.sh",
|
||||
"${path.root}/../scripts/build/configure-apt.sh"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -252,10 +256,10 @@ build {
|
||||
environment_vars = ["DEBIAN_FRONTEND=noninteractive", "HELPER_SCRIPTS=${local.helper_script_folder}", "INSTALLER_SCRIPT_FOLDER=${local.installer_script_folder}"]
|
||||
execute_command = "sudo sh -c '{{ .Vars }} {{ .Path }}'"
|
||||
scripts = [
|
||||
"${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-zstd.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-zstd.sh"
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user