First off, thanks for taking the time to contribute! 🎉
This document provides guidelines and best practices for contributing to the Buildkite plugin for Backstage. Following these guidelines helps communicate that you respect the time of the developers managing and developing this project.
- Code of Conduct
- Getting Started
- Development Process
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation
This project follows the Backstage Code of Conduct. By participating, you are expected to uphold this code.
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/backstage-plugin.git
- Install dependencies:
yarn install
- Create a branch for your changes:
git checkout -b feature/your-feature-name
-
Start the development server:
yarn start
-
Make your changes following our coding standards
-
Test your changes:
yarn test yarn lint -
Build the plugin to verify production readiness:
yarn build
-
Update the README.md with details of significant changes to the interface or functionality
-
Ensure all tests pass and add new tests for new functionality
-
Update all relevant documentation
-
Follow the PR template when submitting your pull request
-
The PR must receive approval from at least one maintainer
-
Ensure your PR title follows Conventional Commits:
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that don't affect the meaning of the code
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests or correcting existing tests
- chore: Changes to the build process or auxiliary tools
- Follow the existing TypeScript configuration
- Maintain type safety; avoid using
any - Use TypeScript's strict mode features
- Document complex types with JSDoc comments
- Use functional components with hooks
- Follow React best practices for performance
- Maintain proper component organization
- Use proper prop typing
- Implement error boundaries where appropriate
- Use Material-UI's styling solutions (
makeStyles,styled) - Follow existing theme conventions
- Use responsive design principles
- Maintain consistency with Backstage's design system
Our project follows this structure:
src/
├── api/ # API clients and interfaces
│ ├── BuildkiteAPI.ts # API interface definitions
│ ├── BuildkiteClient.ts # API implementation
│ ├── Types.ts # API-specific types
│ └── index.ts # API exports
├── components/ # React components
│ ├── BuildPage/ # Example component structure
│ │ ├── BuildPage.tsx # Component implementation
│ │ └── index.ts # Component exports
│ └── ... # Other components follow same pattern
├── hooks/ # Custom React hooks
│ └── useBuildkiteApi.ts # Buildkite API hook
├── state/ # State management
│ ├── useBuilds.ts # Build state management
│ └── usePipelines.ts # Pipeline state management
├── plugin.ts # Plugin definition and configuration
├── plugin.test.ts # Plugin tests
├── routes.ts # Route definitions
├── utils.ts # Utility functions
├── setupTests.ts # Test configuration
└── index.ts # Public plugin exports
When contributing new features:
- Place new API-related code in the
api/directory - Add new components in
components/following the established pattern:- Each component gets its own directory
- Include a main component file (e.g.,
ComponentName.tsx) - Include an
index.tsfor exports - Add tests if applicable
- Place shared types in the appropriate
Types.tsfile - Add new hooks in
hooks/or state management instate/ - Update exports in relevant
index.tsfiles
- Write tests for all new functionality
- Follow the existing test patterns
- Use meaningful test descriptions
- Test both success and failure cases
- Mock external dependencies appropriately
describe('ComponentName', () => {
it('should render successfully', () => {
// Test implementation
});
it('should handle errors appropriately', () => {
// Test implementation
});
});- Test component integration points
- Verify API interactions
- Test routing functionality
- Verify plugin registration
We provide several testing utilities:
import {
setupRequestMockHandlers,
renderInTestApp,
} from "@backstage/test-utils";- Document all public APIs
- Use JSDoc comments for complex functions
- Include usage examples where appropriate
- Document known limitations or edge cases
- Document component props
- Include usage examples
- Document any required context or setup
- Note any performance considerations
When making significant changes:
- Update the features section if adding new functionality
- Update installation instructions if changing dependencies
- Update configuration examples if changing options
- Add any new troubleshooting items
All contributions go through a review process:
- Code review by maintainers
- CI checks must pass
- Documentation review
- Testing verification
If you need help, you can:
- Open an issue with a detailed description
- Tag your PR with "help wanted" or "question"
- Comment on your PR with specific questions
Thank you for contributing to the Buildkite Plugin for Backstage! 🚀