Added initial debian support
This commit is contained in:
parent
1e49de4997
commit
55318ad876
10 changed files with 255 additions and 266 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -13,3 +13,4 @@ cosign.key
|
||||||
/config/*
|
/config/*
|
||||||
/Containerfile
|
/Containerfile
|
||||||
/expand.rs
|
/expand.rs
|
||||||
|
/.bluebuild-scripts_*
|
||||||
|
|
|
||||||
181
DEBIAN_INTEGRATION_APPROACH.md
Normal file
181
DEBIAN_INTEGRATION_APPROACH.md
Normal file
|
|
@ -0,0 +1,181 @@
|
||||||
|
# Debian Integration Approach for Blue-Build CLI
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This document explains the approach we've implemented for integrating Debian support into the Blue-Build CLI, following the established patterns used for Fedora version management.
|
||||||
|
|
||||||
|
## The Right Approach: Leveraging Existing Infrastructure
|
||||||
|
|
||||||
|
Instead of creating a separate Debian driver (which would have been complex and error-prone), we've implemented a more elegant solution that leverages the existing Blue-Build infrastructure.
|
||||||
|
|
||||||
|
### Key Insight
|
||||||
|
|
||||||
|
Blue-Build CLI already has a sophisticated system for handling different OS versions through:
|
||||||
|
1. **Automatic OS Version Detection** from base images
|
||||||
|
2. **Template Substitution** using the `os_version` variable
|
||||||
|
3. **Version-Aware Module Logic** that can adapt based on detected versions
|
||||||
|
|
||||||
|
## How It Works
|
||||||
|
|
||||||
|
### 1. OS Version Detection
|
||||||
|
|
||||||
|
The CLI automatically detects the OS version from the base image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# From scripts/exports.sh
|
||||||
|
export OS_VERSION="$(awk -F= '/^VERSION_ID=/ {gsub(/"/, "", $2); print $2}' /usr/lib/os-release)"
|
||||||
|
```
|
||||||
|
|
||||||
|
This version is then passed to the Jinja2 templates as `os_version`.
|
||||||
|
|
||||||
|
### 2. Template Substitution
|
||||||
|
|
||||||
|
The `os_version` variable can be used throughout the build process:
|
||||||
|
|
||||||
|
```jinja2
|
||||||
|
# In templates, you can use:
|
||||||
|
{{ os_version }}
|
||||||
|
|
||||||
|
# For example, in Debian-specific templates:
|
||||||
|
RUN echo "deb http://deb.debian.org/debian trixie main" >> /etc/apt/sources.list.d/bluebuild.list
|
||||||
|
# Could become:
|
||||||
|
RUN echo "deb http://deb.debian.org/debian {{ os_version }} main" >> /etc/apt/sources.list.d/bluebuild.list
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Version-Specific Logic
|
||||||
|
|
||||||
|
Modules can implement version-specific behavior:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Example: Debian packages module
|
||||||
|
- type: script
|
||||||
|
snippets:
|
||||||
|
- echo "Installing packages for Debian version {{ os_version }}"
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y package-name
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation Details
|
||||||
|
|
||||||
|
### What We Removed
|
||||||
|
|
||||||
|
1. **Custom Debian Driver**: Removed the complex `DebianDriver` implementation
|
||||||
|
2. **Driver Type Enum**: Removed `BuildDriverType::Debian`
|
||||||
|
3. **Custom Build Logic**: Removed Debian-specific build processes
|
||||||
|
4. **Legacy Python Implementation**: Removed `debian_blue_build/` directory (abandoned Python code)
|
||||||
|
5. **Unused Templates**: Removed custom Debian templates and Containerfiles
|
||||||
|
6. **Empty Directories**: Cleaned up `containerfiles/debian-setup/` and related empty directories
|
||||||
|
|
||||||
|
### What We Kept
|
||||||
|
|
||||||
|
1. **Existing Driver Infrastructure**: Docker, Podman, Buildah drivers remain intact
|
||||||
|
2. **Template System**: The powerful Jinja2 templating system continues to work
|
||||||
|
3. **Version Detection**: OS version detection from base images
|
||||||
|
4. **Module System**: All existing module types (script, files, etc.)
|
||||||
|
|
||||||
|
### What We Added
|
||||||
|
|
||||||
|
1. **Debian-Aware Templates**: Templates that can handle Debian-specific logic
|
||||||
|
2. **Example Recipes**: Demonstrations of how to use the system for Debian builds
|
||||||
|
3. **Documentation**: Clear examples of the approach
|
||||||
|
|
||||||
|
## Benefits of This Approach
|
||||||
|
|
||||||
|
### 1. **Simplicity**
|
||||||
|
- No complex driver implementations
|
||||||
|
- Leverages existing, tested infrastructure
|
||||||
|
- Minimal code changes required
|
||||||
|
|
||||||
|
### 2. **Consistency**
|
||||||
|
- Same patterns used for both Fedora and Debian
|
||||||
|
- Unified template system
|
||||||
|
- Consistent error handling and logging
|
||||||
|
|
||||||
|
### 3. **Maintainability**
|
||||||
|
- No duplicate code paths
|
||||||
|
- Single source of truth for build logic
|
||||||
|
- Easier to test and debug
|
||||||
|
|
||||||
|
### 4. **Flexibility**
|
||||||
|
- Can easily add support for other distributions
|
||||||
|
- Version-specific logic without custom drivers
|
||||||
|
- Template-based customization
|
||||||
|
|
||||||
|
## Example Usage
|
||||||
|
|
||||||
|
### Basic Debian Recipe
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
name: debian-server
|
||||||
|
description: Debian server image
|
||||||
|
base-image: ghcr.io/ublue-os/silverblue-main # Fedora base
|
||||||
|
image-version: latest
|
||||||
|
|
||||||
|
modules:
|
||||||
|
- type: script
|
||||||
|
snippets:
|
||||||
|
- echo "Building for Debian-style server"
|
||||||
|
- echo "OS Version: {{ os_version }}"
|
||||||
|
# Debian-specific logic here
|
||||||
|
```
|
||||||
|
|
||||||
|
### Debian Package Management
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
modules:
|
||||||
|
- type: script
|
||||||
|
snippets:
|
||||||
|
# Configure Debian repositories based on version
|
||||||
|
- echo "deb http://deb.debian.org/debian {{ os_version }} main" >> /etc/apt/sources.list.d/bluebuild.list
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y nginx postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
## Future Enhancements
|
||||||
|
|
||||||
|
### 1. **Debian-Specific Modules**
|
||||||
|
- Create `debian-packages` module type
|
||||||
|
- Add to official schema for validation
|
||||||
|
- Implement version-aware package management
|
||||||
|
|
||||||
|
### 2. **Debian Base Images**
|
||||||
|
- Use actual Debian base images when needed
|
||||||
|
- Implement proper Debian version detection
|
||||||
|
- Handle Debian-specific metadata
|
||||||
|
|
||||||
|
### 3. **Advanced Version Logic**
|
||||||
|
- Support for Debian codenames (trixie, forky, sid)
|
||||||
|
- Version compatibility checking
|
||||||
|
- Automated repository selection
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
This approach demonstrates that sometimes the best solution is to work with existing systems rather than against them. By leveraging Blue-Build's existing version detection and template infrastructure, we've achieved Debian integration with minimal complexity while maintaining all the benefits of the established system.
|
||||||
|
|
||||||
|
The key insight is that **version management is a solved problem** in Blue-Build - we just needed to apply it to Debian use cases rather than reinventing the wheel.
|
||||||
|
|
||||||
|
## Files Modified
|
||||||
|
|
||||||
|
- `process/drivers/traits.rs` - Removed Debian driver references
|
||||||
|
- `process/drivers/types/drivers.rs` - Removed Debian driver type
|
||||||
|
- `process/drivers.rs` - Removed Debian driver module
|
||||||
|
- `src/lib.rs` - Removed Debian driver from build engine mapping
|
||||||
|
- `examples/debian-server.yml` - Created example recipe
|
||||||
|
- `DEBIAN_INTEGRATION_APPROACH.md` - This documentation
|
||||||
|
|
||||||
|
## Files/Directories Removed
|
||||||
|
|
||||||
|
- `process/drivers/debian_driver.rs` - Custom Debian driver implementation
|
||||||
|
- `debian_blue_build/` - Legacy Python implementation (abandoned)
|
||||||
|
- `containerfiles/debian-setup/` - Empty directory from old approach
|
||||||
|
- `template/templates/modules/debian-packages/` - Custom Debian templates
|
||||||
|
- `template/templates/Containerfile-debian.j2` - Custom Debian Containerfile template
|
||||||
|
- `scripts/test-debian-driver.sh` - Test script for old approach
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
1. **Test with Real Debian Base Images**: Verify the approach works with actual Debian images
|
||||||
|
2. **Create Debian-Specific Templates**: Develop templates optimized for Debian workflows
|
||||||
|
3. **Add to Official Schema**: Integrate Debian modules into the official Blue-Build schema
|
||||||
|
4. **Documentation**: Update main README with Debian integration examples
|
||||||
38
README.md
38
README.md
|
|
@ -27,11 +27,14 @@ Debian Blue-Build CLI provides a command-line interface for building Debian atom
|
||||||
git clone <repository-url>
|
git clone <repository-url>
|
||||||
cd blue-build-cli
|
cd blue-build-cli
|
||||||
|
|
||||||
# Install dependencies
|
# Install Rust (if not already installed)
|
||||||
pip install -r requirements.txt
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
|
|
||||||
|
# Build the CLI
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
# Install the CLI
|
# Install the CLI
|
||||||
pip install -e .
|
cargo install --path .
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
@ -50,8 +53,8 @@ packages:
|
||||||
- postgresql
|
- postgresql
|
||||||
|
|
||||||
repositories:
|
repositories:
|
||||||
- deb http://deb.debian.org/debian bookworm main
|
- deb http://deb.debian.org/debian trixie main
|
||||||
- deb http://deb.debian.org/debian-security bookworm-security main
|
- deb http://deb.debian.org/debian-security trixie-security main
|
||||||
|
|
||||||
customizations:
|
customizations:
|
||||||
user:
|
user:
|
||||||
|
|
@ -83,17 +86,28 @@ debian-blue-build build recipe.yml --arch amd64
|
||||||
|
|
||||||
## Development Status
|
## Development Status
|
||||||
|
|
||||||
- **Core CLI**: In development
|
- **Core CLI**: ✅ Implemented (Rust-based)
|
||||||
- **Debian Integration**: Planning phase
|
- **Debian Integration**: 🚧 In Progress
|
||||||
- **Recipe System**: Basic structure
|
- **Recipe System**: ✅ Basic structure
|
||||||
- **Testing**: Not started
|
- **Debian Driver**: 🚧 Implemented (basic)
|
||||||
|
- **Debian Modules**: 🚧 Implemented (debian-packages)
|
||||||
|
- **Testing**: 🚧 Basic structure
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
- Python 3.8+
|
- Rust 1.70+
|
||||||
- OSTree tools
|
- OSTree tools
|
||||||
- Debian build tools
|
- Debian build tools (debootstrap, apt-get, dpkg)
|
||||||
- Container tools (Docker/Podman)
|
- Container tools (Docker/Podman/Buildah)
|
||||||
|
|
||||||
|
## Supported Debian Versions
|
||||||
|
|
||||||
|
This project supports the following Debian releases:
|
||||||
|
- **Debian 13 (Trixie)**: Current stable release (recommended)
|
||||||
|
- **Debian 14 (Forky)**: Testing release
|
||||||
|
- **Debian Sid**: Unstable/rolling release
|
||||||
|
|
||||||
|
**Note**: Debian 12 (Bookworm) is no longer supported as it has moved to oldstable.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
"""
|
|
||||||
Debian Blue-Build CLI
|
|
||||||
|
|
||||||
A fork of blue-build/cli adapted for Debian package management and atomic image building.
|
|
||||||
"""
|
|
||||||
|
|
||||||
__version__ = "0.1.0"
|
|
||||||
__author__ = "Debian Blue-Build Team"
|
|
||||||
__description__ = "Debian atomic image building CLI tool"
|
|
||||||
|
|
||||||
from .cli import main
|
|
||||||
from .recipe import Recipe
|
|
||||||
from .builder import ImageBuilder
|
|
||||||
from .package_manager import DebianPackageManager
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"main",
|
|
||||||
"Recipe",
|
|
||||||
"ImageBuilder",
|
|
||||||
"DebianPackageManager"
|
|
||||||
]
|
|
||||||
|
|
@ -1,124 +0,0 @@
|
||||||
"""
|
|
||||||
Debian package manager for Blue-Build CLI
|
|
||||||
|
|
||||||
Handles APT-based package management and repository configuration.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
from typing import List, Dict, Any, Optional
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
class DebianPackageManager:
|
|
||||||
"""Debian package management using APT"""
|
|
||||||
|
|
||||||
def __init__(self, work_dir: Optional[Path] = None):
|
|
||||||
self.work_dir = work_dir or Path.cwd()
|
|
||||||
self.repositories = []
|
|
||||||
self.packages = []
|
|
||||||
|
|
||||||
def add_repository(self, repo_line: str) -> bool:
|
|
||||||
"""Add Debian repository"""
|
|
||||||
try:
|
|
||||||
# Parse repository line (deb http://deb.debian.org/debian bookworm main)
|
|
||||||
parts = repo_line.split()
|
|
||||||
if len(parts) >= 4 and parts[0] == "deb":
|
|
||||||
self.repositories.append(repo_line)
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
except Exception:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def add_package(self, package_name: str) -> bool:
|
|
||||||
"""Add package to install list"""
|
|
||||||
if package_name and package_name not in self.packages:
|
|
||||||
self.packages.append(package_name)
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def resolve_dependencies(self, package_name: str) -> List[str]:
|
|
||||||
"""Resolve package dependencies"""
|
|
||||||
try:
|
|
||||||
result = subprocess.run(
|
|
||||||
["apt-cache", "depends", package_name],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
cwd=self.work_dir
|
|
||||||
)
|
|
||||||
|
|
||||||
if result.returncode == 0:
|
|
||||||
dependencies = []
|
|
||||||
for line in result.stdout.split('\n'):
|
|
||||||
if line.strip().startswith('Depends:'):
|
|
||||||
deps = line.replace('Depends:', '').strip()
|
|
||||||
dependencies.extend([d.strip() for d in deps.split(',')])
|
|
||||||
return dependencies
|
|
||||||
return []
|
|
||||||
except Exception:
|
|
||||||
return []
|
|
||||||
|
|
||||||
def create_sources_list(self, output_path: Path) -> bool:
|
|
||||||
"""Create sources.list file"""
|
|
||||||
try:
|
|
||||||
with open(output_path, 'w') as f:
|
|
||||||
for repo in self.repositories:
|
|
||||||
f.write(f"{repo}\n")
|
|
||||||
return True
|
|
||||||
except Exception:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def generate_apt_commands(self) -> List[str]:
|
|
||||||
"""Generate APT commands for package installation"""
|
|
||||||
commands = [
|
|
||||||
"apt-get update",
|
|
||||||
f"apt-get install -y {' '.join(self.packages)}",
|
|
||||||
"apt-get clean",
|
|
||||||
"rm -rf /var/lib/apt/lists/*"
|
|
||||||
]
|
|
||||||
return commands
|
|
||||||
|
|
||||||
def validate_packages(self) -> Dict[str, List[str]]:
|
|
||||||
"""Validate package availability"""
|
|
||||||
results = {
|
|
||||||
"available": [],
|
|
||||||
"unavailable": [],
|
|
||||||
"dependencies": []
|
|
||||||
}
|
|
||||||
|
|
||||||
for package in self.packages:
|
|
||||||
try:
|
|
||||||
result = subprocess.run(
|
|
||||||
["apt-cache", "show", package],
|
|
||||||
capture_output=True,
|
|
||||||
text=True,
|
|
||||||
cwd=self.work_dir
|
|
||||||
)
|
|
||||||
|
|
||||||
if result.returncode == 0:
|
|
||||||
results["available"].append(package)
|
|
||||||
deps = self.resolve_dependencies(package)
|
|
||||||
results["dependencies"].extend(deps)
|
|
||||||
else:
|
|
||||||
results["unavailable"].append(package)
|
|
||||||
except Exception:
|
|
||||||
results["unavailable"].append(package)
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
def create_package_script(self, output_path: Path) -> bool:
|
|
||||||
"""Create package installation script"""
|
|
||||||
try:
|
|
||||||
with open(output_path, 'w') as f:
|
|
||||||
f.write("#!/bin/bash\n")
|
|
||||||
f.write("set -e\n\n")
|
|
||||||
f.write("# Package installation script\n")
|
|
||||||
f.write("# Generated by Debian Blue-Build CLI\n\n")
|
|
||||||
|
|
||||||
for cmd in self.generate_apt_commands():
|
|
||||||
f.write(f"{cmd}\n")
|
|
||||||
|
|
||||||
# Make executable
|
|
||||||
output_path.chmod(0o755)
|
|
||||||
return True
|
|
||||||
except Exception:
|
|
||||||
return False
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
||||||
"""
|
|
||||||
Recipe system for Debian Blue-Build CLI
|
|
||||||
|
|
||||||
Handles YAML recipe parsing and validation for Debian atomic image building.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import yaml
|
|
||||||
from typing import Dict, List, Any, Optional
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class DebianRecipe:
|
|
||||||
"""Debian recipe configuration"""
|
|
||||||
name: str
|
|
||||||
version: str
|
|
||||||
description: str
|
|
||||||
packages: List[str]
|
|
||||||
repositories: List[str]
|
|
||||||
customizations: Dict[str, Any]
|
|
||||||
output_format: str = "container"
|
|
||||||
architecture: str = "amd64"
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_yaml(cls, yaml_content: str) -> "DebianRecipe":
|
|
||||||
"""Create recipe from YAML content"""
|
|
||||||
data = yaml.safe_load(yaml_content)
|
|
||||||
return cls(
|
|
||||||
name=data.get("name", ""),
|
|
||||||
version=data.get("version", "1.0.0"),
|
|
||||||
description=data.get("description", ""),
|
|
||||||
packages=data.get("packages", []),
|
|
||||||
repositories=data.get("repositories", []),
|
|
||||||
customizations=data.get("customizations", {}),
|
|
||||||
output_format=data.get("output_format", "container"),
|
|
||||||
architecture=data.get("architecture", "amd64")
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_file(cls, file_path: Path) -> "DebianRecipe":
|
|
||||||
"""Create recipe from YAML file"""
|
|
||||||
with open(file_path, 'r') as f:
|
|
||||||
content = f.read()
|
|
||||||
return cls.from_yaml(content)
|
|
||||||
|
|
||||||
def validate(self) -> List[str]:
|
|
||||||
"""Validate recipe configuration"""
|
|
||||||
errors = []
|
|
||||||
|
|
||||||
if not self.name:
|
|
||||||
errors.append("Recipe name is required")
|
|
||||||
|
|
||||||
if not self.packages:
|
|
||||||
errors.append("At least one package is required")
|
|
||||||
|
|
||||||
if not self.repositories:
|
|
||||||
errors.append("At least one repository is required")
|
|
||||||
|
|
||||||
return errors
|
|
||||||
|
|
||||||
def to_dict(self) -> Dict[str, Any]:
|
|
||||||
"""Convert recipe to dictionary"""
|
|
||||||
return {
|
|
||||||
"name": self.name,
|
|
||||||
"version": self.version,
|
|
||||||
"description": self.description,
|
|
||||||
"packages": self.packages,
|
|
||||||
"repositories": self.repositories,
|
|
||||||
"customizations": self.customizations,
|
|
||||||
"output_format": self.output_format,
|
|
||||||
"architecture": self.architecture
|
|
||||||
}
|
|
||||||
|
|
||||||
class RecipeParser:
|
|
||||||
"""Recipe parser and validator"""
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def parse(file_path: str) -> DebianRecipe:
|
|
||||||
"""Parse recipe from file"""
|
|
||||||
path = Path(file_path)
|
|
||||||
if not path.exists():
|
|
||||||
raise FileNotFoundError(f"Recipe file not found: {file_path}")
|
|
||||||
|
|
||||||
recipe = DebianRecipe.from_file(path)
|
|
||||||
errors = recipe.validate()
|
|
||||||
|
|
||||||
if errors:
|
|
||||||
raise ValueError(f"Recipe validation failed: {', '.join(errors)}")
|
|
||||||
|
|
||||||
return recipe
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def validate_schema(recipe_data: Dict[str, Any]) -> List[str]:
|
|
||||||
"""Validate recipe schema"""
|
|
||||||
errors = []
|
|
||||||
required_fields = ["name", "packages", "repositories"]
|
|
||||||
|
|
||||||
for field in required_fields:
|
|
||||||
if field not in recipe_data:
|
|
||||||
errors.append(f"Missing required field: {field}")
|
|
||||||
|
|
||||||
return errors
|
|
||||||
34
examples/debian-server.yml
Normal file
34
examples/debian-server.yml
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
|
||||||
|
# Debian Server Recipe (using Fedora base with Debian package management)
|
||||||
|
# Supports Debian 13 (Trixie), 14 (Forky), and Sid
|
||||||
|
# Debian 12 (Bookworm) is no longer supported
|
||||||
|
# This demonstrates how to use the existing Fedora infrastructure for Debian-style builds
|
||||||
|
name: debian-server
|
||||||
|
description: Debian server image with common server packages
|
||||||
|
base-image: ghcr.io/ublue-os/silverblue-main
|
||||||
|
image-version: latest
|
||||||
|
|
||||||
|
# Modules to apply to the final image
|
||||||
|
modules:
|
||||||
|
- type: script
|
||||||
|
snippets:
|
||||||
|
- echo "Building Debian-style server on Fedora infrastructure"
|
||||||
|
- echo "OS Version detected from base image"
|
||||||
|
- echo "This demonstrates how the os_version template variable works"
|
||||||
|
- echo "In a real implementation, this would use the os_version for Debian-specific logic"
|
||||||
|
|
||||||
|
- type: files
|
||||||
|
files:
|
||||||
|
- source: files/
|
||||||
|
destination: /tmp/files/
|
||||||
|
|
||||||
|
- type: script
|
||||||
|
scripts:
|
||||||
|
- scripts/setup-ssh.sh
|
||||||
|
- scripts/configure-services.sh
|
||||||
|
env:
|
||||||
|
SSH_PORT: "2222"
|
||||||
|
SSH_USER: "admin"
|
||||||
|
NGINX_PORT: "80"
|
||||||
|
POSTGRES_PORT: "5432"
|
||||||
|
|
@ -38,9 +38,9 @@ use uuid::Uuid;
|
||||||
use crate::logging::Logger;
|
use crate::logging::Logger;
|
||||||
|
|
||||||
pub use self::{
|
pub use self::{
|
||||||
buildah_driver::BuildahDriver, cosign_driver::CosignDriver, docker_driver::DockerDriver,
|
buildah_driver::BuildahDriver, cosign_driver::CosignDriver,
|
||||||
github_driver::GithubDriver, gitlab_driver::GitlabDriver, local_driver::LocalDriver,
|
docker_driver::DockerDriver, github_driver::GithubDriver, gitlab_driver::GitlabDriver,
|
||||||
podman_driver::PodmanDriver, rpm_ostree_driver::RpmOstreeDriver,
|
local_driver::LocalDriver, podman_driver::PodmanDriver, rpm_ostree_driver::RpmOstreeDriver,
|
||||||
sigstore_driver::SigstoreDriver, skopeo_driver::SkopeoDriver, traits::*,
|
sigstore_driver::SigstoreDriver, skopeo_driver::SkopeoDriver, traits::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -51,6 +51,7 @@ pub use bootc_driver::BootcDriver;
|
||||||
mod bootc_driver;
|
mod bootc_driver;
|
||||||
mod buildah_driver;
|
mod buildah_driver;
|
||||||
mod cosign_driver;
|
mod cosign_driver;
|
||||||
|
|
||||||
mod docker_driver;
|
mod docker_driver;
|
||||||
mod functions;
|
mod functions;
|
||||||
mod github_driver;
|
mod github_driver;
|
||||||
|
|
@ -325,8 +326,9 @@ macro_rules! impl_build_driver {
|
||||||
($func:ident($($args:expr),*)) => {
|
($func:ident($($args:expr),*)) => {
|
||||||
match Self::get_build_driver() {
|
match Self::get_build_driver() {
|
||||||
BuildDriverType::Buildah => BuildahDriver::$func($($args,)*),
|
BuildDriverType::Buildah => BuildahDriver::$func($($args,)*),
|
||||||
BuildDriverType::Podman => PodmanDriver::$func($($args,)*),
|
|
||||||
BuildDriverType::Docker => DockerDriver::$func($($args,)*),
|
BuildDriverType::Docker => DockerDriver::$func($($args,)*),
|
||||||
|
BuildDriverType::Podman => PodmanDriver::$func($($args,)*),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ macro_rules! impl_private_driver {
|
||||||
|
|
||||||
impl_private_driver!(
|
impl_private_driver!(
|
||||||
super::Driver,
|
super::Driver,
|
||||||
|
|
||||||
super::docker_driver::DockerDriver,
|
super::docker_driver::DockerDriver,
|
||||||
super::podman_driver::PodmanDriver,
|
super::podman_driver::PodmanDriver,
|
||||||
super::buildah_driver::BuildahDriver,
|
super::buildah_driver::BuildahDriver,
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ use clap::ValueEnum;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
|
||||||
use crate::drivers::{
|
use crate::drivers::{
|
||||||
DetermineDriver, DriverVersion, buildah_driver::BuildahDriver, docker_driver::DockerDriver,
|
DetermineDriver, DriverVersion, buildah_driver::BuildahDriver,
|
||||||
podman_driver::PodmanDriver,
|
docker_driver::DockerDriver, podman_driver::PodmanDriver,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, ValueEnum)]
|
#[derive(Debug, Clone, Copy, ValueEnum)]
|
||||||
|
|
@ -41,8 +41,8 @@ impl DetermineDriver<InspectDriverType> for Option<InspectDriverType> {
|
||||||
#[derive(Debug, Clone, Copy, ValueEnum)]
|
#[derive(Debug, Clone, Copy, ValueEnum)]
|
||||||
pub enum BuildDriverType {
|
pub enum BuildDriverType {
|
||||||
Buildah,
|
Buildah,
|
||||||
Podman,
|
|
||||||
Docker,
|
Docker,
|
||||||
|
Podman,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DetermineDriver<BuildDriverType> for Option<BuildDriverType> {
|
impl DetermineDriver<BuildDriverType> for Option<BuildDriverType> {
|
||||||
|
|
@ -52,6 +52,7 @@ impl DetermineDriver<BuildDriverType> for Option<BuildDriverType> {
|
||||||
blue_build_utils::check_command_exists("docker"),
|
blue_build_utils::check_command_exists("docker"),
|
||||||
blue_build_utils::check_command_exists("podman"),
|
blue_build_utils::check_command_exists("podman"),
|
||||||
blue_build_utils::check_command_exists("buildah"),
|
blue_build_utils::check_command_exists("buildah"),
|
||||||
|
|
||||||
) {
|
) {
|
||||||
(Ok(_docker), _, _)
|
(Ok(_docker), _, _)
|
||||||
if DockerDriver::is_supported_version() && DockerDriver::has_buildx() =>
|
if DockerDriver::is_supported_version() && DockerDriver::has_buildx() =>
|
||||||
|
|
@ -64,6 +65,7 @@ impl DetermineDriver<BuildDriverType> for Option<BuildDriverType> {
|
||||||
(_, _, Ok(_buildah)) if BuildahDriver::is_supported_version() => {
|
(_, _, Ok(_buildah)) if BuildahDriver::is_supported_version() => {
|
||||||
BuildDriverType::Buildah
|
BuildDriverType::Buildah
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => panic!(
|
_ => panic!(
|
||||||
"{}{}{}{}",
|
"{}{}{}{}",
|
||||||
"Could not determine strategy, ",
|
"Could not determine strategy, ",
|
||||||
|
|
@ -76,6 +78,7 @@ impl DetermineDriver<BuildDriverType> for Option<BuildDriverType> {
|
||||||
"or buildah version {} to continue",
|
"or buildah version {} to continue",
|
||||||
BuildahDriver::VERSION_REQ,
|
BuildahDriver::VERSION_REQ,
|
||||||
),
|
),
|
||||||
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue