feat: Add interactive packer build script 37/73637/2
authorAnil Belur <abelur@linuxfoundation.org>
Fri, 12 Sep 2025 23:29:58 +0000 (09:29 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Sat, 13 Sep 2025 03:07:34 +0000 (13:07 +1000)
commit3d7cc9a5060cc0f44b8fb9e403dcca75de94e93e
treecb2d41b84c72a892dd6d3527d4d784421fc4d5d4
parent441ae6356f2cb0a3a2087f4a425104bc410051b3
feat: Add interactive packer build script

This commit implements comprehensive SSH/SCP compatibility fixes and
creates an interactive build script for Jenkins Job Builder (JJB)
validated Packer image combinations. Make life easy for maintainers
to run manual builds at times when new base images need to be uploaded
and built manually allowing simultanous builds.

- templates/builder.pkr.hcl
- templates/builder-aws.pkr.hcl
- templates/docker.pkr.hcl
- templates/docker-aws.pkr.hcl
- templates/devstack.pkr.hcl
- templates/devstack-pre-pip-yoga.pkr.hcl
- templates/windows-builder.pkr.hcl

1. **Added local_build variable**: Controls SSH compatibility mode
- Type: bool, default: false
- Description: "Set to true for local builds to enable SSH/scp
  compatibility"

2. **Added conditional SSH arguments**: Using HCL ternary expressions
- For local builds (local_build=true):
* `--scp-extra-args "'-O'"` - Fixes SCP upload failures
* Enhanced SSH algorithms including PubkeyAcceptedAlgorithms=+ssh-rsa
- For CI builds (local_build=false): Standard SSH arguments

3. **Updated ansible provisioner**: Replaced hardcoded extra_arguments
with dynamic `local.ssh_extra_args`

4. **Preserved existing functionality**: DevStack yoga templates
maintain existing extra-vars while adding SSH compatibility

- **JJB Integration**: Reads supported combinations from
  releng-packer-jobs.yaml
- **EOL Platform Exclusion**: Automatically excludes ubuntu-18.04 EOL
- **21 Validated Combinations**: Only builds JJB-approved
  platform+template pairs
- **Comprehensive Logging**: Individual timestamped log files per
  build in /tmp/
- **Execution Modes**: Interactive, dry-run, and background build
  options
- **Auto SSH Compatibility**: Automatically sets local_build=true for
  all builds

- Smart file discovery and validation
- User-friendly numbered menus
- Real-time build progress tracking
- Proper relative path handling
- Background process management
- Build status reporting with exit codes

- Complete usage instructions for JJB-based builds
- Prerequisites and environment setup guide
- All 21 JJB combination listings by image type
- Example usage scenarios
- Troubleshooting section with common issues
- Comprehensive logging and monitoring documentation

This addresses critical SSH/SCP compatibility issues that were causing
Packer builds to fail with errors like:
scp: dest open "'~user/.ansible/tmp/...": No such file or directory

The conditional approach allows:
- **Local Development**: Enhanced SSH compatibility when local_build=true
- **CI/CD Compatibility**: Preserved existing behavior when local_build=false
- **Maintainability**: Centralized SSH logic in reusable locals blocks

Validated against Jenkins Job Builder configuration ensuring only
approved platform/template combinations are built, improving build
reliability and reducing maintenance overhead.

Change-Id: I0ff854c63c96d97e98f8b5f436195c7af91fea36
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
README.md [new file with mode: 0644]
build-packer-images.sh [new file with mode: 0755]
provision/install-python.sh
releasenotes/notes/ssh-compatibility-and-jjb-script-6d6f1e3682b75a87.yaml [new file with mode: 0644]
templates/builder-aws.pkr.hcl
templates/builder.pkr.hcl
templates/devstack-pre-pip-yoga.pkr.hcl
templates/devstack.pkr.hcl
templates/docker-aws.pkr.hcl
templates/docker.pkr.hcl
templates/windows-builder.pkr.hcl