Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy individual services from a monorepo using github actions

I have around 10 individual micro-services which are mostly cloud functions for various data processing jobs, which all live in a single github repository.

The goal is to trigger the selective deployment of these service to Google Cloud Functions, on push to a branch - when an individual function has been updated.

I must avoid the situation in which update of a single service causes the deployment of all the cloud functions.

My current repository structure:

/repo --/service_A ----/function ----/notebook --/service_B ----/function ----/notebook 

On a side note, what are the pros/cons of using Github Actions VS Google Cloud Build for such automation?

like image 591
dendog Avatar asked Sep 27 '19 14:09

dendog


People also ask

Is Git good for monorepo?

Git ProjectsManaging a monorepo at scale in Git would never work. As the repository gets bigger, a monorepo in Git becomes a huge problem. So if you have teams using Git, it's best to have multiple repositories. Another Git challenge is that Git lacks security.

Is monorepo good for Microservices?

A monorepo removes barriers and silos between teams, making it easier to design and maintain sets of microservices that work well together. Standardization. With monorepos, it is easier to standardize code and tooling across the teams.


1 Answers

GitHub Actions supports monorepos with path filtering for workflows. You can create a workflow to selectively trigger when files on a specific path change.

https://help.github.com/en/articles/workflow-syntax-for-github-actions#onpushpull_requestpaths

For example, this workflow will trigger on a push when any files under the path service_A/ have changed (note the ** glob to match files in nested directories).

on:   push:     paths:       - 'service_A/**' 
like image 136
peterevans Avatar answered Oct 11 '22 12:10

peterevans