Skip to content

DevOps

Stop Clicking Buttons: Automate Gemini Fine-Tuning with GitHub Actions

The Google Cloud Console is great for exploration. But when you're experimenting with Gemini fine-tuning, manual clicking becomes a bottleneck.

If you need to iterate on training data—testing different examples, adjusting epochs, tuning hyperparameters—clicking through the Console UI to upload datasets and launch training jobs doesn't scale. Do it once? Fine. Do it ten times while iterating? Painful.

The solution: a fire-and-forget MLOps pipeline. Push a new training.jsonl to GitHub, and the rest happens automatically—data upload, job submission, training. No clicks, no manual API calls, just git push.

Why Automate Fine-Tuning?

Fine-tuning Gemini models can improve performance on domain-specific tasks, but the iteration process is tedious when done manually. Experimenting with different training datasets, epoch counts, and hyperparameters requires multiple training runs. Automating this workflow lets you iterate quickly without manual Console work—whether you're testing fine-tuning feasibility or running production jobs.

Self-Hosting Jenkins CI/CD with Docker: A $6/Month Alternative

GitHub Actions is fantastic. It's a popular choice for Continuous Integration—push code, run tests, merge PR. But as any experienced engineer eventually discovers, it has its limits.

Maybe you have a complex web scraper that runs for 4 hours. Maybe you need to run model post-training jobs that exceed the 6-hour timeout. Maybe you have a scheduled task that requires a persistent file system. Or maybe you're just tired of debugging opaque YAML files that fail silently on obscure timeouts.

I found myself needing to supplement my GitHub Actions workflow with something more robust for scheduled operations. I wanted the Hybrid Strategy: let GitHub handle the PR checks, but move the heavy, long-running, and custom scheduled jobs to a dedicated server I control.

In this post, I'll walk through how I deployed a production-ready, containerized Jenkins server on DigitalOcean for the price of a fancy coffee.

The Hybrid CI/CD Philosophy

This isn't about replacing GitHub Actions—it's about complementing it. Use GitHub Actions for what it does best: PR checks, testing, and short-lived workflows. Use self-hosted Jenkins for:

  • Stateful jobs that need to remember data from the last run
  • Heavy cron jobs that would eat through free-tier minutes
  • Long-running processes like model post-training or data pipelines that exceed GitHub's 6-hour timeout
  • Debugging flexibility where you can SSH in to investigate issues

6 Lessons Learned Deploying FastAPI to Google Cloud Run

I built starter-fastapi, a deployment-ready starter template for bootstrapping high-performance Python APIs. As developers, we often spend the first few days of a new project just wiring things together—setting up the database, configuring the linter, wrangling Docker, and figuring out the CI/CD pipeline.

My goal: move faster and save tokens by not having AI assistants recreate boilerplate from scratch on every project. The result is a template pre-packaged with modern best practices like SQLModel, uv, Ruff, and a complete, automated deployment pipeline.

Why Google Cloud Run?

I could have simplified this by deploying to Vercel, Render, or other platform-as-a-service providers. I chose Google Cloud Run because it aligns with my long-term goals: automating deployments of MCP servers and AI agents to Cloud Run and Vertex AI Agent Engine. The ultimate objective is building a workflow where agents can automatically create and deploy new agents.

Similarly, Cloud Run can deploy directly from GitHub repositories. I chose GitHub Actions to gain hands-on experience with CI/CD automation, which will be essential for more complex agent deployment workflows.

While the local development experience was smooth, automating the deployment to Google Cloud Run using GitHub Actions revealed several nuances. It's one thing to deploy from your laptop; it's significantly more complex to configure automated deployments that run securely and reliably. Here are the 6 key lessons I learned during the process, which I hope will save you some debugging time.

GitHub CLI Essentials

The GitHub CLI (gh) brings GitHub's pull requests, issues, releases, and workflows straight into your terminal so you can stay in flow without leaving the command line.