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>