Writing Tasks for Tekton Hub
TOC
Overview
This guide covers the specific requirements and best practices for creating Tasks that work with Tekton Hub catalogs. It focuses on Hub-specific metadata, validation, and standards.
Tekton Hub Requirements
Task vs ClusterTask
⚠️ CRITICAL:
ClusterTaskis DEPRECATED and REMOVED inTekton Pipelinesv1.0+. Do NOT useClusterTask.
Task: The ONLY supported resource type forHubcatalogsClusterTask: ❌ REMOVED inTektonv1.0+ - will not work
Migration from ClusterTask
Hub-Specific Metadata
Required Labels
Required Annotations for Hub
Hub Parameter Standards
Parameter Types
Tekton Hub supports three parameter types:
- string: Single text value (default)
- array: List of string values
- object: JSON object with key-value pairs
Hub-Specific Parameter Requirements
- Clear Descriptions: All parameters must have meaningful descriptions for
HubUI - Sensible Defaults: Provide defaults where possible for better user experience
- Type Safety: Use appropriate types to prevent runtime errors
Hub Best Practices
Container Image Requirements
- Use official, trusted container images
- Pin specific versions instead of
latesttags - Ensure images work on supported platforms (
linux/amd64,linux/arm64) - Regularly update base images for security
Results and Workspaces for Hub
- Results: Must have clear descriptions for Hub documentation
- Workspaces: Mark optional workspaces as
optional: true - Descriptions: Required for all workspaces and results
Hub Categories and Tags
Standard Categories
- Build Tools
- Testing
- Deployment
- Security
- Integration & Delivery
- Developer Tools
- Code Quality
Effective Tagging
- Use specific, searchable tags
- Include technology names (
podman,kubernetes,npm, etc.) - Add use case tags (ci, cd, build, test, deploy)
Hub Validation Requirements
Error Handling Standards
- Use proper exit codes (0 for success, non-zero for failure)
- Provide clear error messages for
Hubusers - Include structured logging for better debugging
Security for Hub Tasks
Hub Security Requirements
- No hardcoded secrets in
Taskdefinitions - Use trusted, official container images
- Pin specific image versions (no
latesttags) - Follow minimal privilege principles
- Document any special security requirements
Hub Testing Requirements
Required Test Files
- Provide working
samples/directory with TaskRun examples - Include
run.yamldemonstrating typical usage - Test all parameter combinations
- Validate error handling scenarios
Hub Validation Checklist
- Required Hub metadata present
- Sample TaskRun works correctly
- All parameters documented with descriptions
- Results and workspaces properly described
- Security best practices followed
- Platform compatibility verified
Hub Task Template
Documentation Requirements
Hub Documentation Standards
- Include comprehensive
README.mdin task directory - Document all parameters, workspaces, and results
- Provide usage examples and common use cases
- Include troubleshooting information
Hub Publishing Checklist
✅ Hub Compliance
- Required Hub metadata (labels and annotations) present
- Task uses
Taskresource type (not ClusterTask) - Version label matches directory structure
- All parameters and results have descriptions
- Container images use pinned versions
- Platform compatibility specified
- Working sample TaskRun provided
- Complete README with usage examples
- Passes Hub validation requirements
✅ Quality Standards
- Task is idempotent and reusable
- Error handling with proper exit codes
- No hardcoded secrets or credentials
- Security best practices followed
- Cross-platform compatibility verified
- Documentation is complete and accurate