-
Notifications
You must be signed in to change notification settings - Fork 0
Advanced Topics Ci Cd Setup Guide
This document describes the Continuous Integration/Continuous Deployment (CI/CD) pipeline implemented for validating that Dynamic Devices layers meet Yocto Project Compatible requirements and are ready for certification.
File: .github/workflows/yocto-layer-validation.yml
The main CI/CD pipeline that automatically validates layers against Yocto Project Compatible requirements:
- Multi-Version Testing: Validates against multiple Yocto releases (scarthgap, kirkstone)
- Multi-Layer Support: Tests both BSP and distro layers independently
- Automated Environment Setup: Downloads and configures required Yocto components
- Comprehensive Validation: Runs structure checks and yocto-check-layer script
- Artifact Collection: Saves validation results and logs
- PR Integration: Comments on pull requests with validation results
- Push to
mainordevelopbranches - Pull requests to
mainbranch - Weekly scheduled runs (Sundays at 2 AM UTC)
- Manual workflow dispatch with branch selection
strategy:
matrix:
yocto_branch: [scarthgap, kirkstone]
layer: [meta-dynamicdevices-bsp, meta-dynamicdevices-distro]File: scripts/validation/validate-layers.sh
Comprehensive local validation script for development and testing:
# Validate all layers against scarthgap
./scripts/validation/validate-layers.sh --layer all --branch scarthgap
# Validate BSP layer only with verbose output
./scripts/validation/validate-layers.sh --layer bsp --verbose
# Clean environment and validate distro layer
./scripts/validation/validate-layers.sh --layer distro --clean- Flexible Layer Selection: Validate individual layers or all layers
- Multi-Branch Support: Test against different Yocto releases
- Environment Management: Automatic setup and cleanup of validation environment
- Detailed Reporting: Generate comprehensive validation reports
- Verbose Logging: Optional detailed output for debugging
File: scripts/validation/pre-commit-hook.sh
Git pre-commit hook for immediate validation of changes:
- Fast Validation: Quick structure and syntax checks
- Change Detection: Only validates modified layers
- Recipe Validation: Basic recipe syntax and requirement checks
- Layer Separation: Ensures proper BSP/distro separation
- Required Files: Validates presence of README, SECURITY, LICENSE files
# Install pre-commit hook
ln -sf ../../scripts/validation/pre-commit-hook.sh .git/hooks/pre-commit
# Test pre-commit hook
./scripts/validation/pre-commit-hook.sh-
Required Files Check:
-
README.md- Layer documentation -
SECURITY.md- Security vulnerability reporting -
LICENSE- Dual GPL-3.0/Commercial licensing -
conf/layer.conf- Layer configuration
-
-
Layer Configuration Validation:
- Required variables:
BBFILE_COLLECTIONS,BBFILE_PATTERN,BBFILE_PRIORITY,LAYERVERSION - Proper dependencies:
LAYERDEPENDS,LAYERSERIES_COMPAT - Valid priority values and syntax
- Required variables:
-
Layer Separation Compliance:
- BSP Layer: Hardware-only content, no distro configurations
- Distro Layer: Distribution policy only, no machine configurations
- Application Layer: Middleware and applications, proper dependencies
The official Yocto Project validation script checks:
- Layer compatibility with OpenEmbedded-Core
- Recipe parsing and syntax validation
- Dependency resolution and conflicts
- Build system integration
- Best practices compliance
The yocto-check-layer script requires specific command-line syntax:
# Basic usage - layer directory as positional argument
python3 scripts/yocto-check-layer LAYER_DIR
# With output log
python3 scripts/yocto-check-layer LAYER_DIR --output-log validation.log
# Disable automatic dependency checking
python3 scripts/yocto-check-layer LAYER_DIR --no-auto-dependency
# Multiple layers
python3 scripts/yocto-check-layer LAYER1_DIR LAYER2_DIR
# With additional dependencies
python3 scripts/yocto-check-layer LAYER_DIR --dependency DEP_LAYER_DIR
# Complete CI example
python3 ../build/layers/openembedded-core/scripts/yocto-check-layer \
.. \
--no-auto-dependency \
--output-log ../layer-check.log❌ Incorrect Usage:
# Wrong: --layer flag doesn't exist
yocto-check-layer --layer LAYER_DIR
# Wrong: --no-auto-dependencies (plural) doesn't exist
yocto-check-layer LAYER_DIR --no-auto-dependencies
# Wrong: Missing positional argument
yocto-check-layer --output-log validation.log✅ Correct Usage:
# Correct: Layer directory as positional argument
yocto-check-layer LAYER_DIR
# Correct: --no-auto-dependency (singular)
yocto-check-layer LAYER_DIR --no-auto-dependency
# Correct: Layer path first, then options
yocto-check-layer LAYER_DIR --output-log validation.log-
Positional:
LAYER_DIR- Layer directory to check (required) -
--output-log FILE- File to output log (optional) -
--dependency LAYER_DIR- Additional layers to process for dependencies -
--no-auto-dependency- Disable automatic testing of dependencies -
--machines MACHINE- List of MACHINEs to use during testing -
--additional-layers LAYER_DIR- Additional layers to add during testing -
--with-software-layer-signature-check- Check software layer signatures (default) -
--without-software-layer-signature-check- Disable signature checking -
--no-auto- Disable auto layer discovery -
--debug- Enable debug output -
--quiet- Print only errors
Testing against multiple Yocto releases ensures:
- Forward Compatibility: Layers work with newer Yocto versions
- Backward Compatibility: Support for LTS releases
- Migration Path: Clear upgrade path between versions
graph TD
A[Code Push/PR] --> B[Trigger CI Pipeline]
B --> C[Setup Build Environment]
C --> D[Install Dependencies]
D --> E[Clone Yocto Components]
E --> F[Validate Layer Structure]
F --> G[Run yocto-check-layer]
G --> H[Analyze Results]
H --> I[Generate Reports]
I --> J[Upload Artifacts]
J --> K[Update PR Comments]
K --> L[Pipeline Complete]
F --> M[Structure Failed]
G --> N[Layer Check Failed]
M --> O[Fail Pipeline]
N --> O
The CI pipeline automatically sets up:
- Ubuntu 22.04 Runner with required system packages
- Python 3 with BitBake dependencies
- Git repositories for OpenEmbedded-Core, BitBake, meta-openembedded
- Build configuration with minimal local.conf and bblayers.conf
- Caching for downloads and sstate to improve performance
For local validation:
-
System Requirements:
- Ubuntu 20.04+ or compatible Linux distribution
- Python 3.8+ with pip
- Git 2.20+
- Standard build tools (gcc, make, etc.)
-
Setup Commands:
# Install system dependencies sudo apt-get install build-essential python3 python3-pip git # Run validation script (will setup Yocto environment) ./scripts/validation/validate-layers.sh --layer all
All README files include status badges showing:
- Layer Validation Status: Real-time CI pipeline status
- YP Compliance Ready: Meets Yocto Project Compatible requirements (ready for certification)
- Multi-Version Support: Tested Yocto releases
Generated reports include:
- Structure Analysis: Required files and configuration validation
- Layer Check Results: Full yocto-check-layer output and analysis
- Multi-Version Summary: Compatibility across Yocto releases
- Error Analysis: Detailed error messages and resolution guidance
CI pipeline stores:
- Validation Logs: Complete yocto-check-layer output
- Build Configurations: Generated local.conf and bblayers.conf
- Reports: Markdown reports with analysis and recommendations
- Retention: 30 days for validation logs, 90 days for reports
-
BitBake Import Errors:
- Ensure proper PYTHONPATH setup
- Verify BitBake version compatibility
- Check Python dependencies
-
Layer Dependency Failures:
- Validate LAYERDEPENDS settings
- Ensure required layers are available
- Check layer priority conflicts
-
Recipe Parsing Errors:
- Validate recipe syntax
- Check variable assignments
- Verify file paths and includes
# Verbose validation with full output
./scripts/validation/validate-layers.sh --verbose --layer all
# Check specific layer configuration
python3 -c "
import sys
sys.path.insert(0, 'build/validation/layers/bitbake/lib')
import bb.parse
print('BitBake import successful')
"
# Manual yocto-check-layer execution
cd build/validation
python3 layers/openembedded-core/scripts/yocto-check-layer \
../../meta-dynamicdevices-bsp \
--no-auto-dependency \
--output-log manual-check.log-
Install Hook:
ln -sf ../../scripts/validation/pre-commit-hook.sh .git/hooks/pre-commit - Automatic Validation: Runs on every commit attempt
- Fast Feedback: Quick validation without full environment setup
- Automatic Triggering: CI runs on all pull requests
- Status Checks: Required for merge approval
- Comment Integration: Results posted as PR comments
- Artifact Links: Direct access to validation logs and reports
- Scheduled Runs: Weekly validation ensures ongoing compliance
- Multi-Version Testing: Validates against supported Yocto releases
- Regression Detection: Identifies compatibility issues early
- Release Readiness: Confirms layers are ready for production use
- Incremental Validation: Run local validation frequently during development
-
Clean Environments: Use
--cleanflag to ensure reproducible results - Multi-Version Testing: Test against all supported Yocto releases
- Documentation Updates: Keep README and SECURITY files current
- Regular Updates: Keep Yocto versions and dependencies current
- Cache Management: Monitor cache effectiveness and cleanup policies
- Performance Optimization: Optimize pipeline execution time
- Security Updates: Keep runner images and dependencies updated
- Comprehensive Testing: Validate all layers and configurations
- Error Analysis: Investigate and resolve all validation failures
- Documentation: Maintain accurate and current documentation
- Community Standards: Follow Yocto Project best practices and guidelines
- Performance Optimization: Parallel validation execution
- Extended Testing: Integration with actual build testing
- Security Scanning: Automated vulnerability assessment
- Compliance Tracking: Historical compliance trend analysis
- Integration Testing: Cross-layer compatibility validation
- OpenEmbedded Index: Automated layer registration
- Yocto Project Compatible: Submit for official certification once eligible
- Community Feedback: Integration with Yocto Project tools and processes
- Best Practice Sharing: Contribution to Yocto Project documentation
This CI/CD pipeline ensures continuous validation that layers meet Yocto Project Compatible requirements and are ready for official certification, maintaining high-quality, interoperable layers for the Dynamic Devices ecosystem.