Fix: AWS AMI builds for Ubuntu and CentOS Stream 9 13/73913/1 master v0.17.5
authorAnil Belur <abelur@linuxfoundation.org>
Mon, 1 Dec 2025 07:27:48 +0000 (17:27 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Mon, 1 Dec 2025 07:51:53 +0000 (17:51 +1000)
commit803de051d6843bb02920d7dc4c0ddaa9f0ee6319
treeb8f835df47ef6ddccaadb0094cc556d4fbc06657
parentfccb3974f81a5859107eb8284beeeb3fbab39ac1
Fix: AWS AMI builds for Ubuntu and CentOS Stream 9

This commit addresses multiple issues preventing successful AMI builds
on AWS for Ubuntu 20.04, 22.04, 24.04, and CentOS Stream 9.

- **Fixed source AMI filters**: Updated to use canonical owner ID (099720109477)
  instead of aws-marketplace for Ubuntu images
- **Removed product code filtering**: Product codes are not applicable for
  canonical Ubuntu AMIs
- **Updated AMI name patterns**: Aligned with current Ubuntu naming conventions
  - Ubuntu 20.04: ubuntu-*20.04*
  - Ubuntu 22.04: ubuntu-*22.04*
  - Ubuntu 24.04: ubuntu-*24.04*

- **Fixed version-specific conditionals**: Changed CentOS 8+ filters to
  CentOS 8 only (version('8', '==')) to prevent incompatible packages
  from being installed on Stream 9
- **Removed obsolete packages**: Excluded packages not available in
  CentOS Stream 9 repositories:
  - compat-openssl10* (not available in Stream 9)
  - python36* packages (Stream 9 uses python3.9+)
  - openssl11* packages

- **Enable SR-IOV networking**: Added `enable_ena_support = true` to
  enable enhanced networking on all AMIs for better performance and
  Jenkins EC2 plugin compatibility
- **Increased root volume size**: Changed from 8GB to 10GB to prevent
  "No space left on device" errors during Jenkins builds
- **Standardized instance types**: Using t3.small for consistent builds
- **Improved metadata support**: Added IMDS v2 configuration

- **Added apt-get update**: Ensures package lists are current before
  installing dependencies on Ubuntu
- **Fixed repository availability**: Prevents package installation failures
  due to stale package lists

- ✅ Ubuntu 22.04 AMI: ami-049dc0c4ecd9335ae (verified working in Jenkins)
- ✅ CentOS Stream 9 AMI: ami-0541c45aeac2e4a04 (build successful)
- ✅ Disk space issue resolved (10GB root volume)
- ✅ Jenkins JClouds plugin can provision instances

- Minor pip dependency conflicts in Jenkins builds (non-blocking, UNSTABLE status)
- Ansible role fixes need to be submitted separately to ansible/roles repo

- Resolves AWS AMI provisioning failures
- Fixes "Invalid Image Id" errors in Jenkins EC2 plugin
- Fixes "No space left on device" errors during builds

Change-Id: I250622af42847c6078cd6f76eb9068ae70c72a91
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
provision/install-base-pkgs-RedHat.yaml
provision/install-python.sh
releasenotes/notes/fix-aws-ami-builds-ubuntu-centos9-b3ca80de7ea87ee8.yaml [new file with mode: 0644]
templates/builder-aws.pkr.hcl
vars/centos-cs-9.pkrvars.hcl
vars/ubuntu-20.04-arm64.pkrvars.hcl
vars/ubuntu-20.04.pkrvars.hcl
vars/ubuntu-22.04.pkrvars.hcl
vars/ubuntu-24.04-arm64.pkrvars.hcl
vars/ubuntu-24.04.pkrvars.hcl