A macOS application for monitoring Jenkins build status using Clean Architecture principles.
JenkinsTray is a native macOS application that connects to Jenkins CI/CD servers to display build information in a clean, organized interface. The application follows Domain-Driven Design (DDD) and Clean Architecture principles to ensure maintainability and testability.
The application is structured into four distinct layers:
Contains the core business logic and domain models:
Entities/: Domain entities likeBuild,BuildStage, andJenkinsCredentialsRepositories/: Repository protocols defining data access contracts
Contains application-specific logic and use cases:
UseCases/: Application use cases that orchestrate domain operations
Contains external dependencies and adapters:
Network/: HTTP client and DTOs for Jenkins API communicationRepositories/: Concrete repository implementationsStorage/: Keychain-based credential storage
Contains the SwiftUI user interface:
Views/: SwiftUI views for displaying build informationCoordinator/: App coordinator for managing state and navigation
- Build Monitoring: Display list of completed Jenkins builds with status indicators
- Build Details: View detailed information including build stages and timing
- Real-time Updates: Refresh build data on demand
- Status Filtering: Filter builds by status (Success, Failure, Unstable)
- Sorting Options: Sort builds by build number or date
- Browser Integration: Open builds directly in web browser
- Secure Authentication: Support for Jenkins API tokens and Basic Auth
- macOS 13.0+
- Swift 6.0+
- Jenkins server with REST API access
The application connects to Jenkins at https://build.w-w.top/job/test-app/job/main by default. To use different Jenkins instances:
- Modify the credentials in
JenkinsTrayApp.swift - Update the job path in
JenkinsBuildsRepository.init()
# Build the application
swift build
# Run the application
swift run
# Build for release
swift build -c release
# Run tests
swift testThe application is configured to connect to Jenkins at https://build.w-w.top/job/test-app/job/main.
To modify the Jenkins server URL, update the credentials in Sources/JenkinsTray/main.swift:
let buildsRepository = JenkinsBuildsRepository(
credentials: JenkinsCredentials.anonymous(baseURL: URL(string: "YOUR_JENKINS_URL")!)
)- β Build Monitoring: Display list of completed Jenkins builds
- β Build Details: View detailed information including build stages
- β Real-time Updates: Refresh build data on demand
- β Status Filtering: Filter builds by status (Success, Failure, Unstable)
- β Sorting Options: Sort builds by build number or date
- β Browser Integration: Open builds directly in web browser
- β Color Coding: Visual status indicators (green/red/yellow/gray)
- β Error Handling: Network and authentication error handling
- β Clean Architecture: Domain-Driven Design with layered architecture
The application integrates with Jenkins REST API endpoints:
GET /job/{job}/api/json- Fetch job buildsGET /job/{job}/{build}/wfapi/describe- Fetch build stages
- Credentials are stored securely in macOS Keychain
- API tokens are preferred over passwords
- Network requests use HTTPS with proper authentication
This project follows Clean Architecture principles:
- Dependency Inversion: High-level modules don't depend on low-level modules
- Single Responsibility: Each module has one reason to change
- Open/Closed: Modules are open for extension but closed for modification
- Interface Segregation: Clients depend only on methods they use
- Dependency Injection: Dependencies are injected rather than created internally
The application includes comprehensive test coverage:
- Unit tests for domain logic
- Integration tests for infrastructure adapters
- UI tests for critical user flows
Run tests with:
swift testWhen contributing to this project:
- Follow the established architecture patterns
- Add tests for new functionality
- Update documentation as needed
- Ensure code compiles and tests pass
This project is licensed under the MIT License.