Thank you for your interest in contributing to Docker FaaS! This document provides guidelines and instructions for contributing.
- Code of Conduct
- How to Contribute
- Development Setup
- Coding Standards
- Testing
- Pull Request Process
- Reporting Issues
We are committed to providing a welcoming and inclusive environment for all contributors.
- Be respectful and professional
- Welcome constructive feedback
- Focus on what is best for the community
- Show empathy towards others
We welcome:
- Bug Reports - Help us identify and fix issues
- Feature Requests - Suggest new features or improvements
- Code Contributions - Submit pull requests for bugs or features
- Documentation - Improve or add to documentation
- Testing - Write tests or test new features
- Reviews - Review pull requests from other contributors
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
- Go 1.21 or later
- Docker 20.10+
- Docker Compose
- Make
- Git
# Clone your fork
git clone https://github.com/YOUR_USERNAME/docker-faas.git
cd docker-faas
# Add upstream remote
git remote add upstream https://github.com/docker-faas/docker-faas.git
# Install dependencies
make install-deps
# Build the project
make build
# Run tests
make test# Start the gateway
go run ./cmd/gateway
# Or use docker-compose
docker-compose upFollow the official Go Code Review Comments.
- Clarity over Cleverness - Write clear, readable code
- DRY - Don't Repeat Yourself
- KISS - Keep It Simple, Stupid
- Error Handling - Always handle errors appropriately
- Comments - Comment on "why", not "what"
# Format code
make fmt
# Run linter
make lint
# Run vet
make vetpkg/
├── config/ # Configuration management
├── gateway/ # HTTP handlers
├── middleware/ # HTTP middleware
├── metrics/ # Prometheus metrics
├── provider/ # Docker provider
├── router/ # Request routing
├── store/ # Database layer
└── types/ # Type definitions
- Packages: lowercase, single word
- Files: lowercase with underscores
- Types: PascalCase
- Functions: PascalCase (exported) or camelCase (private)
- Variables: camelCase
- Constants: PascalCase or SCREAMING_SNAKE_CASE
Good:
// GetFunction retrieves a function by name
func (s *Store) GetFunction(name string) (*types.FunctionMetadata, error) {
if name == "" {
return nil, fmt.Errorf("function name is required")
}
// ...
}Bad:
func (s *Store) get_function(n string) (*types.FunctionMetadata, error) {
// ...
}- Write unit tests for all new code
- Maintain or improve code coverage
- Use table-driven tests where appropriate
- Mock external dependencies
func TestFunctionName(t *testing.T) {
t.Run("DescriptiveTestName", func(t *testing.T) {
// Arrange
input := "test"
// Act
result, err := FunctionUnderTest(input)
// Assert
assert.NoError(t, err)
assert.Equal(t, expected, result)
})
}# Run all tests
make test
# Run with coverage
make coverage
# Run specific package
go test ./pkg/store/...
# Run integration tests
make integration-test- Aim for >80% code coverage
- Critical paths should have 100% coverage
- View coverage report:
make coverage
-
Update your fork:
git fetch upstream git rebase upstream/main
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes:
- Write code following style guidelines
- Add tests for new functionality
- Update documentation if needed
-
Run checks:
make fmt make vet make test -
Commit your changes:
git add . git commit -m "Add feature: description"
Follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Test additions or changesrefactor: Code refactoringperf: Performance improvementschore: Build process or auxiliary tool changes
Examples:
feat(gateway): add support for async invocations
Add new endpoint for async function invocations using queue.
Functions can now be invoked asynchronously with callback URLs.
Closes #123
fix(provider): handle container cleanup on scale down
Previously, scaling down would leave orphaned containers.
Now properly removes excess containers when scaling.
Fixes #456
-
Push to your fork:
git push origin feature/your-feature-name
-
Open a Pull Request on GitHub
-
Fill out the PR template completely
-
Link related issues
-
Wait for review
- Automated Checks: CI must pass
- Code Review: At least one maintainer approval required
- Testing: Verify tests pass locally and in CI
- Documentation: Ensure docs are updated
- Merge: Maintainers will merge when approved
# Make changes based on feedback
git add .
git commit -m "Address review comments"
git push origin feature/your-feature-nameUse the bug report template and include:
- Description: Clear description of the bug
- Steps to Reproduce: Detailed steps
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Environment: OS, Docker version, etc.
- Logs: Relevant log output
Use the feature request template and include:
- Problem: What problem does this solve?
- Solution: Proposed solution
- Alternatives: Alternative solutions considered
- Additional Context: Any other relevant info
Do NOT open public issues for security vulnerabilities.
Email security@docker-faas.io with:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
main: Stable, production-ready codedevelop: Integration branch for featuresfeature/*: New featuresbugfix/*: Bug fixeshotfix/*: Urgent production fixes
- Create release branch from
develop - Update version numbers
- Update CHANGELOG
- Test thoroughly
- Merge to
mainand tag - Merge back to
develop
- Open a Discussion
- Join our community chat (coming soon)
- Check existing Issues
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Docker FaaS! 🎉