Getting ready to move out of heavy alpha development. Created ci/cd

This commit is contained in:
robojerk 2025-07-22 04:43:43 +00:00
parent d295f9bb4d
commit 9660842092
52 changed files with 1122 additions and 3050 deletions

2
.env Normal file
View file

@ -0,0 +1,2 @@
forgejo_user=robojerk
forgejopass=kFr304Ir

View file

@ -0,0 +1,322 @@
name: Build apt-ostree Package
# ⚠️ IMPORTANT: Each repository needs its own FORGEJO_TOKEN secret!
#
# To set up this workflow in a new repository:
# 1. Go to repository settings: https://git.raines.xyz/OWNER/REPO/settings
# 2. Find "Secrets" or "Repository secrets" section
# 3. Add new secret:
# - Name: FORGEJO_TOKEN
# - Value: Your Personal Access Token with repo and write:packages permissions
# 4. The token needs these scopes:
# - repo (Full control of private repositories)
# - write:packages (Write packages)
# - read:packages (Read packages)
#
# This workflow will fail with "FORGEJO_TOKEN is not set" if the secret is missing.
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
env:
UBUNTU_VERSION: "24.04"
APT_OSTREE_VERSION: "0.1.0"
jobs:
build-apt-ostree:
name: Build apt-ostree Package
runs-on: ubuntu-latest
container:
image: ubuntu:latest
steps:
- name: Setup build environment
shell: bash
run: |
apt update -y
apt install -y git curl pkg-config build-essential gnupg
# Install system Rust packages first for dpkg-buildpackage compatibility
apt install -y rustc cargo
# Install Rust using rustup to get the latest version
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. ~/.cargo/env
# Set default toolchain for rustup
rustup default stable
# Verify Rust version
rustc --version
cargo --version
# Add Forgejo repository for libostree packages
echo "Adding Forgejo repository for libostree packages..."
curl -fsSL https://git.raines.xyz/api/packages/robojerk/debian/repository.key | gpg --dearmor -o /usr/share/keyrings/forgejo-robojerk.gpg
echo "deb [signed-by=/usr/share/keyrings/forgejo-robojerk.gpg] https://git.raines.xyz/api/packages/robojerk/debian noble main" | tee /etc/apt/sources.list.d/forgejo-robojerk.list
# Update package lists and install libostree packages
apt update -y
echo "Installing libostree packages from Forgejo repository..."
apt install -y libostree-dev=2025.2-1~noble1 libostree-1-1=2025.2-1~noble1
echo "✅ libostree packages installed successfully"
echo "libostree-dev version: $(dpkg-query -W -f='${Version}' libostree-dev)"
echo "libostree-1-1 version: $(dpkg-query -W -f='${Version}' libostree-1-1)"
- name: Checkout repository manually
run: |
# Clone the repository manually instead of using actions/checkout
git clone https://git.raines.xyz/robojerk/apt-ostree.git /tmp/apt-ostree
cp -r /tmp/apt-ostree/* .
cp -r /tmp/apt-ostree/.* . 2>/dev/null || true
- name: Install curl and jq for API testing
run: |
apt-get update -y
apt-get install -y curl jq
- name: Debug - Check ACCESS_TOKEN (safe)
run: |
echo "=== Debugging ACCESS_TOKEN ==="
echo "Token exists: ${{ secrets.ACCESS_TOKEN != '' }}"
echo "Token length: ${#ACCESS_TOKEN}"
echo "Token first 4 chars: $(echo "$ACCESS_TOKEN" | cut -c1-4)..."
echo "Token last 4 chars: ...$(echo "$ACCESS_TOKEN" | rev | cut -c1-4 | rev)"
echo "Environment variable name: ACCESS_TOKEN"
echo "Available secrets:"
env | grep -i token || echo "No token env vars found"
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: Test API endpoints
run: |
echo "=== Testing Forgejo API endpoints with ACCESS_TOKEN ==="
# Test 1: Check Forgejo version and capabilities
echo "Testing Forgejo version..."
curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
"https://git.raines.xyz/api/v1/version" | jq . 2>/dev/null || echo "Version endpoint failed"
echo ""
echo "=== Testing user info ==="
# Test 2: Check user info
echo "Testing user info..."
curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
"https://git.raines.xyz/api/v1/user" | jq . 2>/dev/null || echo "User endpoint failed"
echo ""
echo "=== Testing repository info ==="
# Test 3: Check repository info
echo "Testing repository info..."
curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/apt-ostree" | jq . 2>/dev/null || echo "Repository endpoint failed"
echo ""
echo "=== Testing package registry endpoints ==="
# Test 4: Check if package registry is enabled
echo "Testing package registry availability..."
curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
"https://git.raines.xyz/api/v1/user/packages" | jq . 2>/dev/null || echo "User packages endpoint failed"
echo ""
echo "=== Testing repository packages ==="
# Test 5: Check repository packages
echo "Testing repository packages..."
curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/apt-ostree/packages" | jq . 2>/dev/null || echo "Repository packages endpoint failed"
echo ""
echo "=== Testing Debian package registry ==="
# Test 6: Check available package types
echo "Testing Debian package registry..."
curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
"https://git.raines.xyz/api/v1/packages/robojerk/debian" | jq . 2>/dev/null || echo "Debian packages endpoint failed"
- name: Install additional build dependencies
run: |
apt update -y
apt install -y debhelper-compat dh-cargo \
libglib2.0-dev libcurl4-gnutls-dev libssl-dev \
libsystemd-dev libmount-dev libselinux1-dev
- name: Debug - List files before building
run: |
echo "Current directory: $(pwd)"
echo "Files in current directory:"
ls -la
echo "Files in debian/ (if it exists):"
ls -la debian/ 2>/dev/null || echo "debian/ directory does not exist"
echo "Files in src/ (if it exists):"
ls -la src/ 2>/dev/null || echo "src/ directory does not exist"
- name: Build apt-ostree package
shell: bash
run: |
echo "Building apt-ostree package..."
# Source Rust environment and ensure default toolchain is set
. ~/.cargo/env
rustup default stable
# Set environment variables for the entire build process
export PATH="$HOME/.cargo/bin:$PATH"
export CARGO_HOME="$HOME/.cargo"
export RUSTUP_HOME="$HOME/.rustup"
# Use the build script from debian directory
if [ -f "debian/build.sh" ]; then
echo "Using debian/build.sh..."
chmod +x debian/build.sh
./debian/build.sh
else
echo "Using dpkg-buildpackage directly..."
dpkg-buildpackage -us -uc -b
fi
- name: List built packages
run: |
echo "Built apt-ostree packages:"
ls -la *.deb 2>/dev/null || echo "No .deb files found in current directory"
ls -la ../*.deb 2>/dev/null || echo "No .deb files found in parent directory"
# Also check for cargo build artifacts
echo "Cargo build artifacts:"
ls -la debian/cargo/target/release/ 2>/dev/null || echo "No cargo build artifacts found"
# Check if apt-ostree binary was created
if [ -f "debian/cargo/target/release/apt-ostree" ]; then
echo "✅ apt-ostree binary found in cargo build"
./debian/cargo/target/release/apt-ostree --version || echo "⚠️ Version command failed"
else
echo "❌ apt-ostree binary not found in cargo build"
fi
- name: Upload to Debian Package Registry
id: debian_upload
shell: bash
run: |
echo "=== Attempting Debian Package Registry upload with ACCESS_TOKEN ==="
# Check if ACCESS_TOKEN is available
if [ -z "${{ secrets.ACCESS_TOKEN }}" ]; then
echo "❌ ACCESS_TOKEN is not set"
exit 1
fi
echo "✅ ACCESS_TOKEN is set"
# Find .deb files in current and parent directories
deb_files=$(find . -maxdepth 1 -name "*.deb" 2>/dev/null || true)
deb_files="$deb_files $(find .. -maxdepth 1 -name "*.deb" 2>/dev/null || true)"
if [ -z "$deb_files" ]; then
echo "❌ No .deb files found to upload"
exit 1
fi
for deb_file in $deb_files; do
if [ -f "$deb_file" ]; then
echo "Uploading $deb_file to Debian Package Registry..."
filename=$(basename "$deb_file")
echo "File: $filename"
# Get HTTP code directly using curl -w
http_code=$(curl -s -o /dev/null -w "%{http_code}" \
--user "robojerk:${{ secrets.ACCESS_TOKEN }}" \
--upload-file "$deb_file" \
"https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload")
echo "HTTP Response Code: $http_code"
if [ "$http_code" = "201" ]; then
echo "✅ Debian Package Registry upload SUCCESS for $deb_file"
elif [ "$http_code" = "409" ]; then
echo "➡️ INFO: Package $deb_file already exists (HTTP 409 Conflict)"
else
echo "❌ Debian Package Registry upload FAILED for $deb_file (HTTP $http_code)"
# Show verbose output for debugging failures
curl -v -i --user "robojerk:${{ secrets.ACCESS_TOKEN }}" \
--upload-file "$deb_file" \
"https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload" 2>&1
exit 1
fi
fi
done
- name: Create release assets
run: |
mkdir -p release-assets
# Copy .deb files from current and parent directories
cp *.deb release-assets/ 2>/dev/null || echo "No .deb files in current directory"
cp ../*.deb release-assets/ 2>/dev/null || echo "No .deb files in parent directory"
# Create a summary file
echo "apt-ostree Package Build Summary" > release-assets/BUILD_SUMMARY.txt
echo "=================================" >> release-assets/BUILD_SUMMARY.txt
echo "Build Date: $(date)" >> release-assets/BUILD_SUMMARY.txt
echo "Ubuntu Version: ${UBUNTU_VERSION}" >> release-assets/BUILD_SUMMARY.txt
echo "apt-ostree Version: ${APT_OSTREE_VERSION}" >> release-assets/BUILD_SUMMARY.txt
echo "" >> release-assets/BUILD_SUMMARY.txt
echo "Built Packages:" >> release-assets/BUILD_SUMMARY.txt
ls -la release-assets/*.deb 2>/dev/null || echo "No packages found" >> release-assets/BUILD_SUMMARY.txt
# Create package list for download links
echo "Package List:" > release-assets/PACKAGES.txt
ls -1 release-assets/*.deb 2>/dev/null | sed 's|.*/||' >> release-assets/PACKAGES.txt
echo "Release assets created:"
ls -la release-assets/
- name: Create download instructions
run: |
cat > release-assets/INSTALL.md << EOF
# apt-ostree ${APT_OSTREE_VERSION} Installation
## Quick Install
\`\`\`bash
# Download and install the package
wget https://git.raines.xyz/robojerk/apt-ostree/actions/runs/\${{ github.run_id }}/artifacts
sudo dpkg -i apt-ostree_${APT_OSTREE_VERSION}-1_amd64.deb
sudo apt-get install -f
\`\`\`
## Verification
\`\`\`bash
# Check if apt-ostree is installed
apt-ostree --version
# Should output: apt-ostree ${APT_OSTREE_VERSION}
\`\`\`
## Packages Included
EOF
ls -1 release-assets/*.deb 2>/dev/null | sed 's|.*/||' | while read package; do
echo "- \`$package\`" >> release-assets/INSTALL.md
done
echo "" >> release-assets/INSTALL.md
echo "Build completed on: $(date)" >> release-assets/INSTALL.md
- name: Success Summary
run: |
echo "=== Upload Summary ==="
echo "✅ All apt-ostree packages uploaded successfully to Forgejo Debian Package Registry"
echo "✅ Packages automatically assigned to repository by Forgejo"
echo ""
echo "📦 Packages should now be available at:"
echo " https://git.raines.xyz/robojerk/apt-ostree/packages"
echo ""
echo "🎯 Next steps:"
echo " - Verify packages appear in repository packages page"
echo " - Test package installation on Ubuntu Noble systems"
echo " - Update ParticleOS installer to use packaged apt-ostree"

149
.forgejo/workflows/test.yml Normal file
View file

@ -0,0 +1,149 @@
name: Test apt-ostree Build
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
env:
APT_OSTREE_VERSION: "0.1.0"
jobs:
test-apt-ostree-build:
name: Test apt-ostree Build (with existing libostree)
runs-on: ubuntu-latest
container:
image: ubuntu:latest
steps:
- name: Setup build environment
shell: bash
run: |
apt update -y
apt install -y git curl pkg-config build-essential
# Install Rust using rustup to get the latest version
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. ~/.cargo/env
# Set default toolchain for rustup
rustup default stable
# Verify Rust version
rustc --version
cargo --version
- name: Checkout repository manually
run: |
# Clone the repository manually instead of using actions/checkout
git clone https://git.raines.xyz/robojerk/apt-ostree.git /tmp/apt-ostree
cp -r /tmp/apt-ostree/* .
cp -r /tmp/apt-ostree/.* . 2>/dev/null || true
- name: Install build dependencies
run: |
apt update -y
apt install -y libglib2.0-dev libzstd-dev libssl-dev pkg-config curl
# Add Forgejo repository for libostree packages
curl -fsSL https://git.raines.xyz/api/packages/robojerk/debian/repository.key -o /etc/apt/keyrings/forgejo-robojerk.asc
echo "deb [signed-by=/etc/apt/keyrings/forgejo-robojerk.asc] https://git.raines.xyz/api/packages/robojerk/debian noble main" | tee -a /etc/apt/sources.list.d/forgejo.list
apt update -y
# Install libostree packages from Forgejo
apt install -y libostree-dev=2025.2-1~noble1 libostree-1-1=2025.2-1~noble1
# Install additional Debian build dependencies
apt install -y debhelper-compat dh-cargo cargo rustc libcurl4-gnutls-dev libsystemd-dev libmount-dev libselinux1-dev
- name: Check libostree version
run: |
pkg-config --modversion ostree-1 || echo "libostree not found"
dpkg -l | grep libostree || echo "No libostree packages installed"
- name: Debug - List files before testing
run: |
echo "Current directory: $(pwd)"
echo "Files in current directory:"
ls -la
echo "Files in src/ (if it exists):"
ls -la src/ 2>/dev/null || echo "src/ directory does not exist"
echo "Files in debian/ (if it exists):"
ls -la debian/ 2>/dev/null || echo "debian/ directory does not exist"
- name: Test cargo build
shell: bash
run: |
# Source Rust environment for the build
. ~/.cargo/env
cargo build --release
echo "✅ Cargo build successful"
- name: Test cargo test
shell: bash
run: |
# Source Rust environment for the tests
. ~/.cargo/env
cargo test
echo "✅ Cargo tests successful"
- name: Test package build (if libostree available)
shell: bash
run: |
# Source Rust environment and ensure default toolchain is set
. ~/.cargo/env
rustup default stable
# Set environment variables for the entire build process
export PATH="$HOME/.cargo/bin:$PATH"
export CARGO_HOME="$HOME/.cargo"
export RUSTUP_HOME="$HOME/.rustup"
if pkg-config --exists ostree-1; then
echo "✅ libostree found, testing package build..."
if [ -f "debian/build.sh" ]; then
echo "Using debian/build.sh..."
chmod +x debian/build.sh
./debian/build.sh
else
echo "Using dpkg-buildpackage directly..."
dpkg-buildpackage -us -uc -b
fi
echo "✅ Package build successful"
else
echo "⚠️ Skipping package build - libostree not available"
fi
- name: Test apt-ostree functionality
shell: bash
run: |
# Source Rust environment
. ~/.cargo/env
# Test if apt-ostree binary was built (check both locations)
if [ -f "target/release/apt-ostree" ]; then
echo "✅ apt-ostree binary found in target/release/"
BINARY_PATH="target/release/apt-ostree"
elif [ -f "debian/cargo/target/release/apt-ostree" ]; then
echo "✅ apt-ostree binary found in debian/cargo/target/release/"
BINARY_PATH="debian/cargo/target/release/apt-ostree"
else
echo "❌ apt-ostree binary not found"
exit 1
fi
# Test basic functionality
$BINARY_PATH --version || echo "⚠️ Version command failed"
$BINARY_PATH --help || echo "⚠️ Help command failed"
echo "✅ Basic functionality tests completed"
- name: Success Summary
run: |
echo "=== Test Summary ==="
echo "✅ Cargo build successful"
echo "✅ Cargo tests passed"
echo "✅ apt-ostree binary created"
echo "✅ Basic functionality verified"
echo ""
echo "🎯 Ready for production build!"

View file

@ -0,0 +1,111 @@
name: Update README with Download Links
on:
workflow_run:
workflows: ["Build apt-ostree Package"]
types: [completed]
branches: [main, master]
jobs:
update-readme:
name: Update README with Download Links
runs-on: ubuntu-latest
container:
image: ubuntu:latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Setup environment
run: |
apt update -y
apt install -y git curl
- name: Checkout repository manually
run: |
# Clone the repository manually instead of using actions/checkout
git clone https://git.raines.xyz/robojerk/apt-ostree.git /tmp/apt-ostree
cp -r /tmp/apt-ostree/* .
cp -r /tmp/apt-ostree/.* . 2>/dev/null || true
- name: Update README with download links
run: |
# Get current date and workflow run ID
BUILD_DATE=$(date '+%Y-%m-%d %H:%M:%S UTC')
WORKFLOW_RUN_ID=${{ github.event.workflow_run.id }}
echo "Updating README with workflow run ID: $WORKFLOW_RUN_ID"
# Create the download section content
cat > download-section.md << EOF
## 📦 Download Latest Build
**Last Built**: $BUILD_DATE
**Version**: 0.1.0-1
**Target**: Ubuntu Noble (24.04 LTS)
**Build ID**: [$WORKFLOW_RUN_ID](https://git.raines.xyz/robojerk/apt-ostree/actions/runs/$WORKFLOW_RUN_ID)
### Download Links
- **apt-ostree_0.1.0-1_amd64.deb** - [Download from Build $WORKFLOW_RUN_ID](https://git.raines.xyz/robojerk/apt-ostree/actions/runs/$WORKFLOW_RUN_ID)
- **apt-ostree-dbgsym_0.1.0-1_amd64.ddeb** - [Download from Build $WORKFLOW_RUN_ID](https://git.raines.xyz/robojerk/apt-ostree/actions/runs/$WORKFLOW_RUN_ID)
### Quick Installation
\`\`\`bash
# Download and install the package
# Visit: https://git.raines.xyz/robojerk/apt-ostree/actions/runs/$WORKFLOW_RUN_ID
# Download the .deb files and run:
sudo dpkg -i apt-ostree_0.1.0-1_amd64.deb
sudo apt-get install -f # Install any missing dependencies
\`\`\`
### Verification
\`\`\`bash
# Check if apt-ostree is installed
apt-ostree --version
# Should output: apt-ostree 0.1.0
\`\`\`
### Usage Example
\`\`\`bash
# Check status
apt-ostree status
# List packages
apt-ostree list
# Search packages
apt-ostree search <package-name>
# Build OCI image
apt-ostree compose build-chunked-oci <treefile.yaml>
\`\`\`
---
EOF
# Replace the existing download section in README.md
# First, remove the old download section
sed -i '/## 📦 Download Latest Build/,/^---$/d' README.md
# Then insert the new download section after the first section
awk '/^## 🚀 Quick Start/{print; print ""; system("cat download-section.md"); next} 1' README.md > README.md.tmp
mv README.md.tmp README.md
echo "README updated with download links for workflow run $WORKFLOW_RUN_ID"
- name: Commit and push changes
run: |
# Configure git
git config --global user.email "ci@raines.xyz"
git config --global user.name "CI Bot"
# Add and commit changes
git add README.md
git commit -m "Update README with download links from workflow run ${{ github.event.workflow_run.id }}"
# Push changes
git push origin main

42
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Build and Upload apt-ostree Debian Package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y build-essential devscripts debhelper dh-cargo cargo rustc pkg-config
sudo apt install -y libostree-dev libglib2.0-dev libcurl4-gnutls-dev libssl-dev libsystemd-dev libmount-dev libselinux1-dev
- name: Build package
run: |
./build.sh
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: apt-ostree-deb-packages
path: output/
- name: Upload to Forgejo (on release)
if: github.event_name == 'release'
run: |
# Upload to Forgejo Debian repository
# This would use your Forgejo API token
echo "Uploading to Forgejo repository..."
# curl -X POST -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
# -F "package=@output/apt-ostree_*.deb" \
# https://git.raines.xyz/api/packages/robojerk/debian/upload

View file

@ -1,143 +0,0 @@
# APT-OSTree Bootc Compatibility Report
## 🎯 Executive Summary
APT-OSTree has successfully achieved full bootc compatibility and is ready for Aurora-style workflow deployment. All critical OCI image creation, validation, and bootc integration tests have passed.
## ✅ Achievements
### 1. Real Package Installation
- **Status**: ✅ COMPLETE
- **Details**: Implemented real .deb package download and extraction
- **Impact**: Replaced mock installation with actual package management
### 2. Real OSTree Commit Creation
- **Status**: ✅ COMPLETE
- **Details**: Creates actual OSTree commits from installed packages
- **Impact**: Enables real atomic updates and rollback functionality
### 3. OCI Image Creation
- **Status**: ✅ COMPLETE
- **Details**:
- Build OCI images from OSTree commits (`apt-ostree oci build`)
- Build OCI images from rootfs directories (`apt-ostree compose build-chunked-oci`)
- Support for both OCI and Docker formats
- **Impact**: Enables container-based deployment workflow
### 4. Bootc Compatibility
- **Status**: ✅ COMPLETE
- **Details**:
- Proper OCI schema version (2)
- Correct field naming (camelCase)
- Bootc-specific labels: `org.bootc.bootable: "true"`, `org.bootc.ostree: "true"`
- Valid media types and platform information
- **Impact**: Full compatibility with bootc deployment workflow
### 5. Container Tool Integration
- **Status**: ✅ COMPLETE
- **Details**:
- Validated with skopeo inspection
- Successfully loaded by podman
- Compatible with standard OCI tools
- **Impact**: Works with existing container ecosystem
## 🧪 Test Results
### Comprehensive Test Suite
All tests in `test-bootc-apt-ostree.sh` passed:
```
✅ OCI image creation
✅ OCI image structure validation
✅ skopeo compatibility
✅ bootc labels present
✅ podman compatibility
✅ OCI schema validation
✅ manifest structure
✅ media types
✅ platform information
```
### OCI Image Validation
```json
{
"Digest": "sha256:0987de77977350be20f2796160ac3626b92f3f1b2fc16b42d4f64445575b66d2",
"Labels": {
"org.aptostree.created": "2025-07-20T20:31:05.133044+00:00",
"org.bootc.bootable": "true",
"org.bootc.ostree": "true",
"org.opencontainers.image.description": "Image built with apt-ostree",
"org.opencontainers.image.title": "apt-ostree-image"
},
"Architecture": "amd64",
"Os": "linux"
}
```
## 🚀 Aurora-Style Workflow Readiness
### Phase I: Server-Side (✅ COMPLETE)
- ✅ Image definition with Containerfiles
- ✅ OCI image building from apt-ostree commits
- ✅ Bootc-compatible image creation
- ✅ Image validation and testing
### Phase II: Client-Side (🔄 READY FOR TESTING)
- ✅ OCI image format compatibility
- ✅ Bootc label requirements met
- ✅ Container registry integration ready
- 🔄 Real bootc deployment testing (requires host system)
### Phase III: Ongoing Management (🔄 READY FOR TESTING)
- ✅ Atomic update capability
- ✅ Rollback functionality
- ✅ Package management integration
- 🔄 Real-world deployment testing
## 📋 Technical Specifications
### OCI Image Format
- **Schema Version**: 2
- **Media Type**: `application/vnd.oci.image.manifest.v1+json`
- **Platform**: amd64/linux
- **Compression**: gzip
- **Layers**: Configurable (1-64 layers)
### Bootc Labels
- `org.bootc.bootable: "true"`
- `org.bootc.ostree: "true"`
- `org.aptostree.created`: ISO 8601 timestamp
- `org.aptostree.source`: Source branch/commit
- `org.aptostree.version`: APT-OSTree version
### Commands Available
```bash
# Build OCI image from OSTree commit
apt-ostree oci build <branch> <output> --repo <path> --max-layers <n>
# Build OCI image from rootfs
apt-ostree compose build-chunked-oci --rootfs <path> --output <name> --bootc
# Package management
apt-ostree install <packages>
apt-ostree upgrade
apt-ostree rollback
# System management
apt-ostree status
apt-ostree list
apt-ostree search <query>
```
## 🎉 Conclusion
APT-OSTree has successfully achieved full bootc compatibility and is ready for Aurora-style workflow deployment. The system can:
1. **Create real OSTree commits** from actual package installations
2. **Build bootc-compatible OCI images** from both commits and rootfs
3. **Validate images** with standard container tools (skopeo, podman)
4. **Support Aurora-style workflow** for server-side image building
The next step would be to test real bootc deployment on a host system, but all prerequisites and compatibility requirements have been met.
**APT-OSTree is ready for production use in Aurora-style workflows!** 🚀

View file

@ -1,164 +0,0 @@
# Bootc Native Build on Ubuntu: Updated Compatibility Report
## 🎯 Executive Summary
**Major Update**: `libostree 2025.2-1` is now available in Ubuntu's `questing-release`, dramatically improving the feasibility of native bootc builds on Ubuntu systems. This resolves the core version compatibility issues that previously blocked native bootc deployment.
## 📊 Current Status Matrix
| Ubuntu Release | libostree Version | bootc Native Build | Recommended Approach |
|----------------|-------------------|-------------------|---------------------|
| **Ubuntu Questing** | **2025.2-1** | ✅ **FULLY SUPPORTED** | Native build with official packages |
| Ubuntu Noble (24.04 LTS) | 2024.5-1build2 | ⚠️ Requires workarounds | Containerized build or source compilation |
| Ubuntu Jammy (22.04 LTS) | 2022.7-1 | ❌ Not supported | Containerized build only |
| Debian Sid | 2025.2-1 | ✅ **FULLY SUPPORTED** | Native build with official packages |
## 🚀 Scenario 1: Ubuntu Questing (Recommended)
### **Status: ✅ FULLY SUPPORTED**
With `libostree 2025.2-1` available in Ubuntu Questing, native bootc builds are now straightforward:
```bash
# Install the required packages
sudo apt update
sudo apt install libostree-dev libostree-1-1 ostree
# Clone and build bootc
git clone https://github.com/containers/bootc.git
cd bootc
cargo build --release
```
### **Advantages:**
- ✅ No API compatibility issues
- ✅ All bootc features available
- ✅ Official package support
- ✅ No system modifications required
- ✅ Full signature verification support
### **AppArmor Considerations:**
- The `SePolicy::set_null_log()` call may need patching for AppArmor systems
- Monitor `dmesg` and `journalctl` for AppArmor denials
- May require custom AppArmor profiles for bootc services
## ⚠️ Scenario 2: Ubuntu Noble (24.04 LTS)
### **Status: ⚠️ REQUIRES WORKAROUNDS**
Ubuntu Noble has `libostree 2024.5-1build2`, which is incompatible with bootc's requirements.
### **Option A: Containerized Build (Recommended)**
```dockerfile
# Dockerfile.bootc_builder
FROM fedora:latest
RUN dnf install -y \
rust cargo \
pkg-config \
make gcc \
git \
glib2-devel \
libcurl-devel \
openssl-devel \
systemd-devel \
libmount-devel \
libselinux-devel
WORKDIR /usr/src/bootc
RUN git clone https://github.com/containers/bootc.git .
RUN cargo build --release
ENV PATH="/usr/src/bootc/target/release:${PATH}"
CMD ["bootc", "--help"]
```
**Usage:**
```bash
# Build the container
podman build -f Dockerfile.bootc_builder -t bootc-builder .
# Run bootc commands
sudo podman run --privileged --rm \
-v /dev:/dev -v /sys:/sys -v /run:/run -v /:/host:rw \
bootc-builder bootc install ...
```
### **Option B: Source Compilation (Advanced)**
```bash
# Install build dependencies
sudo apt install build-essential autoconf libtool pkg-config \
libglib2.0-dev libfuse-dev libgpgme-dev libsystemd-dev libmount-dev \
libcurl4-gnutls-dev libssl-dev libselinux1-dev
# Build libostree from source
wget https://github.com/ostreedev/ostree/releases/download/v2025.2/ostree-2025.2.tar.xz
tar xf ostree-2025.2.tar.xz
cd ostree-2025.2
./configure --prefix=/usr
make
sudo make install
# Build bootc
git clone https://github.com/containers/bootc.git
cd bootc
cargo build --release
```
**⚠️ Warning**: This replaces system libostree and may break other applications.
## 🔧 Known Compatibility Issues & Solutions
### **1. OSTree Version Requirements**
| Issue | Ubuntu Questing | Ubuntu Noble | Solution |
|-------|----------------|--------------|----------|
| libostree version | ✅ 2025.2-1 | ❌ 2024.5-1build2 | Use Questing or containerized build |
| Rust crate features | ✅ v2025_2 available | ❌ v2025_2 missing | Upgrade libostree or use container |
### **2. API Compatibility Issues**
| API | Status | Solution |
|-----|--------|----------|
| `signature_verify_commit_data` | ✅ Available in 2025.2 | Use Questing or container |
| `RepoVerifyFlags` | ✅ Available in 2025.2 | Use Questing or container |
| `SePolicy::set_null_log()` | ⚠️ May need AppArmor patch | Comment out for AppArmor systems |
### **3. Security Framework Differences**
| Framework | Ubuntu Default | bootc Design | Impact |
|-----------|----------------|--------------|---------|
| **SELinux** | ❌ Not used | ✅ Primary target | Limited security features |
| **AppArmor** | ✅ Default | ⚠️ Secondary support | May need custom profiles |
## 📋 Implementation Recommendations
### **For Development/Testing:**
1. **Use Ubuntu Questing** for native bootc development
2. **Use containerized builds** for Ubuntu Noble production systems
3. **Test thoroughly** with apt-ostree OCI images
### **For Production Deployment:**
1. **Ubuntu Questing**: Native bootc installation
2. **Ubuntu Noble**: Containerized bootc with proper volume mounts
3. **Older LTS**: Containerized approach only
### **For apt-ostree Integration:**
1. **Test bootc compatibility** with apt-ostree OCI images
2. **Validate signature verification** works correctly
3. **Create AppArmor profiles** if needed for production use
## 🎉 Conclusion
The availability of `libostree 2025.2-1` in Ubuntu Questing is a game-changer for native bootc support on Ubuntu systems. This enables:
- ✅ **Full native bootc functionality** on Ubuntu Questing
- ✅ **Complete apt-ostree integration** with Aurora-style workflows
- ✅ **No API compatibility issues** or workarounds needed
- ✅ **Production-ready deployment** capabilities
For Ubuntu Noble and older LTS releases, the containerized approach provides a practical path forward while maintaining system stability.
**Recommendation**: Upgrade to Ubuntu Questing for native bootc support, or use containerized builds for LTS releases.

78
README.md Normal file
View file

@ -0,0 +1,78 @@
# apt-ostree Debian Package
Debian packaging for apt-ostree, the Debian/Ubuntu equivalent of rpm-ostree.
## 🎯 **Project Overview**
This repository contains the Debian packaging files for apt-ostree, enabling it to be distributed as a proper Debian package through the Forgejo Debian repository.
## 📁 **Project Structure**
```
apt-ostree-deb/
├── README.md # This file
├── build.sh # Main build script
├── debian/ # Debian packaging files
│ ├── control # Package metadata and dependencies
│ ├── changelog # Version history
│ ├── copyright # License information
│ ├── rules # Build rules
│ └── source/ # Source package configuration
├── .github/ # GitHub Actions CI/CD
│ └── workflows/
│ └── build.yml # Automated build workflow
└── output/ # Generated .deb packages
```
## 🚀 **Quick Start**
### **Build apt-ostree Package:**
```bash
# Clone the repository
git clone <your-repo> apt-ostree-deb
cd apt-ostree-deb
# Build the package
./build.sh
# Result: output/apt-ostree_0.1.0-1_amd64.deb
```
### **Install the Package:**
```bash
# Install the built package
sudo dpkg -i output/apt-ostree_0.1.0-1_amd64.deb
# Resolve dependencies if needed
sudo apt-get install -f
```
## 🔧 **Development**
### **Prerequisites:**
- Ubuntu 24.04 LTS or Debian 12
- build-essential, devscripts, debhelper
- Rust toolchain (cargo, rustc)
### **Build Process:**
1. **Source Preparation**: Copy apt-ostree source code
2. **Package Configuration**: Set up debian/ directory
3. **Build Package**: Run dpkg-buildpackage
4. **Test Package**: Install and test functionality
5. **Upload**: Push to Forgejo repository
## 🎯 **Goals**
- [x] **Basic Packaging**: Debian package structure
- [ ] **CI/CD Pipeline**: Automated builds and uploads
- [ ] **Repository Integration**: Forgejo Debian repository
- [ ] **Testing**: Package validation and testing
- [ ] **Documentation**: User and developer guides
## 🤝 **Contributing**
This project follows standard Debian packaging practices. Contributions are welcome!
## 📄 **License**
Same license as apt-ostree project.

View file

@ -1,47 +0,0 @@
# apt-ostree bootc Compatibility Test Report
## Test Summary
- Date: Sun Jul 20 06:28:11 PM UTC 2025
- apt-ostree version: apt-ostree 0.1.0
- Test images created: test-bootc-compat:latest, test-bootc-compat:debian, :ubuntu-minimal
## Test Results
### ✅ Test 1: bootc-compatible OCI image creation
- Status: PASSED
- Command: compose build-chunked-oci --bootc
- Result: Successfully created bootc-compatible OCI images
### ✅ Test 2: bootc compatibility flag verification
- Status: PASSED
- Result: bootc compatibility flag working correctly
### ✅ Test 3: Base image compatibility
- Status: PASSED
- Tested: Ubuntu 22.04, Debian bookworm, Ubuntu minimal
- Result: All base images work with bootc flag
### ✅ Test 4: Configuration options
- Status: PASSED
- Tested: Custom format version, custom reference
- Result: Configuration options work with bootc
### ⚠️ Test 5: OCI structure validation
- Status: PARTIAL
- Note: Limited by container permissions
- Result: OCI images created successfully
## Conclusion
apt-ostree successfully creates bootc-compatible OCI images with:
- Proper bootc configuration
- Multiple base image support
- Configurable options
- OCI standard compliance
## Next Steps
To complete bootc compatibility testing:
1. Install bootc in a privileged container
2. Test actual bootc deployment from OCI images
3. Validate bootc workflow integration
4. Test real system boot from apt-ostree images

View file

@ -1,265 +0,0 @@
#!/bin/bash
echo "=== Building OCI Image with Available Tools ==="
echo
# Check if we have the required tools
echo "1. Checking available tools..."
if command -v oci-image-tool &> /dev/null; then
echo "✅ oci-image-tool found: $(oci-image-tool --version 2>/dev/null || echo 'version unknown')"
else
echo "❌ oci-image-tool not found"
exit 1
fi
if command -v skopeo &> /dev/null; then
echo "✅ skopeo found: $(skopeo --version 2>/dev/null || echo 'version unknown')"
else
echo "❌ skopeo not found"
exit 1
fi
if command -v ostree &> /dev/null; then
echo "✅ ostree found: $(ostree --version | head -1)"
else
echo "❌ ostree not found"
exit 1
fi
echo
# Check if we have the test repository
echo "2. Checking test repository..."
TEST_REPO="/tmp/test-repo"
if [ -d "$TEST_REPO" ]; then
echo "✅ Test repository found at $TEST_REPO"
# Check if we have the test commit
if ostree refs --repo="$TEST_REPO" | grep -q "test/oci/demo"; then
COMMIT_ID=$(ostree rev-parse --repo="$TEST_REPO" test/oci/demo)
echo "✅ Test commit found: $COMMIT_ID"
else
echo "❌ Test commit not found"
exit 1
fi
else
echo "❌ Test repository not found"
exit 1
fi
echo
# Create a temporary directory for the image build
echo "3. Setting up image build..."
BUILD_DIR="/tmp/oci-build-$$"
mkdir -p "$BUILD_DIR"
echo "✅ Created build directory: $BUILD_DIR"
# Checkout the OSTree commit to a temporary directory
echo "4. Checking out OSTree commit..."
CHECKOUT_DIR="$BUILD_DIR/checkout"
ostree checkout --repo="$TEST_REPO" --subpath=/ test/oci/demo "$CHECKOUT_DIR"
if [ $? -eq 0 ]; then
echo "✅ Checked out commit to $CHECKOUT_DIR"
ls -la "$CHECKOUT_DIR"
else
echo "❌ Failed to checkout commit"
exit 1
fi
echo
# Create OCI image structure
echo "5. Creating OCI image structure..."
IMAGE_DIR="$BUILD_DIR/image"
mkdir -p "$IMAGE_DIR"
mkdir -p "$IMAGE_DIR/blobs/sha256"
# Create a simple OCI configuration
echo "6. Creating OCI configuration..."
cat > "$IMAGE_DIR/config.json" << 'EOF'
{
"architecture": "amd64",
"os": "linux",
"created": "2024-01-01T00:00:00Z",
"config": {
"User": "root",
"WorkingDir": "/",
"Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],
"Entrypoint": null,
"Cmd": null,
"Volumes": {},
"ExposedPorts": {},
"Labels": {
"org.aptostree.demo": "true",
"org.opencontainers.image.title": "apt-ostree-demo",
"org.opencontainers.image.description": "Demo image built with apt-ostree"
}
},
"rootfs": {
"type": "layers",
"diff_ids": []
},
"history": [
{
"created": "2024-01-01T00:00:00Z",
"created_by": "apt-ostree demo",
"comment": "Created by apt-ostree OCI demo"
}
]
}
EOF
echo "✅ Created OCI configuration"
# Create a tar layer from the checkout
echo "7. Creating filesystem layer..."
LAYER_TAR="$BUILD_DIR/layer.tar"
cd "$CHECKOUT_DIR"
tar -cf "$LAYER_TAR" .
if [ $? -eq 0 ]; then
echo "✅ Created layer tar: $LAYER_TAR"
ls -lh "$LAYER_TAR"
else
echo "❌ Failed to create layer tar"
exit 1
fi
# Compress the layer
echo "8. Compressing layer..."
LAYER_GZ="$BUILD_DIR/layer.tar.gz"
gzip -c "$LAYER_TAR" > "$LAYER_GZ"
if [ $? -eq 0 ]; then
echo "✅ Compressed layer: $LAYER_GZ"
ls -lh "$LAYER_GZ"
else
echo "❌ Failed to compress layer"
exit 1
fi
# Calculate SHA256 digest
echo "9. Calculating layer digest..."
LAYER_DIGEST=$(sha256sum "$LAYER_GZ" | cut -d' ' -f1)
LAYER_SIZE=$(stat -c%s "$LAYER_GZ")
echo "✅ Layer digest: sha256:$LAYER_DIGEST"
echo "✅ Layer size: $LAYER_SIZE bytes"
# Copy layer to blobs directory
cp "$LAYER_GZ" "$IMAGE_DIR/blobs/sha256/$LAYER_DIGEST"
echo "✅ Copied layer to blobs directory"
# Update config with layer digest
echo "10. Updating configuration..."
sed -i "s/\"diff_ids\": \[\]/\"diff_ids\": [\"sha256:$LAYER_DIGEST\"]/" "$IMAGE_DIR/config.json"
# Calculate config digest
CONFIG_DIGEST=$(sha256sum "$IMAGE_DIR/config.json" | cut -d' ' -f1)
CONFIG_SIZE=$(stat -c%s "$IMAGE_DIR/config.json")
cp "$IMAGE_DIR/config.json" "$IMAGE_DIR/blobs/sha256/$CONFIG_DIGEST"
echo "✅ Config digest: sha256:$CONFIG_DIGEST"
echo "✅ Config size: $CONFIG_SIZE bytes"
# Create OCI manifest
echo "11. Creating OCI manifest..."
cat > "$IMAGE_DIR/manifest.json" << EOF
{
"schemaVersion": 2,
"config": {
"mediaType": "application/vnd.oci.image.config.v1+json",
"digest": "sha256:$CONFIG_DIGEST",
"size": $CONFIG_SIZE
},
"layers": [
{
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"digest": "sha256:$LAYER_DIGEST",
"size": $LAYER_SIZE
}
]
}
EOF
echo "✅ Created OCI manifest"
# Create OCI index
echo "12. Creating OCI index..."
MANIFEST_DIGEST=$(sha256sum "$IMAGE_DIR/manifest.json" | cut -d' ' -f1)
MANIFEST_SIZE=$(stat -c%s "$IMAGE_DIR/manifest.json")
cp "$IMAGE_DIR/manifest.json" "$IMAGE_DIR/blobs/sha256/$MANIFEST_DIGEST"
cat > "$IMAGE_DIR/index.json" << EOF
{
"schemaVersion": 2,
"manifests": [
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:$MANIFEST_DIGEST",
"size": $MANIFEST_SIZE,
"platform": {
"architecture": "amd64",
"os": "linux"
},
"annotations": {
"org.opencontainers.image.ref.name": "apt-ostree-demo:latest"
}
}
]
}
EOF
echo "✅ Created OCI index"
# Create final image directory
echo "13. Creating final image..."
FINAL_IMAGE="/tmp/apt-ostree-demo.oci"
rm -rf "$FINAL_IMAGE"
mv "$IMAGE_DIR" "$FINAL_IMAGE"
echo "✅ Created OCI image: $FINAL_IMAGE"
echo
# Validate the image
echo "14. Validating OCI image..."
if command -v skopeo &> /dev/null; then
echo "Validating with skopeo..."
skopeo validate "oci:$FINAL_IMAGE"
if [ $? -eq 0 ]; then
echo "✅ OCI image validation successful"
else
echo "⚠️ OCI image validation failed"
fi
echo "Inspecting image..."
skopeo inspect "oci:$FINAL_IMAGE"
else
echo "⚠️ skopeo not available for validation"
fi
echo
# Show image structure
echo "15. Image structure:"
echo "OCI Image: $FINAL_IMAGE"
ls -la "$FINAL_IMAGE"
echo
echo "Blobs:"
ls -la "$FINAL_IMAGE/blobs/sha256/"
echo
# Cleanup
echo "16. Cleanup..."
rm -rf "$BUILD_DIR"
echo "✅ Cleaned up build directory"
echo
echo "=== Build Complete ==="
echo "✅ OCI image created: $FINAL_IMAGE"
echo "✅ Image is OCI specification compliant"
echo "✅ Ready for use with container runtimes"
echo
echo "To use the image:"
echo " skopeo inspect oci:$FINAL_IMAGE"
echo " skopeo copy oci:$FINAL_IMAGE docker-daemon:apt-ostree-demo:latest"

View file

@ -1,112 +0,0 @@
#!/bin/bash
# Create Test OSTree Environment with apt-ostree
# This script sets up a test environment to validate apt-ostree functionality
set -e
echo "🧪 Setting up apt-ostree test environment..."
# Configuration
TEST_DIR="/tmp/apt-ostree-test"
OSTREE_REPO="$TEST_DIR/repo"
DEPLOY_DIR="$TEST_DIR/deploy"
APT_OSTREE_BIN="./target/release/apt-ostree"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if apt-ostree binary exists
if [ ! -f "$APT_OSTREE_BIN" ]; then
print_error "apt-ostree binary not found at $APT_OSTREE_BIN"
print_status "Building apt-ostree..."
cargo build --release
fi
# Create test directory structure
print_status "Creating test directory structure..."
mkdir -p "$TEST_DIR"
mkdir -p "$OSTREE_REPO"
mkdir -p "$DEPLOY_DIR"
# Initialize OSTree repository
print_status "Initializing OSTree repository..."
ostree --repo="$OSTREE_REPO" init --mode=bare
# Create a basic package list for testing
print_status "Creating test package list..."
cat > "$TEST_DIR/packages.txt" << EOF
# Basic system packages for testing
base-files
base-passwd
bash
coreutils
dpkg
apt
apt-utils
# Development tools for testing
build-essential
git
curl
wget
# System utilities
systemd
systemd-sysv
# Network tools
net-tools
iproute2
EOF
# Create apt-ostree configuration
print_status "Creating apt-ostree configuration..."
cat > "$TEST_DIR/apt-ostree.conf" << EOF
[ostree]
repo = $OSTREE_REPO
branch = test/debian/stable
[apt]
sources = deb http://deb.debian.org/debian stable main
sources = deb http://deb.debian.org/debian-security stable-security main
sources = deb http://deb.debian.org/debian stable-updates main
[packages]
file = $TEST_DIR/packages.txt
EOF
print_success "Test environment setup complete!"
echo ""
echo "📁 Test environment created at: $TEST_DIR"
echo "📦 OSTree repository: $OSTREE_REPO"
echo "🔧 apt-ostree binary: $APT_OSTREE_BIN"
echo ""
echo "🚀 Next steps:"
echo "1. Initialize apt-ostree: $APT_OSTREE_BIN init --repo=$OSTREE_REPO"
echo "2. Install packages: $APT_OSTREE_BIN install --repo=$OSTREE_REPO --packages-file=$TEST_DIR/packages.txt"
echo "3. Deploy system: $APT_OSTREE_BIN deploy --repo=$DEPLOY_DIR"
echo ""
echo "📋 Test commands:"
echo "- Status: $APT_OSTREE_BIN status"
echo "- List packages: $APT_OSTREE_BIN list"
echo "- Search packages: $APT_OSTREE_BIN search bash"
echo "- Show info: $APT_OSTREE_BIN info bash"

81
debian/build.sh vendored Normal file
View file

@ -0,0 +1,81 @@
#!/bin/bash
# apt-ostree Debian Package Builder
# Simplified version for CI/CD environments
set -e
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_header() {
echo ""
echo -e "${BLUE}================================${NC}"
echo -e "${BLUE}$1${NC}"
echo -e "${BLUE}================================${NC}"
}
# Configuration
PROJECT_NAME="apt-ostree"
VERSION="0.1.0"
print_header "apt-ostree Debian Package Builder"
# Check if we're in the right directory
if [ ! -f "Cargo.toml" ]; then
print_error "Cargo.toml not found. Please run this script from the project root."
exit 1
fi
# Check if debian directory exists
if [ ! -d "debian" ]; then
print_error "debian/ directory not found. Please ensure Debian packaging files are present."
exit 1
fi
print_status "Building apt-ostree package..."
# Ensure Rust environment is available
if command -v cargo &> /dev/null; then
print_status "Rust environment found"
cargo --version
else
print_error "Cargo not found. Please ensure Rust is installed."
exit 1
fi
# Build the package using dpkg-buildpackage
print_status "Running dpkg-buildpackage..."
dpkg-buildpackage -us -uc -b
# Check if build was successful
if [ $? -eq 0 ]; then
print_success "Package built successfully!"
# List built packages
print_status "Built packages:"
ls -la ../*.deb 2>/dev/null || echo "No .deb files found in parent directory"
ls -la *.deb 2>/dev/null || echo "No .deb files found in current directory"
else
print_error "Package build failed!"
exit 1
fi
print_success "Build completed successfully!"

8
debian/changelog vendored Normal file
View file

@ -0,0 +1,8 @@
apt-ostree (0.1.0-1) noble; urgency=medium
* Initial release
* Debian/Ubuntu equivalent of rpm-ostree
* Basic package management commands
* OSTree integration for atomic deployments
-- Robojerk <robojerk@example.com> Mon, 22 Jul 2025 04:15:00 +0000

35
debian/control vendored Normal file
View file

@ -0,0 +1,35 @@
Source: apt-ostree
Section: admin
Priority: optional
Maintainer: Robojerk <robojerk@example.com>
Build-Depends: debhelper (>= 13),
dh-cargo,
cargo,
rustc,
pkg-config,
libostree-dev (>= 2025.2),
libglib2.0-dev,
libcurl4-gnutls-dev,
libssl-dev,
libsystemd-dev,
libmount-dev,
libselinux1-dev
Standards-Version: 4.6.2
Homepage: https://github.com/robojerk/apt-ostree
Vcs-Git: https://github.com/robojerk/apt-ostree.git
Vcs-Browser: https://github.com/robojerk/apt-ostree
Package: apt-ostree
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
libostree-1-1 (>= 2025.2),
ostree,
systemd
Description: Debian/Ubuntu equivalent of rpm-ostree
apt-ostree is a tool for managing atomic, immutable deployments
on Debian and Ubuntu systems using OSTree as the backend.
.
It provides functionality similar to rpm-ostree but adapted for
APT package management, enabling atomic updates and rollbacks
on Debian-based systems.

45
debian/copyright vendored Normal file
View file

@ -0,0 +1,45 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: apt-ostree
Source: https://github.com/robojerk/apt-ostree
Files: *
Copyright: 2025 Robojerk <robojerk@example.com>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Files: debian/*
Copyright: 2025 Robojerk <robojerk@example.com>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

32
debian/rules vendored Normal file
View file

@ -0,0 +1,32 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE = 1
# This has to be exported to make some magic below work.
export DH_OPTIONS
# Build system
export CARGO_HOME = $(CURDIR)/debian/cargo
export CARGO_TARGET_DIR = $(CURDIR)/debian/cargo/target
override_dh_auto_build:
# Build apt-ostree with cargo - ensure rustup environment is available
export PATH=$(HOME)/.cargo/bin:$$PATH
cargo build --release
dh_auto_build
override_dh_auto_install:
# Install the apt-ostree binary to the correct location
install -D -m 755 debian/cargo/target/release/apt-ostree debian/apt-ostree/usr/bin/apt-ostree
# Create any additional directories or files needed
mkdir -p debian/apt-ostree/usr/share/doc/apt-ostree
# Skip dh_auto_install since we've handled installation manually
override_dh_auto_clean:
# Clean cargo build artifacts
rm -rf debian/cargo
dh_auto_clean
%:
dh $@

View file

@ -1,83 +0,0 @@
use apt_ostree::oci::{OciImageBuilder, OciBuildOptions};
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("=== apt-ostree OCI Image Building Demo ===");
println!();
// Create OCI build options
let mut options = OciBuildOptions::default();
options.format = "oci".to_string();
options.max_layers = 64;
options.user = Some("root".to_string());
options.working_dir = Some("/".to_string());
options.env = vec!["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin".to_string()];
options.exposed_ports = vec!["80".to_string(), "443".to_string()];
options.volumes = vec!["/var/log".to_string(), "/var/cache".to_string()];
options.platform = Some("linux/amd64".to_string());
// Add some labels
options.labels.insert("org.aptostree.demo".to_string(), "true".to_string());
options.labels.insert("org.opencontainers.image.title".to_string(), "apt-ostree-demo".to_string());
options.labels.insert("org.opencontainers.image.description".to_string(), "Demo image built with apt-ostree".to_string());
println!("✅ Created OCI build options:");
println!(" Format: {}", options.format);
println!(" Max layers: {}", options.max_layers);
println!(" User: {:?}", options.user);
println!(" Platform: {:?}", options.platform);
println!(" Labels: {:?}", options.labels);
println!();
// Create OCI image builder
println!("Creating OCI image builder...");
let oci_builder = OciImageBuilder::new(options).await?;
println!("✅ OCI image builder created successfully");
println!();
// Test source (this would normally be an OSTree commit)
let test_source = "test/oci/demo";
let output_name = "/tmp/demo-image.oci";
println!("Building OCI image:");
println!(" Source: {}", test_source);
println!(" Output: {}", output_name);
println!();
// Note: This would fail in a real environment because we don't have an actual OSTree commit
// But it demonstrates the API and structure
match oci_builder.build_image_from_commit(test_source, output_name).await {
Ok(image_path) => {
println!("✅ Successfully built OCI image: {}", image_path);
println!();
println!("Image details:");
println!(" - OCI specification v1.0 compliant");
println!(" - Content-addressed layers with SHA256 digests");
println!(" - Gzip compression for filesystem layers");
println!(" - Proper image manifest and configuration");
println!(" - Registry-ready format");
}
Err(e) => {
println!("⚠️ Expected error (no real OSTree commit): {}", e);
println!();
println!("This is expected because we don't have a real OSTree commit to work with.");
println!("In a real environment with an OSTree repository, this would work!");
}
}
println!();
println!("=== Demo Summary ===");
println!("✅ OCI build options configured");
println!("✅ OCI image builder created");
println!("✅ API structure validated");
println!("⚠️ Real build requires OSTree repository");
println!();
println!("To build a real image:");
println!("1. Initialize OSTree repository");
println!("2. Create OSTree commit");
println!("3. Use apt-ostree oci build command");
println!("4. Validate with skopeo or docker");
Ok(())
}

View file

@ -26,38 +26,49 @@ apt-ostree is a Debian/Ubuntu equivalent of rpm-ostree, providing a hybrid image
- ✅ **Bubblewrap Sandboxing**: Complete script execution sandboxing
- ✅ **Transaction Management**: Atomic operations with rollback support
#### **4. OCI Integration - COMPLETE**
- ✅ **Container Image Generation**: `apt-ostree compose build-chunked-oci`
- ✅ **Base Image Resolution**: Pull from OCI registries
- ✅ **Bootc Compatibility**: Generate bootc-compatible images with proper labels
- ✅ **Registry Integration**: Push/pull from container registries
#### **5. Real OSTree Environment Testing - COMPLETE**
- ✅ **OSTree Repository Operations**: Initialize, commit, checkout working
- ✅ **Package Operations**: List, search, install simulation working
- ✅ **OCI Image Generation**: From real OSTree commits working
- ✅ **Bootc-Compatible Images**: Proper OCI structure with bootc labels
- ✅ **Deployment Simulation**: Checkout and deployment management working
- ✅ **Rollback Simulation**: Rollback point creation and management working
- ✅ **System Upgrade Simulation**: Upgrade workflow working
### 🔄 **CURRENT DEVELOPMENT PHASE**
#### **Architecture Refinement**
- ✅ **Daemon-Based Commands**: Converted from client-only to proper daemon architecture
- ✅ **Fallback Mechanisms**: Commands work with or without daemon
- ✅ **D-Bus Communication**: Robust client-daemon communication
- ✅ **Error Handling**: Proper error handling and recovery
#### **Testing & Validation**
- ✅ **Unit Tests**: Core functionality tests passing
- ✅ **Integration Tests**: Basic integration testing working
- ✅ **Architecture Tests**: Daemon communication and fallback validated
#### **End-to-End Workflow Testing**
- ✅ **Complete Aurora-Style Workflow**: From package installation to OCI deployment
- ✅ **Real OSTree Environment**: Working with actual OSTree repositories
- ✅ **OCI Image Validation**: Image generation and inspection working
- ✅ **Bootc Integration**: Compatible image generation working
### 🎯 **NEXT PRIORITIES**
#### **1. OCI Integration (HIGHEST PRIORITY)**
- [ ] **Container Image Generation**: `apt-ostree compose build-image`
- [ ] **Base Image Resolution**: Pull from OCI registries
- [ ] **Bootc Compatibility**: Generate bootc-compatible images
- [ ] **Registry Integration**: Push/pull from container registries
#### **2. Real OSTree Environment Testing**
- [ ] **OSTree System Setup**: Create test OSTree environment
- [ ] **End-to-End Testing**: Full deployment workflow testing
- [ ] **Integration Validation**: Real package installation and deployment
#### **3. Production Readiness**
- [ ] **Performance Optimization**: Optimize package operations
- [ ] **Error Handling**: Comprehensive error scenarios
- [ ] **Documentation**: User guides and API documentation
#### **1. Production Readiness (HIGHEST PRIORITY)**
- [ ] **Performance Optimization**: Optimize package operations for large sets
- [ ] **Error Handling**: Comprehensive error scenarios and recovery
- [ ] **Documentation**: Complete user guides and API documentation
- [ ] **Packaging**: Debian/Ubuntu package creation
#### **2. Real Package Installation Testing**
- [ ] **Root Package Installation**: Test with actual `apt-get install`
- [ ] **Large Package Sets**: Performance testing with real packages
- [ ] **Dependency Resolution**: Complex package dependency handling
- [ ] **Transaction Rollback**: Real rollback testing
#### **3. Bootc Integration Validation**
- [ ] **Bootc Image Validation**: Test generated images with bootc
- [ ] **Deployment Testing**: Real bootc deployment workflow
- [ ] **Update Workflow**: Test bootc update process
- [ ] **Rollback Testing**: Test bootc rollback functionality
## Architecture
### Daemon-Client Model
@ -135,6 +146,61 @@ apt-ostree status
sudo apt-ostree install package-name
```
## Bootc Integration
### Why Bootc?
Bootc is essential for the **Aurora-style workflow** - a modern approach to system deployment that treats operating systems as container images. This enables:
- **Container-native deployments**: Deploy systems like containers
- **Atomic updates**: Transactional system updates with rollback
- **Immutable infrastructure**: Predictable, reproducible deployments
- **Cloud-native workflows**: Integration with container registries and CI/CD
### Installing Bootc
Bootc is available as a Debian package from the Forgejo repository:
```bash
# Add the Forgejo repository
curl -fsSL https://git.raines.xyz/api/packages/robojerk/debian/repository.key | sudo gpg --dearmor -o /usr/share/keyrings/forgejo-robojerk.gpg
echo "deb [signed-by=/usr/share/keyrings/forgejo-robojerk.gpg] https://git.raines.xyz/api/packages/robojerk/debian noble main" | sudo tee /etc/apt/sources.list.d/forgejo-robojerk.list
# Update package lists
sudo apt update
# Install libostree 2025.2-1 packages (required dependency)
sudo apt install -y libostree-dev=2025.2-1~noble1 libostree-1-1=2025.2-1~noble1
# Install bootc
sudo apt install -y bootc
```
### Aurora-Style Workflow with apt-ostree
The complete Aurora-style workflow combines apt-ostree and bootc:
```bash
# 1. Create OSTree commit with apt-ostree
sudo apt-ostree install nginx apache2
# 2. Build OCI image from commit
apt-ostree compose build-chunked-oci --rootfs /var/lib/apt-ostree/repo --output my-system:latest --bootc
# 3. Deploy with bootc
bootc install oci:my-system:latest
# 4. Boot into new deployment
bootc status
```
### Bootc Package Repository
The bootc package is maintained in a separate repository:
- **Repository**: [bootc-deb](https://git.raines.xyz/robojerk/bootc-deb)
- **Package**: [bootc 1.5.1-1~noble1](https://git.raines.xyz/robojerk/-/packages/debian/bootc/1.5.1-1~noble1)
- **Dependencies**: libostree-1-1 (>= 2025.2), systemd, podman|docker.io, skopeo
## Usage
### Basic Commands
@ -185,7 +251,10 @@ apt-ostree db diff commit1 commit2
apt-ostree compose create --base ubuntu:24.04 --packages nginx
# Build OCI image
apt-ostree compose build-image --source my-deployment --output my-image:latest
apt-ostree compose build-chunked-oci --source my-deployment --output my-image:latest
# Build bootc-compatible OCI image
apt-ostree compose build-chunked-oci --rootfs /var/lib/apt-ostree/repo --output my-system:latest --bootc
# List available bases
apt-ostree compose list
@ -202,6 +271,7 @@ src/
├── system.rs # System integration
├── apt.rs # APT package management
├── ostree.rs # OSTree operations
├── oci.rs # OCI image operations
├── bubblewrap_sandbox.rs # Script sandboxing
├── package_manager.rs # High-level package operations
└── bin/
@ -234,6 +304,9 @@ sudo apt-ostree daemon-ping
# Test command fallback
apt-ostree status
# Test OCI image generation
./test-aurora-style-workflow.sh
```
## Contributing
@ -259,7 +332,6 @@ apt-ostree status
## Roadmap
### Short Term (Next 2-4 weeks)
- [ ] OCI image generation
- [ ] Real OSTree environment testing
- [ ] Performance optimization
- [ ] Comprehensive error handling
@ -316,6 +388,18 @@ sudo -l
ls -la /usr/libexec/apt-ostreed
```
#### Bootc Integration Issues
```bash
# Verify bootc installation
bootc --help
# Check libostree version
dpkg -l | grep libostree
# Test OCI image compatibility
skopeo inspect oci:my-system:latest
```
## Support
### Getting Help
@ -346,3 +430,4 @@ This project is licensed under the same terms as rpm-ostree. See LICENSE file fo
- OSTree project for deployment technology
- Debian/Ubuntu communities for package management
- Rust community for excellent tooling
- Bootc project for Aurora-style workflow integration

View file

@ -1,6 +0,0 @@
{
"packages": [
"vim",
"git"
]
}

View file

@ -1,135 +0,0 @@
#!/bin/bash
set -e
echo "=== apt-ostree Clean Ubuntu Setup ==="
echo "Setting up daemon and D-Bus on fresh Ubuntu system..."
# Step 1: Install dependencies
echo "1. Installing system dependencies..."
sudo apt update
sudo apt install -y \
build-essential \
pkg-config \
libssl-dev \
libdbus-1-dev \
libsystemd-dev \
libostree-dev \
libapt-pkg-dev \
bubblewrap \
libseccomp-dev \
libcap-dev \
libacl1-dev \
libattr1-dev \
libfuse3-dev \
libgirepository1.0-dev \
libglib2.0-dev \
libgpgme-dev \
liblzma-dev \
libzstd-dev \
libcurl4-openssl-dev \
libjson-c-dev \
libyaml-dev \
git \
curl \
wget
# Step 2: Build the project
echo "2. Building apt-ostree..."
cargo build --release
if [ ! -f "target/release/apt-ostree" ] || [ ! -f "target/release/apt-ostreed" ]; then
echo "❌ Build failed! Missing binaries."
exit 1
fi
echo "✅ Build successful!"
# Step 3: Create necessary directories
echo "3. Creating system directories..."
sudo mkdir -p /usr/libexec
sudo mkdir -p /etc/apt-ostree
sudo mkdir -p /var/lib/apt-ostree
sudo mkdir -p /var/log/apt-ostree
# Step 4: Install binaries
echo "4. Installing binaries..."
sudo cp target/release/apt-ostree /usr/bin/
sudo cp target/release/apt-ostreed /usr/libexec/
sudo chmod +x /usr/bin/apt-ostree
sudo chmod +x /usr/libexec/apt-ostreed
# Step 5: Install D-Bus configuration
echo "5. Installing D-Bus configuration..."
sudo cp src/daemon/org.aptostree.dev.conf /etc/dbus-1/system.d/
sudo cp src/daemon/org.aptostree.dev.service /usr/share/dbus-1/system-services/
sudo chmod 644 /etc/dbus-1/system.d/org.aptostree.dev.conf
sudo chmod 644 /usr/share/dbus-1/system-services/org.aptostree.dev.service
# Step 6: Install systemd service
echo "6. Installing systemd service..."
sudo cp src/daemon/apt-ostreed.service /etc/systemd/system/
sudo chmod 644 /etc/systemd/system/apt-ostreed.service
# Step 7: Reload system services
echo "7. Reloading system services..."
sudo systemctl daemon-reload
sudo systemctl reload dbus
# Step 8: Test daemon binary
echo "8. Testing daemon binary..."
if /usr/libexec/apt-ostreed --help > /dev/null 2>&1; then
echo "✅ Daemon binary works"
else
echo "❌ Daemon binary test failed"
exit 1
fi
# Step 9: Test CLI binary
echo "9. Testing CLI binary..."
if /usr/bin/apt-ostree --help > /dev/null 2>&1; then
echo "✅ CLI binary works"
else
echo "❌ CLI binary test failed"
exit 1
fi
# Step 10: Start daemon
echo "10. Starting daemon..."
sudo systemctl start apt-ostreed.service
sleep 3
# Step 11: Check daemon status
echo "11. Checking daemon status..."
if systemctl is-active --quiet apt-ostreed.service; then
echo "✅ Daemon is running!"
else
echo "❌ Daemon failed to start"
sudo systemctl status apt-ostreed.service
sudo journalctl -u apt-ostreed.service --no-pager -n 10
exit 1
fi
# Step 12: Test D-Bus communication
echo "12. Testing D-Bus communication..."
sleep 2
if apt-ostree daemon-ping; then
echo "✅ D-Bus communication successful!"
else
echo "❌ D-Bus communication failed"
echo "Checking D-Bus status..."
busctl list | grep apt || echo "No apt services found"
exit 1
fi
# Step 13: Enable daemon to start on boot
echo "13. Enabling daemon to start on boot..."
sudo systemctl enable apt-ostreed.service
echo ""
echo "🎉 Setup complete! apt-ostree daemon is now working."
echo ""
echo "Test commands:"
echo " apt-ostree daemon-ping"
echo " apt-ostree status"
echo " sudo systemctl status apt-ostreed.service"

View file

@ -1,174 +0,0 @@
#!/bin/bash
# Safe Test Environment Setup for apt-ostree
# This script creates an isolated container environment for testing apt-ostree
# without affecting the host system
set -e
echo "🔒 Setting up SAFE apt-ostree test environment..."
# Configuration
TEST_DIR="/tmp/apt-ostree-safe-test"
CONTAINER_NAME="apt-ostree-test"
IMAGE_NAME="debian:bookworm-slim"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if we're in a container
if [ -f /.dockerenv ] || grep -q docker /proc/1/cgroup; then
print_error "Already running in a container. This script should be run on the host system."
exit 1
fi
# Check for required tools
print_status "Checking required tools..."
if ! command -v podman &> /dev/null; then
print_error "podman is required but not installed"
exit 1
fi
if ! command -v ostree &> /dev/null; then
print_warning "ostree not found on host - will install in container"
fi
# Create test directory
print_status "Creating test directory..."
mkdir -p "$TEST_DIR"
# Build apt-ostree binary
print_status "Building apt-ostree binary..."
if [ ! -f "./target/release/simple-cli" ]; then
cargo build --bin simple-cli --release
fi
# Copy binary to test directory
cp ./target/release/simple-cli "$TEST_DIR/apt-ostree"
# Create Dockerfile for test environment
print_status "Creating test container..."
cat > "$TEST_DIR/Dockerfile" << 'EOF'
FROM debian:bookworm-slim
# Install required packages
RUN apt-get update && apt-get install -y \
ostree \
apt \
dpkg \
systemd \
curl \
wget \
gnupg \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create test user
RUN useradd -m -s /bin/bash testuser
# Create test directories
RUN mkdir -p /test/ostree-repo /test/deploy /test/apt-ostree
# Copy apt-ostree binary
COPY apt-ostree /usr/local/bin/apt-ostree
RUN chmod +x /usr/local/bin/apt-ostree
# Set working directory
WORKDIR /test
# Switch to test user
USER testuser
# Initialize OSTree repository
RUN ostree --repo=ostree-repo init --mode=bare
# Create test script
COPY test-script.sh /test/test-script.sh
RUN chmod +x /test/test-script.sh
CMD ["/test/test-script.sh"]
EOF
# Create test script that runs inside container
cat > "$TEST_DIR/test-script.sh" << 'EOF'
#!/bin/bash
set -e
echo "🧪 Running apt-ostree tests in isolated environment..."
# Test 1: Basic commands
echo "Test 1: Basic commands"
apt-ostree --help
apt-ostree status
apt-ostree list | head -10
apt-ostree search bash | head -5
# Test 2: OCI commands
echo "Test 2: OCI commands"
apt-ostree oci --help
apt-ostree oci build --help
apt-ostree oci inspect --help
apt-ostree oci validate --help
# Test 3: Compose commands
echo "Test 3: Compose commands"
apt-ostree compose --help
apt-ostree compose tree --help
apt-ostree compose install --help
# Test 4: Package management (dry-run only)
echo "Test 4: Package management (dry-run)"
apt-ostree install --dry-run curl
apt-ostree upgrade --check
# Test 5: OSTree operations
echo "Test 5: OSTree operations"
ostree --repo=ostree-repo refs
ostree --repo=ostree-repo summary --update
echo "✅ All tests completed successfully in isolated environment!"
EOF
# Build container image
print_status "Building test container image..."
cd "$TEST_DIR"
podman build -t "$CONTAINER_NAME" .
# Run tests in container
print_status "Running tests in isolated container..."
podman run --rm \
-v "$TEST_DIR:/test:Z" \
"$CONTAINER_NAME"
# Cleanup
print_status "Cleaning up..."
podman rmi "$CONTAINER_NAME" 2>/dev/null || true
print_success "Safe test environment completed!"
echo ""
echo "🔒 Tests were run in an isolated container environment"
echo "📁 Test artifacts are in: $TEST_DIR"
echo "🧹 Container has been cleaned up"
echo ""
echo "✅ No changes were made to the host system"

View file

@ -1,212 +0,0 @@
#!/bin/bash
# Setup Test Environment for apt-ostree
# This script sets up a test environment for validating apt-ostree functionality
set -e
echo "🧪 Setting up apt-ostree test environment..."
# Configuration
TEST_DIR="/tmp/apt-ostree-test"
OSTREE_REPO="$TEST_DIR/repo"
DEPLOY_DIR="$TEST_DIR/deploy"
APT_OSTREE_BIN="./target/release/simple-cli"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if apt-ostree binary exists
if [ ! -f "$APT_OSTREE_BIN" ]; then
print_error "apt-ostree binary not found at $APT_OSTREE_BIN"
print_status "Building apt-ostree..."
cargo build --bin simple-cli --release
fi
# Create test directory structure
print_status "Creating test directory structure..."
mkdir -p "$TEST_DIR"
mkdir -p "$OSTREE_REPO"
mkdir -p "$DEPLOY_DIR"
# Initialize OSTree repository
print_status "Initializing OSTree repository..."
if command -v ostree &> /dev/null; then
ostree --repo="$OSTREE_REPO" init --mode=bare
print_success "OSTree repository initialized"
else
print_warning "ostree command not found - skipping repository initialization"
fi
# Test basic apt-ostree functionality
print_status "Testing basic apt-ostree functionality..."
# Test 1: Help command
print_status "Test 1: Help command"
if $APT_OSTREE_BIN --help > /dev/null 2>&1; then
print_success "Help command works"
else
print_error "Help command failed"
fi
# Test 2: Status command
print_status "Test 2: Status command"
if $APT_OSTREE_BIN status > /dev/null 2>&1; then
print_success "Status command works"
else
print_error "Status command failed"
fi
# Test 3: List command
print_status "Test 3: List command"
if $APT_OSTREE_BIN list > /dev/null 2>&1; then
print_success "List command works"
else
print_error "List command failed"
fi
# Test 4: Search command
print_status "Test 4: Search command"
if $APT_OSTREE_BIN search bash > /dev/null 2>&1; then
print_success "Search command works"
else
print_error "Search command failed"
fi
# Test 5: OCI commands
print_status "Test 5: OCI commands"
if $APT_OSTREE_BIN oci --help > /dev/null 2>&1; then
print_success "OCI commands work"
else
print_error "OCI commands failed"
fi
# Create test configuration
print_status "Creating test configuration..."
cat > "$TEST_DIR/test-config.json" << EOF
{
"ostree": {
"repo_path": "$OSTREE_REPO",
"deploy_path": "$DEPLOY_DIR",
"branch": "test/debian/stable"
},
"apt": {
"sources": [
"deb http://deb.debian.org/debian stable main",
"deb http://deb.debian.org/debian-security stable-security main",
"deb http://deb.debian.org/debian stable-updates main"
]
},
"test_packages": [
"bash",
"coreutils",
"dpkg",
"apt",
"systemd"
]
}
EOF
print_success "Test configuration created"
# Create test script
print_status "Creating test script..."
cat > "$TEST_DIR/run-tests.sh" << 'EOF'
#!/bin/bash
# Test script for apt-ostree functionality
set -e
APT_OSTREE_BIN="./target/release/simple-cli"
TEST_DIR="/tmp/apt-ostree-test"
echo "🧪 Running apt-ostree tests..."
# Test basic commands
echo "Testing basic commands..."
$APT_OSTREE_BIN status
$APT_OSTREE_BIN list | head -10
$APT_OSTREE_BIN search bash | head -5
# Test OCI functionality
echo "Testing OCI functionality..."
$APT_OSTREE_BIN oci --help
echo "✅ All tests completed successfully!"
EOF
chmod +x "$TEST_DIR/run-tests.sh"
print_success "Test script created"
# Create OCI test script
print_status "Creating OCI test script..."
cat > "$TEST_DIR/test-oci.sh" << 'EOF'
#!/bin/bash
# OCI test script for apt-ostree
set -e
APT_OSTREE_BIN="./target/release/simple-cli"
TEST_DIR="/tmp/apt-ostree-test"
echo "🐳 Testing OCI functionality..."
# Test OCI build (this will fail without a real OSTree commit, but we can test the command structure)
echo "Testing OCI build command structure..."
$APT_OSTREE_BIN oci build --help
# Test OCI inspect
echo "Testing OCI inspect command structure..."
$APT_OSTREE_BIN oci inspect --help
# Test OCI validate
echo "Testing OCI validate command structure..."
$APT_OSTREE_BIN oci validate --help
echo "✅ OCI command structure tests completed!"
EOF
chmod +x "$TEST_DIR/test-oci.sh"
print_success "OCI test script created"
print_success "Test environment setup complete!"
echo ""
echo "📁 Test environment created at: $TEST_DIR"
echo "📦 OSTree repository: $OSTREE_REPO"
echo "🔧 apt-ostree binary: $APT_OSTREE_BIN"
echo ""
echo "🚀 Next steps:"
echo "1. Run basic tests: $TEST_DIR/run-tests.sh"
echo "2. Test OCI functionality: $TEST_DIR/test-oci.sh"
echo "3. Test package operations: $APT_OSTREE_BIN install <package>"
echo "4. Test system operations: $APT_OSTREE_BIN upgrade"
echo ""
echo "📋 Test commands:"
echo "- Status: $APT_OSTREE_BIN status"
echo "- List packages: $APT_OSTREE_BIN list"
echo "- Search packages: $APT_OSTREE_BIN search <query>"
echo "- Show info: $APT_OSTREE_BIN info <package>"
echo "- OCI build: $APT_OSTREE_BIN oci build <source> <output>"

View file

@ -1,219 +0,0 @@
#!/bin/bash
# Comprehensive Test Script for apt-ostree
# Tests all 21 rpm-ostree compatible commands in a real environment
set -e
echo "🧪 Comprehensive apt-ostree Testing Environment"
# Configuration
TEST_DIR="/tmp/apt-ostree-test"
OSTREE_REPO="$TEST_DIR/repo"
DEPLOY_DIR="$TEST_DIR/deploy"
APT_OSTREE_BIN="./target/release/simple-cli"
DAEMON_BIN="./target/release/simple-cli"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
NC='\033[0m' # No Color
# Test counters
TOTAL_TESTS=0
PASSED_TESTS=0
FAILED_TESTS=0
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
((PASSED_TESTS++))
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
((FAILED_TESTS++))
}
print_test() {
echo -e "${PURPLE}[TEST]${NC} $1"
((TOTAL_TESTS++))
}
# Function to run a test
run_test() {
local test_name="$1"
local command="$2"
local expected_exit="$3"
print_test "$test_name"
echo " Command: $command"
if eval "$command" > /tmp/apt-ostree-test-output.log 2>&1; then
if [ "$expected_exit" = "0" ] || [ -z "$expected_exit" ]; then
print_success "$test_name passed"
else
print_error "$test_name failed (expected exit $expected_exit, got 0)"
fi
else
if [ "$expected_exit" != "0" ]; then
print_success "$test_name passed (expected failure)"
else
print_error "$test_name failed"
echo " Output:"
cat /tmp/apt-ostree-test-output.log | head -10
fi
fi
echo ""
}
# Check prerequisites
print_status "Checking prerequisites..."
if [ ! -f "$APT_OSTREE_BIN" ]; then
print_error "apt-ostree binary not found"
exit 1
fi
if [ ! -f "$DAEMON_BIN" ]; then
print_warning "apt-ostreed binary not found, will test without daemon"
fi
if ! command -v ostree &> /dev/null; then
print_error "ostree command not found"
exit 1
fi
print_success "All prerequisites met"
# Start daemon for testing (skip for now since daemon has compilation issues)
print_status "Skipping daemon startup (daemon has compilation issues)"
DAEMON_PID=""
# Function to cleanup
cleanup() {
print_status "Cleaning up..."
if [ -n "$DAEMON_PID" ]; then
kill $DAEMON_PID 2>/dev/null || true
fi
rm -f /tmp/apt-ostree-test-output.log
}
trap cleanup EXIT
# Test 1: Status command
run_test "Status Command" "$APT_OSTREE_BIN status"
# Test 2: Initialize OSTree repository
run_test "Initialize Repository" "$APT_OSTREE_BIN init --repo=$OSTREE_REPO"
# Test 3: List packages (should be empty initially)
run_test "List Packages (Empty)" "$APT_OSTREE_BIN list"
# Test 4: Search packages
run_test "Search Packages" "$APT_OSTREE_BIN search bash"
# Test 5: Show package info
run_test "Show Package Info" "$APT_OSTREE_BIN info bash"
# Test 6: Install packages
run_test "Install Packages" "$APT_OSTREE_BIN install bash coreutils"
# Test 7: List packages (should show installed packages)
run_test "List Packages (After Install)" "$APT_OSTREE_BIN list"
# Test 8: Upgrade system
run_test "Upgrade System" "$APT_OSTREE_BIN upgrade"
# Test 9: Deploy system
run_test "Deploy System" "$APT_OSTREE_BIN deploy --sysroot=$DEPLOY_DIR"
# Test 10: Status after deployment
run_test "Status After Deploy" "$APT_OSTREE_BIN status"
# Test 11: Rollback (should work even if no previous deployment)
run_test "Rollback Command" "$APT_OSTREE_BIN rollback"
# Test 12: Reset command
run_test "Reset Command" "$APT_OSTREE_BIN reset"
# Test 13: Rebase command
run_test "Rebase Command" "$APT_OSTREE_BIN rebase"
# Test 14: Kargs command
run_test "Kargs Command" "$APT_OSTREE_BIN kargs"
# Test 15: Remove packages
run_test "Remove Packages" "$APT_OSTREE_BIN remove wget"
# Test 16: History command
run_test "History Command" "$APT_OSTREE_BIN history"
# Test 17: DB command
run_test "DB Command" "$APT_OSTREE_BIN db"
# Test 18: Initramfs command
run_test "Initramfs Command" "$APT_OSTREE_BIN initramfs"
# Test 19: Reload command
run_test "Reload Command" "$APT_OSTREE_BIN reload"
# Test 20: Checkout command
run_test "Checkout Command" "$APT_OSTREE_BIN checkout"
# Test 21: Prune command
run_test "Prune Command" "$APT_OSTREE_BIN prune"
# Test 22: Compose command
run_test "Compose Command" "$APT_OSTREE_BIN compose"
# Test 23: Override command
run_test "Override Command" "$APT_OSTREE_BIN override"
# Test 24: RefreshMd command
run_test "RefreshMd Command" "$APT_OSTREE_BIN refresh-md"
# Test 25: Apply-live command
run_test "Apply-Live Command" "$APT_OSTREE_BIN apply-live"
# Test 26: Cancel command
run_test "Cancel Command" "$APT_OSTREE_BIN cancel"
# Test 27: Cleanup command
run_test "Cleanup Command" "$APT_OSTREE_BIN cleanup"
# Test 28: Daemon ping
run_test "Daemon Ping" "$APT_OSTREE_BIN daemon-ping"
# Test 29: Help command
run_test "Help Command" "$APT_OSTREE_BIN --help"
# Test 30: Version command
run_test "Version Command" "$APT_OSTREE_BIN --version"
# Print test summary
echo ""
echo "🧪 Test Summary"
echo "=============="
echo "Total tests: $TOTAL_TESTS"
echo "Passed: $PASSED_TESTS"
echo "Failed: $FAILED_TESTS"
if [ $FAILED_TESTS -eq 0 ]; then
print_success "All tests passed! 🎉"
exit 0
else
print_error "Some tests failed. Check the output above for details."
exit 1
fi

View file

@ -1,82 +0,0 @@
#!/bin/bash
# Test apt-ostree Architecture Fix
set -e
echo "=== Testing apt-ostree Architecture Fix ==="
echo
# Check if daemon is running
echo "1. Checking if daemon is running..."
if systemctl is-active --quiet apt-ostreed.service; then
echo "✓ Daemon is running"
else
echo "⚠ Daemon is not running - will test fallback mode"
fi
echo
# Test daemon ping
echo "2. Testing daemon ping..."
if sudo apt-ostree daemon-ping 2>/dev/null; then
echo "✓ Daemon ping successful"
else
echo "⚠ Daemon ping failed - daemon may not be running"
fi
echo
# Test daemon status
echo "3. Testing daemon status..."
if sudo apt-ostree daemon-status 2>/dev/null; then
echo "✓ Daemon status successful"
else
echo "⚠ Daemon status failed - daemon may not be running"
fi
echo
# Test command fallback (without daemon)
echo "4. Testing command fallback (without daemon)..."
if systemctl is-active --quiet apt-ostreed.service; then
echo "Stopping daemon to test fallback..."
sudo systemctl stop apt-ostreed.service
sleep 2
fi
# Test status command fallback
echo "Testing status command fallback..."
if apt-ostree status 2>/dev/null; then
echo "✓ Status command fallback successful"
else
echo "⚠ Status command fallback failed"
fi
echo
# Test search command fallback
echo "Testing search command fallback..."
if apt-ostree search test 2>/dev/null; then
echo "✓ Search command fallback successful"
else
echo "⚠ Search command fallback failed"
fi
echo
# Restart daemon if it was running
echo "5. Restarting daemon if it was previously running..."
if systemctl is-enabled --quiet apt-ostreed.service; then
sudo systemctl start apt-ostreed.service
echo "✓ Daemon restarted"
else
echo "⚠ Daemon not enabled - skipping restart"
fi
echo
echo "=== Architecture Test Complete ==="
echo "Summary:"
echo "- Daemon-based commands should work when daemon is running"
echo "- Commands should fallback to client-only when daemon is unavailable"
echo "- This provides proper rpm-ostree architecture compatibility"

View file

@ -1,271 +0,0 @@
#!/bin/bash
# Test Aurora-style Workflow for apt-ostree
# This script tests our apt-ostree implementation against the Aurora workflow steps
set -e
echo "🦊 Testing apt-ostree Aurora-style Workflow..."
# Configuration
TEST_DIR="/tmp/apt-ostree-aurora-test"
APT_OSTREE_BIN="$(pwd)/target/release/simple-cli"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Create test directory
mkdir -p "$TEST_DIR"
cd "$TEST_DIR"
print_status "Phase I: OS Image Build (Server-Side) Testing..."
# Step 1: Image Definition
print_status "Step 1: Image Definition"
echo "Testing apt-ostree compose commands for image definition..."
# Test compose tree command (like rpm-ostree compose tree)
print_status "Testing compose tree command..."
$APT_OSTREE_BIN compose tree --help
# Test compose build-chunked-oci command (the key rpm-ostree equivalent)
print_status "Testing compose build-chunked-oci command..."
$APT_OSTREE_BIN compose build-chunked-oci --help
# Test compose container-encapsulate command
print_status "Testing compose container-encapsulate command..."
$APT_OSTREE_BIN compose container-encapsulate --help
# Test compose image command
print_status "Testing compose image command..."
$APT_OSTREE_BIN compose image --help
print_success "Step 1: Image Definition commands available"
# Step 2: Image Build
print_status "Step 2: Image Build"
echo "Testing OCI image building capabilities..."
# Test OCI build command
print_status "Testing OCI build command..."
$APT_OSTREE_BIN oci build --help
# Test OCI validation
print_status "Testing OCI validation..."
$APT_OSTREE_BIN oci validate --help
# Test OCI inspection
print_status "Testing OCI inspection..."
$APT_OSTREE_BIN oci inspect --help
print_success "Step 2: Image Build commands available"
# Step 3: Image Push
print_status "Step 3: Image Push"
echo "Testing registry integration..."
# Test OCI push command
print_status "Testing OCI push command..."
$APT_OSTREE_BIN oci push --help
# Test OCI pull command
print_status "Testing OCI pull command..."
$APT_OSTREE_BIN oci pull --help
print_success "Step 3: Image Push/Pull commands available"
print_status "Phase II: OS Deployment (Client-Side) Testing..."
# Test apt-ostree deployment commands
print_status "Testing deployment commands..."
# Test status command
print_status "Testing status command..."
$APT_OSTREE_BIN status
# Test upgrade command
print_status "Testing upgrade command..."
$APT_OSTREE_BIN upgrade --help
# Test rollback command
print_status "Testing rollback command..."
$APT_OSTREE_BIN rollback --help
print_success "Phase II: Deployment commands available"
# Create Containerfile example
print_status "Creating example Containerfile for apt-ostree..."
cat > "$TEST_DIR/Containerfile.example" << 'EOF'
# Example Containerfile for apt-ostree Aurora-style system
FROM ubuntu:22.04
# Install apt-ostree and dependencies
RUN apt-get update && apt-get install -y \
ostree \
apt \
systemd \
curl \
wget \
gnupg \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install desktop environment (example: GNOME)
RUN apt-get update && apt-get install -y \
ubuntu-desktop \
gnome-shell \
gdm3 \
&& rm -rf /var/lib/apt/lists/*
# Configure apt-ostree
RUN mkdir -p /etc/apt-ostree
COPY apt-ostree.conf /etc/apt-ostree/
# Set up bootc compatibility
RUN mkdir -p /usr/lib/bootc
COPY bootc-config.json /usr/lib/bootc/
# Final configuration
RUN systemctl enable gdm3
# Use apt-ostree compose to create bootable image
# This would be done in the build process
CMD ["/usr/bin/apt-ostree", "compose", "build-chunked-oci", "--output", "apt-ostree-system:latest"]
EOF
print_success "Containerfile example created"
# Create apt-ostree configuration example
cat > "$TEST_DIR/apt-ostree.conf.example" << 'EOF'
# apt-ostree configuration for Aurora-style system
[ostree]
repo_path = /ostree/repo
deploy_path = /ostree/deploy
branch = apt-ostree/ubuntu/22.04
[apt]
sources = [
"deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse",
"deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse",
"deb http://archive.ubuntu.com/ubuntu jammy-security main restricted universe multiverse"
]
[compose]
base_packages = [
"ubuntu-minimal",
"systemd",
"ostree"
]
desktop_packages = [
"ubuntu-desktop",
"gnome-shell",
"gdm3"
]
EOF
print_success "apt-ostree configuration example created"
# Create bootc configuration example
cat > "$TEST_DIR/bootc-config.json.example" << 'EOF'
{
"bootc": {
"version": "1.0",
"compatible": true,
"ostree_integration": "apt-ostree",
"package_manager": "apt",
"base_distribution": "ubuntu",
"desktop_environment": "gnome"
},
"apt_ostree": {
"repo_branch": "apt-ostree/ubuntu/22.04",
"package_sources": [
"deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse"
]
}
}
EOF
print_success "bootc configuration example created"
# Create workflow test script
cat > "$TEST_DIR/test-workflow.sh" << 'EOF'
#!/bin/bash
# Test Aurora-style workflow steps
set -e
APT_OSTREE_BIN="./target/release/simple-cli"
TEST_DIR="/tmp/apt-ostree-aurora-test"
echo "🔄 Testing Aurora-style workflow steps..."
# Step 1: Create OSTree commit from packages
echo "Step 1: Creating OSTree commit from packages..."
# $APT_OSTREE_BIN compose tree --packages ubuntu-desktop,gnome-shell --output ostree-commit
# Step 2: Build OCI image from commit
echo "Step 2: Building OCI image from commit..."
# $APT_OSTREE_BIN compose build-chunked-oci --rootfs ostree-commit --output apt-ostree-system:latest
# Step 3: Push to registry
echo "Step 3: Pushing to registry..."
# $APT_OSTREE_BIN oci push apt-ostree-system:latest registry.example.com/apt-ostree/system:latest
# Step 4: Pull from registry (client-side)
echo "Step 4: Pulling from registry..."
# $APT_OSTREE_BIN oci pull registry.example.com/apt-ostree/system:latest
# Step 5: Deploy system
echo "Step 5: Deploying system..."
# $APT_OSTREE_BIN deploy oci://registry.example.com/apt-ostree/system:latest
echo "✅ Aurora-style workflow test completed!"
EOF
chmod +x "$TEST_DIR/test-workflow.sh"
print_success "Workflow test script created"
print_success "Aurora-style workflow testing completed!"
echo ""
echo "🦊 Aurora-style Workflow Test Results:"
echo "✅ Phase I: OS Image Build commands available"
echo " - compose tree (image definition)"
echo " - compose build-chunked-oci (OCI image building)"
echo " - compose container-encapsulate (reproducible images)"
echo " - compose image (treefile to image)"
echo " - oci build/push/pull (registry operations)"
echo ""
echo "✅ Phase II: OS Deployment commands available"
echo " - status (system state)"
echo " - upgrade (system updates)"
echo " - rollback (deployment rollback)"
echo ""
echo "📋 Next Steps:"
echo "1. Test actual OSTree commit creation: $TEST_DIR/test-workflow.sh"
echo "2. Create real Containerfile for apt-ostree system"
echo "3. Test bootc integration with apt-ostree"
echo "4. Validate complete Aurora-style workflow"
echo ""
echo "📁 Test artifacts created in: $TEST_DIR"

View file

@ -1,152 +0,0 @@
#!/bin/bash
# Test script to validate apt-ostree OCI images with bootc compatibility
set -e
echo "🧪 Testing apt-ostree OCI images with bootc compatibility"
echo "========================================================"
# Test 1: Create apt-ostree OCI image
echo "📦 Creating apt-ostree OCI image..."
./target/debug/simple-cli compose build-chunked-oci \
--rootfs /tmp/test-rootfs \
--output test-bootc-apt-ostree \
--bootc \
--max-layers 10
echo "✅ OCI image created successfully"
# Test 2: Validate OCI image structure
echo "🔍 Validating OCI image structure..."
if [ ! -d "test-bootc-apt-ostree" ]; then
echo "❌ OCI image directory not found"
exit 1
fi
if [ ! -f "test-bootc-apt-ostree/index.json" ]; then
echo "❌ OCI index.json not found"
exit 1
fi
if [ ! -d "test-bootc-apt-ostree/blobs" ]; then
echo "❌ OCI blobs directory not found"
exit 1
fi
echo "✅ OCI image structure is valid"
# Test 3: Validate with skopeo
echo "🔍 Validating with skopeo..."
if command -v skopeo >/dev/null 2>&1; then
skopeo inspect oci:test-bootc-apt-ostree > /dev/null
echo "✅ OCI image validated by skopeo"
else
echo "⚠️ skopeo not available, skipping validation"
fi
# Test 4: Check for bootc labels
echo "🏷️ Checking for bootc labels..."
if command -v jq >/dev/null 2>&1; then
BOOTC_BOOTABLE=$(skopeo inspect oci:test-bootc-apt-ostree | jq -r '.Labels["org.bootc.bootable"]')
BOOTC_OSTREE=$(skopeo inspect oci:test-bootc-apt-ostree | jq -r '.Labels["org.bootc.ostree"]')
if [ "$BOOTC_BOOTABLE" = "true" ]; then
echo "✅ org.bootc.bootable label is present and set to true"
else
echo "❌ org.bootc.bootable label is missing or not set to true"
exit 1
fi
if [ "$BOOTC_OSTREE" = "true" ]; then
echo "✅ org.bootc.ostree label is present and set to true"
else
echo "❌ org.bootc.ostree label is missing or not set to true"
exit 1
fi
else
echo "⚠️ jq not available, skipping label validation"
fi
# Test 5: Validate with podman (if available)
echo "🐳 Testing with podman..."
if command -v podman >/dev/null 2>&1; then
podman pull oci:test-bootc-apt-ostree > /dev/null 2>&1
echo "✅ OCI image successfully loaded by podman"
else
echo "⚠️ podman not available, skipping podman test"
fi
# Test 6: Test bootc compatibility (if available)
echo "🚀 Testing bootc compatibility..."
if command -v bootc >/dev/null 2>&1; then
echo "✅ bootc is available"
echo "📋 bootc status:"
bootc status
else
echo "⚠️ bootc not available, skipping bootc test"
fi
# Test 7: Validate OCI schema
echo "📋 Validating OCI schema..."
SCHEMA_VERSION=$(jq -r '.schemaVersion' test-bootc-apt-ostree/index.json)
if [ "$SCHEMA_VERSION" = "2" ]; then
echo "✅ OCI schema version is correct (2)"
else
echo "❌ OCI schema version is incorrect: $SCHEMA_VERSION"
exit 1
fi
# Test 8: Check manifest structure
echo "📄 Checking manifest structure..."
MANIFEST_COUNT=$(jq '.manifests | length' test-bootc-apt-ostree/index.json)
if [ "$MANIFEST_COUNT" -gt 0 ]; then
echo "✅ OCI image has $MANIFEST_COUNT manifest(s)"
else
echo "❌ OCI image has no manifests"
exit 1
fi
# Test 9: Validate media types
echo "🎯 Validating media types..."
MEDIA_TYPE=$(jq -r '.manifests[0].mediaType' test-bootc-apt-ostree/index.json)
if [ "$MEDIA_TYPE" = "application/vnd.oci.image.manifest.v1+json" ]; then
echo "✅ Media type is correct: $MEDIA_TYPE"
else
echo "❌ Media type is incorrect: $MEDIA_TYPE"
exit 1
fi
# Test 10: Check platform information
echo "🖥️ Checking platform information..."
ARCH=$(jq -r '.manifests[0].platform.architecture' test-bootc-apt-ostree/index.json)
OS=$(jq -r '.manifests[0].platform.os' test-bootc-apt-ostree/index.json)
if [ "$ARCH" = "amd64" ]; then
echo "✅ Architecture is correct: $ARCH"
else
echo "❌ Architecture is incorrect: $ARCH"
exit 1
fi
if [ "$OS" = "linux" ]; then
echo "✅ Operating system is correct: $OS"
else
echo "❌ Operating system is incorrect: $OS"
exit 1
fi
echo ""
echo "🎉 All tests passed! apt-ostree OCI images are bootc compatible!"
echo ""
echo "📊 Test Summary:"
echo " ✅ OCI image creation"
echo " ✅ OCI image structure validation"
echo " ✅ skopeo compatibility"
echo " ✅ bootc labels present"
echo " ✅ podman compatibility"
echo " ✅ OCI schema validation"
echo " ✅ manifest structure"
echo " ✅ media types"
echo " ✅ platform information"
echo ""
echo "🚀 apt-ostree is ready for Aurora-style workflow!"

View file

@ -1,18 +0,0 @@
{
"annotations": {
"org.aptostree.created": "2025-07-20T20:31:19.220948370+00:00"
},
"config": {
"digest": "sha256:cf739ea0d53b344f06f7b5a3ff468f8bc4e402f0229c7fa4df612e9bf46a0d5e",
"mediaType": "application/vnd.oci.image.config.v1+json",
"size": 911
},
"layers": [
{
"digest": "sha256:55f5b5c89ee9c11df8855a5bba469bc08793836e4e56479c435b3eeb89001a2b",
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"size": 214
}
],
"schemaVersion": 2
}

View file

@ -1,35 +0,0 @@
{
"architecture": "amd64",
"author": "apt-ostree",
"config": {
"Cmd": null,
"Entrypoint": null,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"ExposedPorts": {},
"Labels": {
"org.aptostree.created": "2025-07-20T20:31:19.220695165+00:00",
"org.bootc.bootable": "true",
"org.bootc.ostree": "true",
"org.opencontainers.image.description": "Image built with apt-ostree",
"org.opencontainers.image.title": "apt-ostree-image"
},
"User": "root",
"Volumes": {},
"WorkingDir": "/"
},
"created": "2025-07-20T20:31:19.220695165+00:00",
"history": [
{
"comment": "Created by apt-ostree",
"created": "2025-07-20T20:31:19.220695165+00:00",
"created_by": "apt-ostree compose build-chunked-oci"
}
],
"os": "linux",
"rootfs": {
"diff_ids": [],
"type": "layers"
}
}

View file

@ -1,17 +0,0 @@
{
"manifests": [
{
"annotations": {
"org.opencontainers.image.ref.name": "latest"
},
"digest": "sha256:46435ac8f1e508a6343c8c62ee63d018542c50575f74b1dac8117704022aa0b0",
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"platform": {
"architecture": "amd64",
"os": "linux"
},
"size": 506
}
],
"schemaVersion": 2
}

View file

@ -1,169 +0,0 @@
#!/bin/bash
# Test bootc compatibility for apt-ostree OCI images
# This script validates that our OCI images are bootc-compatible
set -e
echo "🦊 Testing apt-ostree bootc compatibility..."
# Configuration
APT_OSTREE_BIN="./target/release/simple-cli"
TEST_IMAGE="test-bootc-compat"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Test 1: Create bootc-compatible OCI image
print_status "Test 1: Creating bootc-compatible OCI image..."
$APT_OSTREE_BIN compose build-chunked-oci --from ubuntu:22.04 --bootc --output $TEST_IMAGE:latest
# Test 2: Verify bootc compatibility flag
print_status "Test 2: Verifying bootc compatibility..."
if $APT_OSTREE_BIN compose build-chunked-oci --from ubuntu:22.04 --bootc --output $TEST_IMAGE:latest 2>&1 | grep -q "Bootc compatible: yes"; then
print_success "bootc compatibility flag working"
else
print_error "bootc compatibility flag not working"
exit 1
fi
# Test 3: Test without bootc flag (for comparison)
print_status "Test 3: Creating non-bootc OCI image for comparison..."
$APT_OSTREE_BIN compose build-chunked-oci --from ubuntu:22.04 --output $TEST_IMAGE:no-bootc
# Test 4: Test different base images
print_status "Test 4: Testing with different base images..."
# Test with Debian
print_status " Testing with Debian base..."
$APT_OSTREE_BIN compose build-chunked-oci --from debian:bookworm --bootc --output $TEST_IMAGE:debian
# Test with Ubuntu minimal
print_status " Testing with Ubuntu minimal base..."
$APT_OSTREE_BIN compose build-chunked-oci --from ubuntu:22.04-minimal --bootc --output $TEST_IMAGE:ubuntu-minimal
# Test 5: Test different bootc configurations
print_status "Test 5: Testing different bootc configurations..."
# Test with custom format version
print_status " Testing with custom format version..."
$APT_OSTREE_BIN compose build-chunked-oci --from ubuntu:22.04 --bootc --format-version 2 --output $TEST_IMAGE:format-v2
# Test with custom reference
print_status " Testing with custom reference..."
$APT_OSTREE_BIN compose build-chunked-oci --from ubuntu:22.04 --bootc --reference v1.0.0 --output $TEST_IMAGE:custom-ref
# Test 6: Validate OCI structure (if tools available)
print_status "Test 6: Validating OCI structure..."
if command -v skopeo &> /dev/null; then
print_status " skopeo available - attempting to inspect images..."
# Note: This might fail due to permissions, but we'll try
if skopeo inspect containers-storage:$TEST_IMAGE:latest &> /dev/null; then
print_success "OCI image structure validated with skopeo"
else
print_warning "skopeo inspection failed (expected due to permissions)"
fi
else
print_warning "skopeo not available - skipping OCI structure validation"
fi
# Test 7: Test OCI commands with bootc images
print_status "Test 7: Testing OCI commands with bootc images..."
# Test OCI inspect (even if not implemented, should not crash)
print_status " Testing OCI inspect..."
$APT_OSTREE_BIN oci inspect $TEST_IMAGE:latest
# Test OCI validate (even if not implemented, should not crash)
print_status " Testing OCI validate..."
$APT_OSTREE_BIN oci validate $TEST_IMAGE:latest
# Create summary report
print_status "Creating bootc compatibility report..."
cat > bootc-compatibility-report.txt << EOF
# apt-ostree bootc Compatibility Test Report
## Test Summary
- Date: $(date)
- apt-ostree version: $(./target/release/simple-cli --version 2>/dev/null || echo "version not available")
- Test images created: $TEST_IMAGE:latest, $TEST_IMAGE:debian, $TEST_OSTREE_IMAGE:ubuntu-minimal
## Test Results
### ✅ Test 1: bootc-compatible OCI image creation
- Status: PASSED
- Command: compose build-chunked-oci --bootc
- Result: Successfully created bootc-compatible OCI images
### ✅ Test 2: bootc compatibility flag verification
- Status: PASSED
- Result: bootc compatibility flag working correctly
### ✅ Test 3: Base image compatibility
- Status: PASSED
- Tested: Ubuntu 22.04, Debian bookworm, Ubuntu minimal
- Result: All base images work with bootc flag
### ✅ Test 4: Configuration options
- Status: PASSED
- Tested: Custom format version, custom reference
- Result: Configuration options work with bootc
### ⚠️ Test 5: OCI structure validation
- Status: PARTIAL
- Note: Limited by container permissions
- Result: OCI images created successfully
## Conclusion
apt-ostree successfully creates bootc-compatible OCI images with:
- Proper bootc configuration
- Multiple base image support
- Configurable options
- OCI standard compliance
## Next Steps
To complete bootc compatibility testing:
1. Install bootc in a privileged container
2. Test actual bootc deployment from OCI images
3. Validate bootc workflow integration
4. Test real system boot from apt-ostree images
EOF
print_success "bootc compatibility testing completed!"
echo ""
echo "📋 Test Results:"
echo "✅ bootc-compatible OCI image creation: WORKING"
echo "✅ bootc compatibility flag: WORKING"
echo "✅ Multiple base image support: WORKING"
echo "✅ Configuration options: WORKING"
echo "⚠️ OCI structure validation: LIMITED (permissions)"
echo ""
echo "📄 Report saved to: bootc-compatibility-report.txt"
echo ""
echo "🎯 Next Steps:"
echo "1. Install bootc in privileged container"
echo "2. Test actual bootc deployment"
echo "3. Validate complete Aurora workflow"

View file

@ -1,18 +0,0 @@
{
"annotations": {
"org.aptostree.created": "2025-07-20T20:28:07.917539717+00:00"
},
"config": {
"digest": "sha256:8c9b7bd5dafa92c665508a03b0a9b1e8bec6e36d33487cfacaf927b58078bc74",
"mediaType": "application/vnd.oci.image.config.v1+json",
"size": 911
},
"layers": [
{
"digest": "sha256:55f5b5c89ee9c11df8855a5bba469bc08793836e4e56479c435b3eeb89001a2b",
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"size": 214
}
],
"schemaVersion": 2
}

View file

@ -1,35 +0,0 @@
{
"architecture": "amd64",
"author": "apt-ostree",
"config": {
"Cmd": null,
"Entrypoint": null,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"ExposedPorts": {},
"Labels": {
"org.aptostree.created": "2025-07-20T20:28:07.917176971+00:00",
"org.bootc.bootable": "true",
"org.bootc.ostree": "true",
"org.opencontainers.image.description": "Image built with apt-ostree",
"org.opencontainers.image.title": "apt-ostree-image"
},
"User": "root",
"Volumes": {},
"WorkingDir": "/"
},
"created": "2025-07-20T20:28:07.917176971+00:00",
"history": [
{
"comment": "Created by apt-ostree",
"created": "2025-07-20T20:28:07.917176971+00:00",
"created_by": "apt-ostree compose build-chunked-oci"
}
],
"os": "linux",
"rootfs": {
"diff_ids": [],
"type": "layers"
}
}

View file

@ -1,17 +0,0 @@
{
"manifests": [
{
"annotations": {
"org.opencontainers.image.ref.name": "latest"
},
"digest": "sha256:0987de77977350be20f2796160ac3626b92f3f1b2fc16b42d4f64445575b66d2",
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"platform": {
"architecture": "amd64",
"os": "linux"
},
"size": 506
}
],
"schemaVersion": 2
}

View file

@ -1,171 +0,0 @@
#!/bin/bash
echo "=== Testing apt-ostree OCI Image Building ==="
echo
# Check if we have the binary
if [ ! -f "./target/release/simple-cli" ]; then
echo "❌ simple-cli binary not found. Building..."
cargo build --release
if [ $? -ne 0 ]; then
echo "❌ Build failed"
exit 1
fi
fi
echo "✅ Found simple-cli binary"
# Check if we have OSTree
if ! command -v ostree &> /dev/null; then
echo "❌ ostree not found. Installing..."
sudo apt update && sudo apt install -y ostree
fi
echo "✅ Found ostree: $(ostree --version | head -1)"
# Create a test OSTree repository
echo ""
echo "1. Creating test OSTree repository..."
TEST_REPO="/tmp/test-apt-ostree-repo"
rm -rf "$TEST_REPO"
mkdir -p "$TEST_REPO"
ostree init --repo="$TEST_REPO" --mode=archive-z2
if [ $? -ne 0 ]; then
echo "❌ Failed to initialize OSTree repository"
exit 1
fi
echo "✅ Created test repository at $TEST_REPO"
# Create a simple test commit
echo ""
echo "2. Creating test commit..."
TEST_CHECKOUT="/tmp/test-checkout"
rm -rf "$TEST_CHECKOUT"
mkdir -p "$TEST_CHECKOUT"
# Create some test content
echo "Hello from apt-ostree OCI test" > "$TEST_CHECKOUT/test.txt"
mkdir -p "$TEST_CHECKOUT/etc"
echo "Test configuration" > "$TEST_CHECKOUT/etc/test.conf"
mkdir -p "$TEST_CHECKOUT/usr/bin"
echo '#!/bin/bash' > "$TEST_CHECKOUT/usr/bin/test-script"
echo 'echo "Test script executed"' >> "$TEST_CHECKOUT/usr/bin/test-script"
chmod +x "$TEST_CHECKOUT/usr/bin/test-script"
# Commit to OSTree
ostree commit --repo="$TEST_REPO" --branch=test/oci/integration --subject="Test commit for OCI integration" "$TEST_CHECKOUT"
if [ $? -ne 0 ]; then
echo "❌ Failed to create test commit"
exit 1
fi
COMMIT_ID=$(ostree rev-parse --repo="$TEST_REPO" test/oci/integration)
echo "✅ Created test commit: $COMMIT_ID"
# Test OCI build command
echo ""
echo "3. Testing OCI image building..."
# Try to build OCI image
OUTPUT_IMAGE="/tmp/test-image.oci"
echo "Building OCI image: $OUTPUT_IMAGE"
# Since our CLI might not be fully working, let's test the OCI module directly
echo "Testing OCI module compilation..."
cargo test --lib oci --no-run
if [ $? -eq 0 ]; then
echo "✅ OCI module compiles successfully"
else
echo "❌ OCI module compilation failed"
exit 1
fi
# Try to use the CLI if available
echo ""
echo "4. Testing CLI OCI commands..."
# Test if the CLI has OCI commands
if ./target/release/simple-cli --help 2>/dev/null | grep -q "oci"; then
echo "✅ CLI has OCI commands"
# Try to build an image
echo "Attempting to build OCI image..."
./target/release/simple-cli oci build --source test/oci/integration --output "$OUTPUT_IMAGE" --format oci --repo "$TEST_REPO"
if [ $? -eq 0 ]; then
echo "✅ Successfully built OCI image: $OUTPUT_IMAGE"
# Check if the image was created
if [ -d "$OUTPUT_IMAGE" ]; then
echo "✅ OCI image directory created"
ls -la "$OUTPUT_IMAGE"
fi
else
echo "⚠️ CLI OCI build failed (expected - implementation in progress)"
fi
else
echo "⚠️ CLI OCI commands not available yet"
fi
# Test compose build-image command
echo ""
echo "5. Testing compose build-image command..."
if ./target/release/simple-cli --help 2>/dev/null | grep -q "compose"; then
echo "✅ CLI has compose commands"
# Try compose build-image
echo "Attempting compose build-image..."
./target/release/simple-cli compose build-image test/oci/integration "$OUTPUT_IMAGE" --format oci --repo "$TEST_REPO"
if [ $? -eq 0 ]; then
echo "✅ Successfully built image via compose: $OUTPUT_IMAGE"
else
echo "⚠️ Compose build-image failed (expected - implementation in progress)"
fi
else
echo "⚠️ CLI compose commands not available yet"
fi
# Test with skopeo if available
echo ""
echo "6. Testing with skopeo..."
if command -v skopeo &> /dev/null; then
echo "✅ Found skopeo: $(skopeo --version | head -1)"
# If we have an image, try to inspect it
if [ -d "$OUTPUT_IMAGE" ]; then
echo "Inspecting OCI image with skopeo..."
skopeo inspect "oci:$OUTPUT_IMAGE"
if [ $? -eq 0 ]; then
echo "✅ Successfully inspected OCI image"
else
echo "⚠️ Failed to inspect OCI image"
fi
fi
else
echo "⚠️ skopeo not found - install with: sudo apt install skopeo"
fi
# Cleanup
echo ""
echo "7. Cleanup..."
rm -rf "$TEST_CHECKOUT"
echo "✅ Cleaned up test checkout"
echo ""
echo "=== Test Summary ==="
echo "✅ OSTree repository created and populated"
echo "✅ Test commit created: $COMMIT_ID"
echo "✅ OCI module compiles successfully"
echo "⚠️ CLI OCI commands need implementation"
echo "⚠️ Compose build-image needs implementation"
echo ""
echo "Next steps:"
echo "1. Implement CLI OCI commands"
echo "2. Implement compose build-image functionality"
echo "3. Test with real OSTree environments"
echo "4. Validate OCI image output"

Binary file not shown.

104
test-debian-build.sh Executable file
View file

@ -0,0 +1,104 @@
#!/bin/bash
# Test Debian Package Build for apt-ostree
# This script tests the debian packaging locally before CI/CD
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
print_header() {
echo ""
echo -e "${BLUE}================================${NC}"
echo -e "${BLUE}$1${NC}"
echo -e "${BLUE}================================${NC}"
}
print_header "Testing apt-ostree Debian Package Build"
# Check if we're in the right directory
if [ ! -f "Cargo.toml" ]; then
print_error "Cargo.toml not found. Please run this script from the project root."
exit 1
fi
if [ ! -d "debian" ]; then
print_error "debian/ directory not found. Please ensure Debian packaging files are present."
exit 1
fi
# Check prerequisites
print_status "Checking prerequisites..."
for cmd in cargo rustc dpkg-buildpackage; do
if ! command -v $cmd &> /dev/null; then
print_error "$cmd not found. Please install required build tools."
exit 1
fi
done
print_success "All prerequisites found"
# Clean previous builds
print_status "Cleaning previous builds..."
rm -rf debian/cargo target/release *.deb ../*.deb
print_success "Cleanup completed"
# Test cargo build
print_status "Testing cargo build..."
cargo build --release
print_success "Cargo build successful"
# Test debian package build
print_status "Testing debian package build..."
dpkg-buildpackage -us -uc -b
print_success "Debian package build successful"
# Check for built packages
print_status "Checking built packages..."
if ls -1 ../*.deb 2>/dev/null | grep -q apt-ostree; then
print_success "apt-ostree package found"
ls -la ../*.deb
else
print_error "No apt-ostree package found"
exit 1
fi
# Test package installation (optional)
read -p "Do you want to test package installation? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
print_status "Testing package installation..."
sudo dpkg -i ../apt-ostree_*.deb
sudo apt-get install -f -y
# Test installed binary
if command -v apt-ostree &> /dev/null; then
print_success "apt-ostree installed successfully"
apt-ostree --version
else
print_error "apt-ostree not found after installation"
exit 1
fi
fi
print_header "Test Complete!"
print_success "Debian package build test passed!"
print_status "Ready for CI/CD deployment"

View file

@ -1,18 +0,0 @@
{
"annotations": {
"org.aptostree.created": "2025-07-20T19:23:06.993126529+00:00"
},
"config": {
"digest": "sha256:cc13a38bce02086083ed688c23c9b9b8f7ade4280b25b56471b5a5893cfabe45",
"mediaType": "application/vnd.oci.image.config.v1+json",
"size": 911
},
"layers": [
{
"digest": "sha256:55f5b5c89ee9c11df8855a5bba469bc08793836e4e56479c435b3eeb89001a2b",
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"size": 214
}
],
"schemaVersion": 2
}

View file

@ -1,35 +0,0 @@
{
"architecture": "amd64",
"author": "apt-ostree",
"config": {
"Cmd": null,
"Entrypoint": null,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"ExposedPorts": {},
"Labels": {
"org.aptostree.created": "2025-07-20T19:23:06.992903221+00:00",
"org.bootc.bootable": "true",
"org.bootc.ostree": "true",
"org.opencontainers.image.description": "Image built with apt-ostree",
"org.opencontainers.image.title": "apt-ostree-image"
},
"User": "root",
"Volumes": {},
"WorkingDir": "/"
},
"created": "2025-07-20T19:23:06.992903221+00:00",
"history": [
{
"comment": "Created by apt-ostree",
"created": "2025-07-20T19:23:06.992903221+00:00",
"created_by": "apt-ostree compose build-chunked-oci"
}
],
"os": "linux",
"rootfs": {
"diff_ids": [],
"type": "layers"
}
}

View file

@ -1,17 +0,0 @@
{
"manifests": [
{
"annotations": {
"org.opencontainers.image.ref.name": "latest"
},
"digest": "sha256:99f761b7b4c4b78c53866dd282ae8841c138bd0331f3da88b898a0599ff65563",
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"platform": {
"architecture": "amd64",
"os": "linux"
},
"size": 506
}
],
"schemaVersion": 2
}

View file

@ -1,8 +0,0 @@
{
"source": "debian/stable",
"packages": ["vim", "git"],
"metadata": {
"name": "test-image",
"version": "1.0.0"
}
}

View file

@ -1,161 +0,0 @@
#!/bin/bash
# Test OCI Integration for apt-ostree
# This script tests the rpm-ostree style OCI integration capabilities
set -e
echo "🐳 Testing apt-ostree OCI Integration (rpm-ostree style)..."
# Configuration
TEST_DIR="/tmp/apt-ostree-oci-test"
APT_OSTREE_BIN="./target/release/simple-cli"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if we're in a safe environment
if [ -f /.dockerenv ] || grep -q docker /proc/1/cgroup; then
print_status "Running in container environment - safe to proceed"
else
print_warning "Running on host system - be careful with system operations"
fi
# Create test directory
mkdir -p "$TEST_DIR"
cd "$TEST_DIR"
print_status "Testing rpm-ostree style OCI integration..."
# Test 1: OCI Image Building (like rpm-ostree compose build-chunked-oci)
print_status "Test 1: OCI Image Building"
echo "Testing apt-ostree oci build command structure..."
$APT_OSTREE_BIN oci build --help
# Test 2: OCI Registry Integration (like rpm-ostree rebase ostree-unverified-registry:)
print_status "Test 2: OCI Registry Integration"
echo "Testing apt-ostree oci push/pull commands..."
$APT_OSTREE_BIN oci push --help
$APT_OSTREE_BIN oci pull --help
# Test 3: OCI Image Inspection (like skopeo inspect)
print_status "Test 3: OCI Image Inspection"
echo "Testing apt-ostree oci inspect command..."
$APT_OSTREE_BIN oci inspect --help
# Test 4: OCI Image Validation
print_status "Test 4: OCI Image Validation"
echo "Testing apt-ostree oci validate command..."
$APT_OSTREE_BIN oci validate --help
# Test 5: OCI Image Conversion
print_status "Test 5: OCI Image Conversion"
echo "Testing apt-ostree oci convert command..."
$APT_OSTREE_BIN oci convert --help
# Test 6: Compose with OCI Output (like rpm-ostree compose build-chunked-oci)
print_status "Test 6: Compose with OCI Output"
echo "Testing apt-ostree compose image command..."
$APT_OSTREE_BIN compose image --help
# Test 7: Integration with Container Tools
print_status "Test 7: Integration with Container Tools"
if command -v podman &> /dev/null; then
print_success "podman available for integration testing"
podman --version
else
print_warning "podman not available - OCI integration testing limited"
fi
if command -v skopeo &> /dev/null; then
print_success "skopeo available for image inspection"
skopeo --version
else
print_warning "skopeo not available - image inspection testing limited"
fi
# Test 8: Bootable Container Support (bootc)
print_status "Test 8: Bootable Container Support"
echo "Testing apt-ostree oci build with bootc support..."
$APT_OSTREE_BIN oci build --help | grep -i boot || echo "No explicit bootc support found in help"
# Create test OCI workflow script
print_status "Creating OCI workflow test script..."
cat > "$TEST_DIR/test-oci-workflow.sh" << 'EOF'
#!/bin/bash
# Test OCI Workflow (rpm-ostree style)
set -e
APT_OSTREE_BIN="./target/release/simple-cli"
TEST_DIR="/tmp/apt-ostree-oci-test"
echo "🔄 Testing OCI Workflow..."
# Step 1: Create OSTree commit (like rpm-ostree compose rootfs)
echo "Step 1: Creating OSTree commit..."
# This would normally create an OSTree commit from packages
echo "(Mock: Creating OSTree commit from packages)"
# Step 2: Build OCI image from commit (like rpm-ostree compose build-chunked-oci)
echo "Step 2: Building OCI image from commit..."
# $APT_OSTREE_BIN oci build ostree://test-commit oci://test-image:latest
echo "(Mock: Building OCI image from OSTree commit)"
# Step 3: Push to registry (like podman push)
echo "Step 3: Pushing to registry..."
# $APT_OSTREE_BIN oci push oci://test-image:latest registry.example.com/apt-ostree/test:latest
echo "(Mock: Pushing to registry)"
# Step 4: Pull from registry (like rpm-ostree rebase ostree-unverified-registry:)
echo "Step 4: Pulling from registry..."
# $APT_OSTREE_BIN oci pull registry.example.com/apt-ostree/test:latest
echo "(Mock: Pulling from registry)"
# Step 5: Deploy from OCI image
echo "Step 5: Deploying from OCI image..."
# $APT_OSTREE_BIN deploy oci://registry.example.com/apt-ostree/test:latest
echo "(Mock: Deploying from OCI image)"
echo "✅ OCI workflow test completed!"
EOF
chmod +x "$TEST_DIR/test-oci-workflow.sh"
print_success "OCI integration testing completed!"
echo ""
echo "🐳 OCI Integration Test Results:"
echo "✅ OCI build commands available"
echo "✅ OCI push/pull commands available"
echo "✅ OCI inspect/validate commands available"
echo "✅ Compose with OCI output available"
echo "✅ Container tool integration ready"
echo ""
echo "📋 Next Steps for rpm-ostree style integration:"
echo "1. Implement actual OSTree commit creation"
echo "2. Implement OCI image building from commits"
echo "3. Add registry authentication support"
echo "4. Add bootc compatibility"
echo "5. Test with real container registries"
echo ""
echo "🔄 Run workflow test: $TEST_DIR/test-oci-workflow.sh"

View file

@ -1,59 +0,0 @@
#!/bin/bash
# Test OCI Integration
set -e
echo "=== Testing apt-ostree OCI Integration ==="
echo
# Check if we can build the project
echo "1. Building apt-ostree..."
if cargo build --release; then
echo "✓ Build successful"
else
echo "✗ Build failed"
exit 1
fi
echo
# Test compose build-image command
echo "2. Testing compose build-image command..."
if ./target/release/apt-ostree compose build-image --help 2>/dev/null; then
echo "✓ Build-image command available"
else
echo "✗ Build-image command not available"
fi
echo
# Test compose create command (dry run)
echo "3. Testing compose create command (dry run)..."
if ./target/release/apt-ostree compose create --base ubuntu:24.04 --dry-run 2>/dev/null; then
echo "✓ Compose create command working"
else
echo "✗ Compose create command failed"
fi
echo
# Test compose list command
echo "4. Testing compose list command..."
if ./target/release/apt-ostree compose list 2>/dev/null; then
echo "✓ Compose list command working"
else
echo "✗ Compose list command failed"
fi
echo
echo "=== OCI Integration Test Complete ==="
echo "Summary:"
echo "- OCI module implemented and integrated"
echo "- Build-image subcommand available"
echo "- Ready for real OSTree environment testing"
echo
echo "Next steps:"
echo "1. Test with real OSTree commits"
echo "2. Validate OCI image output"
echo "3. Test registry integration"

View file

@ -1,18 +0,0 @@
{
"annotations": {
"org.aptostree.created": "2025-07-20T20:23:57.611718907+00:00"
},
"config": {
"digest": "sha256:57eddc5980880f08aaf697f800360ed7d06fcb31ebf44333cdf7185a2a7705ec",
"mediaType": "application/vnd.oci.image.config.v1+json",
"size": 911
},
"layers": [
{
"digest": "sha256:55f5b5c89ee9c11df8855a5bba469bc08793836e4e56479c435b3eeb89001a2b",
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"size": 214
}
],
"schemaVersion": 2
}

View file

@ -1,35 +0,0 @@
{
"architecture": "amd64",
"author": "apt-ostree",
"config": {
"Cmd": null,
"Entrypoint": null,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"ExposedPorts": {},
"Labels": {
"org.aptostree.created": "2025-07-20T20:23:57.611560281+00:00",
"org.bootc.bootable": "true",
"org.bootc.ostree": "true",
"org.opencontainers.image.description": "Image built with apt-ostree",
"org.opencontainers.image.title": "apt-ostree-image"
},
"User": "root",
"Volumes": {},
"WorkingDir": "/"
},
"created": "2025-07-20T20:23:57.611560281+00:00",
"history": [
{
"comment": "Created by apt-ostree",
"created": "2025-07-20T20:23:57.611560281+00:00",
"created_by": "apt-ostree compose build-chunked-oci"
}
],
"os": "linux",
"rootfs": {
"diff_ids": [],
"type": "layers"
}
}

View file

@ -1,17 +0,0 @@
{
"manifests": [
{
"annotations": {
"org.opencontainers.image.ref.name": "latest"
},
"digest": "sha256:57e090b16d8c8dc4d5f6354bfdb82cf3b1d990df90a0b087153d5e346aac1aae",
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"platform": {
"architecture": "amd64",
"os": "linux"
},
"size": 506
}
],
"schemaVersion": 2
}

View file

@ -1,62 +0,0 @@
{
"base": "ubuntu:24.04",
"packages": [
"vim",
"git",
"curl",
"wget"
],
"remove_packages": [
"snapd"
],
"repos": [
{
"name": "main",
"url": "http://archive.ubuntu.com/ubuntu",
"components": ["main", "universe"],
"enabled": true
}
],
"filesystem": {
"rootfs": "/var/lib/apt-ostree/rootfs",
"staging": "/var/lib/apt-ostree/staging",
"cache": "/var/lib/apt-ostree/cache",
"preserve_permissions": true,
"preserve_timestamps": true,
"enable_hardlinks": true
},
"metadata": {
"commit_subject": "Test compose with vim, git, curl, wget",
"commit_body": "Added development tools to Ubuntu 24.04 base",
"author": "apt-ostree <test@example.com>",
"version": "1.0.0",
"labels": {
"compose.type": "development",
"compose.base": "ubuntu:24.04"
}
},
"postprocess": {
"enabled": true,
"scripts": [],
"environment": {
"COMPOSE_TYPE": "development"
}
},
"container": {
"name": "test-compose",
"tag": "latest",
"architecture": "amd64",
"os": "linux",
"entrypoint": ["/bin/bash"],
"cmd": ["-c", "echo 'Hello from apt-ostree compose!'"],
"env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"working_dir": "/",
"user": "root",
"labels": {
"org.opencontainers.image.title": "apt-ostree test compose",
"org.opencontainers.image.description": "Test compose with development tools"
}
}
}

View file

@ -1,47 +0,0 @@
base: "ubuntu:24.04"
packages:
- vim
- git
- curl
- wget
remove_packages:
- snapd
repos:
- name: main
url: "http://archive.ubuntu.com/ubuntu"
components: [main, universe]
enabled: true
filesystem:
rootfs: "/var/lib/apt-ostree/rootfs"
staging: "/var/lib/apt-ostree/staging"
cache: "/var/lib/apt-ostree/cache"
preserve_permissions: true
preserve_timestamps: true
enable_hardlinks: true
metadata:
commit_subject: "Test compose with vim, git, curl, wget"
commit_body: "Added development tools to Ubuntu 24.04 base"
author: "apt-ostree <test@example.com>"
version: "1.0.0"
labels:
compose.type: development
compose.base: "ubuntu:24.04"
postprocess:
enabled: true
scripts: []
environment:
COMPOSE_TYPE: development
container:
name: test-compose
tag: latest
architecture: amd64
os: linux
entrypoint: ["/bin/bash"]
cmd: ["-c", "echo 'Hello from apt-ostree compose!'"]
env:
- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
working_dir: "/"
user: root
labels:
org.opencontainers.image.title: "apt-ostree test compose"
org.opencontainers.image.description: "Test compose with development tools"