Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug Report
about: Report a bug in the Tekton task or Python script
title: '[BUG] '
labels: bug
assignees: ''
---

## Description

<!-- A clear description of the bug -->

## Steps to Reproduce

1.
2.
3.

## Expected Behavior

<!-- What you expected to happen -->

## Actual Behavior

<!-- What actually happened -->

## Environment

- OCP/Kubernetes version:
- Tekton version:
- OPM version:

## Logs

<!-- Relevant logs or error messages -->

```
paste logs here
```
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature Request
about: Suggest a new feature or enhancement
title: '[FEATURE] '
labels: enhancement
assignees: ''
---

## Description

<!-- A clear description of the feature you'd like -->

## Use Case

<!-- Why is this feature needed? What problem does it solve? -->

## Proposed Solution

<!-- How might this be implemented? -->

## Alternatives Considered

<!-- Any alternative solutions or features you've considered -->
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Summary

<!-- Describe the changes in this PR -->

## Related Issues

<!-- Link to related issues: Fixes #123 -->

## Testing

- [ ] Tests added/updated
- [ ] All tests pass (`pytest`)

## Checklist

- [ ] Code follows project conventions
- [ ] Documentation updated if needed
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
.venv/
venv/
ENV/

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/
.nox/

# IDE
.idea/
.vscode/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# AgentReady reports
.agentready/
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
81 changes: 81 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# iib-tekton-utils

Tekton task for building multi-architecture Operator Index Images (IIB) using Python orchestration with buildah.

## What This Does

Builds container images for OLM file-based catalogs across multiple architectures (amd64, arm64, ppc64le, s390x), generates OPM cache, and pushes multi-arch manifest lists.

## Tech Stack

- Python 3.9+ (orchestration)
- Tekton Tasks (Kubernetes CI/CD)
- Buildah (container builds)
- OPM (Operator Package Manager)
- pytest (testing)

## Key Files

- `task/iib-image-builder-oci-ta/iib-image-builder-oci-ta.yaml` - Tekton Task definition
- `task/iib-image-builder-oci-ta/multi-arch-builder.py` - Python build orchestrator
- `Containerfile.iib-build-task` - Container image for the build task
- `pyproject.toml` - Project config and test dependencies

## Directory Structure

```
task/iib-image-builder-oci-ta/ # Tekton task + Python script
tests/
conftest.py # Shared fixtures, module loader for hyphenated filename
unit/test_multi_arch_builder.py # Unit tests for Python script
tekton/test_iib_image_builder_task.py # YAML structure validation
.github/workflows/ # CI workflows
```

## Commands

```bash
# Install test dependencies
pip install ".[test]"

# Run all tests
pytest

# Run unit tests only
pytest tests/unit/

# Run Tekton task validation tests only
pytest tests/tekton/

# Single-file lint (fast feedback)
ruff check task/iib-image-builder-oci-ta/multi-arch-builder.py

# Single-file type check
mypy task/iib-image-builder-oci-ta/multi-arch-builder.py

# Build container image
buildah build -f Containerfile.iib-build-task -t iib-build-task:latest .

# Setup pre-commit hooks
pip install pre-commit && pre-commit install
```

## Pattern References

- **Adding a new Tekton parameter**: Follow pattern in `task/iib-image-builder-oci-ta/iib-image-builder-oci-ta.yaml:17-58`
- **Adding retry logic**: See `_build_image()` at multi-arch-builder.py:271 for tenacity decorator pattern
- **Adding a new test class**: Follow `TestRunCmd` pattern in tests/unit/test_multi_arch_builder.py:66

## Architecture Notes

- `MultiArchBuilder` class in multi-arch-builder.py:201 orchestrates the build
- `generate_cache_locally()` at :144 runs OPM to create FBC cache
- Retry logic via tenacity for buildah operations (:271, :365)
- Exception hierarchy: `IIBBaseException` > `IIBError`, `ExternalServiceError`
- Tests use `conftest.py` to load hyphenated `multi-arch-builder.py` via importlib

## Test Coverage

- Unit tests mock all subprocess/filesystem calls (no container runtime needed)
- Tekton tests validate YAML structure with pyyaml (no cluster needed)
- Key fixtures: `build_config`, `builder` (conftest.py:46, :62)
1 change: 1 addition & 0 deletions CLAUDE.md
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Pinned dependencies for reproducible builds
# Generated from pyproject.toml

# Runtime dependencies
tenacity==8.2.3

# Test dependencies
pytest==8.2.1
pytest-mock==3.14.0
PyYAML==6.0.1