From c43d0450b276e8d34dc7dc6a24f9f7ea6026ead4 Mon Sep 17 00:00:00 2001 From: Joris van de Donk Date: Wed, 14 Aug 2024 14:15:00 +0000 Subject: [PATCH 1/6] fix: use `dnf` instead of `yum` to install packages on AL2023. This avoids a potential installation issue where packages can't be found in /var/cache or a lock can't be acquired. --- assets/packer/build-agents/linux/install_common.al2023.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/packer/build-agents/linux/install_common.al2023.sh b/assets/packer/build-agents/linux/install_common.al2023.sh index 98a1eaf7..0faa7012 100644 --- a/assets/packer/build-agents/linux/install_common.al2023.sh +++ b/assets/packer/build-agents/linux/install_common.al2023.sh @@ -25,7 +25,7 @@ echo "Updating packages..." sudo yum update -y echo "Installing packages..." sudo yum -y groupinstall "Development Tools" -sudo yum install -y awscli java-11-amazon-corretto-headless java-11-amazon-corretto-devel libarchive libarchive-devel unzip cmake python3 python3-pip python3-requests clang lld git openssl libcurl-devel openssl-devel uuid-devel zlib-devel pulseaudio-libs-devel jq freetype-devel libsndfile-devel python3 jq libX11-devel libXcursor-devel libXinerama-devel mesa-libGL-devel mesa-libGLU-devel libudev-devel libXi-devel libXrandr-devel dos2unix +sudo dnf install -y awscli java-11-amazon-corretto-headless java-11-amazon-corretto-devel libarchive libarchive-devel unzip cmake python3 python3-pip python3-requests clang lld git openssl libcurl-devel openssl-devel uuid-devel zlib-devel pulseaudio-libs-devel jq freetype-devel libsndfile-devel python3 jq libX11-devel libXcursor-devel libXinerama-devel mesa-libGL-devel mesa-libGLU-devel libudev-devel libXi-devel libXrandr-devel dos2unix sudo pip install boto3 botocore scons if [ "$(uname -p)" == "x86_64" ]; then sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm From 532740bf7dce772f323a0e34380cbbd6e4e4469d Mon Sep 17 00:00:00 2001 From: Joris van de Donk Date: Wed, 14 Aug 2024 14:15:23 +0000 Subject: [PATCH 2/6] fix: wait for dpkg lock when installing Ubuntu common packages --- assets/packer/build-agents/linux/install_common.ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/packer/build-agents/linux/install_common.ubuntu.sh b/assets/packer/build-agents/linux/install_common.ubuntu.sh index 9785e0bb..28305295 100644 --- a/assets/packer/build-agents/linux/install_common.ubuntu.sh +++ b/assets/packer/build-agents/linux/install_common.ubuntu.sh @@ -26,7 +26,7 @@ echo "deb [signed-by=/usr/share/keyrings/corretto-keyring.gpg] https://apt.corre echo "Updating apt.." sudo apt-get -o DPkg::Lock::Timeout=180 update -y echo "Installing packages..." -sudo apt-get install -y nfs-common libarchive-tools unzip cmake build-essential python3 python3-pip python3-requests python3-botocore clang lld git openssl libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev scons jq libsdl2-mixer-dev libsdl2-image-dev libsdl2-dev libfreetype-dev libsndfile1-dev libopenal-dev python3 jq libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libudev-dev libxi-dev libxrandr-dev java-11-amazon-corretto-jdk dos2unix +sudo apt-get -o DPkg::Lock::Timeout=180 install -y nfs-common libarchive-tools unzip cmake build-essential python3 python3-pip python3-requests python3-botocore clang lld git openssl libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev scons jq libsdl2-mixer-dev libsdl2-image-dev libsdl2-dev libfreetype-dev libsndfile1-dev libopenal-dev python3 jq libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libudev-dev libxi-dev libxrandr-dev java-11-amazon-corretto-jdk dos2unix sudo pip install boto3 echo "Installing AWS cli..." curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" From d77977181f4936eb33cfe0bc6fe2b8fcc75f5a4a Mon Sep 17 00:00:00 2001 From: Joris van de Donk Date: Wed, 14 Aug 2024 14:31:38 +0000 Subject: [PATCH 3/6] fix: on Ubuntu, install apt-transport-https prior to running octobuild setup script, so octobuild setup doesn't have to (it can fail to acquire the dpkg lock) --- .../build-agents/linux/install_octobuild.ubuntu.x86_64.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/packer/build-agents/linux/install_octobuild.ubuntu.x86_64.sh b/assets/packer/build-agents/linux/install_octobuild.ubuntu.x86_64.sh index eb806ccc..351986fe 100644 --- a/assets/packer/build-agents/linux/install_octobuild.ubuntu.x86_64.sh +++ b/assets/packer/build-agents/linux/install_octobuild.ubuntu.x86_64.sh @@ -2,7 +2,8 @@ # Install octobuild on Ubuntu, x86_64 only # (octobuild does not seem to have packages available for aarch64 at the moment) # Requires common tools to be installed first. -curl -1sLf 'https://dl.cloudsmith.io/public/octobuild/octobuild/setup.deb.sh' | sudo -E bash sudo apt-get -o DPkg::Lock::Timeout=180 update -y +sudo NEEDRESTART_MODE=a DEBIAN_FRONTEND=noninteractive apt-get -o DPkg::Lock::Timeout=180 install -y apt-transport-https +curl -1sLf 'https://dl.cloudsmith.io/public/octobuild/octobuild/setup.deb.sh' | sudo -E bash sudo NEEDRESTART_MODE=a DEBIAN_FRONTEND=noninteractive apt-get -o DPkg::Lock::Timeout=180 install -y octobuild sudo mkdir -p /etc/octobuild From a961b31465b873d0bdab5ae938e9bea309056190 Mon Sep 17 00:00:00 2001 From: Joris van de Donk Date: Thu, 26 Sep 2024 13:10:09 +0200 Subject: [PATCH 4/6] fix: remove install_git variable; it is not used --- assets/packer/build-agents/windows/windows.pkr.hcl | 3 --- 1 file changed, 3 deletions(-) diff --git a/assets/packer/build-agents/windows/windows.pkr.hcl b/assets/packer/build-agents/windows/windows.pkr.hcl index 9210f14b..162d8995 100644 --- a/assets/packer/build-agents/windows/windows.pkr.hcl +++ b/assets/packer/build-agents/windows/windows.pkr.hcl @@ -118,9 +118,6 @@ build { provisioner "powershell" { elevated_user = "Administrator" elevated_password = build.Password - environment_vars = [ - "INSTALL_GIT=${var.install_git}" - ] script = "./base_setup.ps1" } From 2dad63448afb2ebd8595257cbbdda0b589a3f5d6 Mon Sep 17 00:00:00 2001 From: Joris van de Donk Date: Thu, 26 Sep 2024 13:57:16 +0200 Subject: [PATCH 5/6] fix: remove profile variable for Linux build agents; it is not needed --- .../packer/build-agents/linux/amazon-linux-2023-arm64.pkr.hcl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/assets/packer/build-agents/linux/amazon-linux-2023-arm64.pkr.hcl b/assets/packer/build-agents/linux/amazon-linux-2023-arm64.pkr.hcl index bcbb83ec..578e46de 100644 --- a/assets/packer/build-agents/linux/amazon-linux-2023-arm64.pkr.hcl +++ b/assets/packer/build-agents/linux/amazon-linux-2023-arm64.pkr.hcl @@ -12,10 +12,6 @@ variable "region" { default = "us-west-2" } -variable "profile" { - type = string -} - variable "vpc_id" { type = string } From 564da765b1249443bba6d23ab4ce9dd3419ea65f Mon Sep 17 00:00:00 2001 From: Joris van de Donk Date: Thu, 26 Sep 2024 15:23:29 +0200 Subject: [PATCH 6/6] fix: adjust winrm timeout to 15 minutes --- assets/packer/build-agents/windows/windows.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/packer/build-agents/windows/windows.pkr.hcl b/assets/packer/build-agents/windows/windows.pkr.hcl index 162d8995..83a733ce 100644 --- a/assets/packer/build-agents/windows/windows.pkr.hcl +++ b/assets/packer/build-agents/windows/windows.pkr.hcl @@ -90,7 +90,7 @@ source "amazon-ebs" "base" { winrm_insecure = true winrm_username = "Administrator" winrm_use_ssl = true - winrm_timeout = "1h" + winrm_timeout = "15m" user_data_file = "./userdata.ps1" # network specific details