Skip to content

Migrate automation source code from deploy repo - #3

Merged
malhotra5 merged 2 commits into
mainfrom
migrate-source-code
Mar 20, 2026
Merged

malhotra5 merged 2 commits into
mainfrom
migrate-source-code

Conversation

@malhotra5

@malhotra5 malhotra5 commented Mar 20, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR migrates the automation service source code from the deploy repository to this dedicated repository, following the same pattern used by the main OpenHands project.

Changes

Source Code

  • Complete automation FastAPI service (automation/)
  • Scheduler for cron-based automations
  • Dispatcher for running pending automation jobs
  • SQLAlchemy models and Pydantic schemas
  • Utility functions for cron parsing and time handling

Infrastructure

  • Docker: Added containers/Dockerfile for building the automation image
  • CI: Added .github/workflows/ghcr-build.yml for building and pushing Docker images to ghcr.io/openhands/automation
  • Migrations: Added Alembic database migrations

Dependencies

  • Updated pyproject.toml with all production dependencies:
    • FastAPI, SQLAlchemy, Pydantic
    • asyncpg, pg8000 for PostgreSQL
    • cloud-sql-python-connector for GCP Cloud SQL
    • croniter for cron parsing
    • alembic for migrations

Tests

  • Full test suite for all components
  • Updated test workflow to run tests from tests/ directory

Documentation

  • Updated README with comprehensive documentation
  • Development setup instructions
  • Docker build instructions

Migration Plan

This is part of a larger effort to:

  1. ✅ Move source code to this repo (this PR)
  2. 🔲 Update deploy repo to reference images from this repo
  3. 🔲 Remove source code from deploy repo

Docker Image

After this PR is merged, Docker images will be automatically built and pushed to:

  • ghcr.io/openhands/automation:main (on push to main)
  • ghcr.io/openhands/automation:sha-<commit> (all builds)
  • ghcr.io/openhands/automation:<version> (on tags)

Related to APP-1001

- Add complete automation source code (FastAPI service)
- Add scheduler and dispatcher for cron-based automations
- Add SQLAlchemy models and Alembic migrations
- Add Docker build workflow for GHCR (ghcr.io/openhands/automation)
- Add Dockerfile in containers/ directory
- Update pyproject.toml with all production dependencies
- Update tests with full test suite
- Update README with comprehensive documentation

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

github-actions Bot commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py10100% 
app.py713353%28, 31, 34–35, 37, 40, 43–45, 48–49, 52, 59–60, 63, 70–71, 73, 76–77, 80, 84–92, 94–96
auth.py49589%37, 70, 107, 115–116
config.py250100% 
db.py382728%28–29, 31–32, 34, 42, 53–55, 59, 61–62, 66–67, 75, 77–78, 84, 96, 101, 104–110
dispatcher.py47980%87–88, 120–121, 133–134, 146, 148, 150
logger.py531866%25–26, 36, 46–47, 49–55, 68, 88, 90–93
models.py420100% 
router.py693253%49–50, 70, 72, 75, 77, 91, 104, 106–108, 110–111, 114–116, 127–129, 147–150, 169, 172, 175, 182, 184, 208–210, 214
scheduler.py57984%124–125, 162–163, 178–179, 189–190, 192
schemas.py111991%64–66, 68, 132–133, 136, 141, 146
utils
   __init__.py30100% 
   cron.py45686%39, 45, 74, 80, 123, 140
   run.py240100% 
   time.py30100% 
TOTAL63814876% 

@linear

linear Bot commented Mar 20, 2026

Copy link
Copy Markdown
APP-1001 [Phase 1c] Extract Automations Service into separate repo + Helm chart

Overview

Once the MVP is validated end-to-end in the deploy repo, extract the automations service into its own repo (OpenHands/automations) with independent CI/CD.

Scope

  • Create OpenHands/automations repo with extracted code
  • Dockerfile + Docker image build (ghcr.io/openhands/automations)
  • Helm chart (Deployment, Service, health probes, resource limits)
  • GitHub Actions CI/CD (build, test, push image)
  • Update OpenHands/deploy to reference the new chart/image instead of in-repo code
  • Environment-specific values (staging, production) in deploy repo

Testing Criteria

  • docker build . produces a working image
  • pip install -e . installs all dependencies in the new repo
  • All unit and API tests pass in the new repo's CI
  • helm template renders Deployment with correct image, env vars, health probes, resource limits
  • helm template renders ClusterIP Service pointing to the Deployment
  • Templates are gated by .Values.automationService.enabled
  • Service deploys to staging via Helm and communicates with SaaS V1 API
  • All MVP functionality (CRUD, scheduler, fire logic) still works after extraction
  • CI pipeline builds image and pushes to GHCR on merge to main

Dependencies

  • Depends on Phase 1 MVP being validated in deploy repo

References

- Fix line too long issues in logger.py, schemas.py, test_auth.py
- Use StrEnum instead of (str, Enum) for RunStatus
- Apply ruff formatting to all Python files
- Apply yamlfmt to workflow files

Co-authored-by: openhands <openhands@all-hands.dev>
@malhotra5
malhotra5 marked this pull request as ready for review March 20, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants