0

I currently have a frontend and a backend repo. Each has a simple and basic workflow to test, build and upload the built files to my AWS S3 and AWS ECR. I am comfortable with this current workflow but I wanted to complete my CI/CD pipeline so I also created an IaC repo that creates AWS resources and deploys the latest commit of my frontend and backend repos.

This is the flow for my GitHub Actions:

frontend

On push to master --> test --> build --> upload the build files to AWS S3 --> release

backend

On push to master --> test --> build --> upload image to AWS ECR --> release

My AWS CDK repo (IaC) is triggered manually by myself. The missing part of my CI/CD pipeline is the trigger to my IaC when either my frontend or backend repo publishes/releases successfully.

I was thinking of either using AWS Codebuild or just doing it all on GitHub Actions (but I don't have a clue where to start).

Azeem
  • 11,148
  • 4
  • 27
  • 40
joyfuljoy
  • 25
  • 5
  • Here's one possible solution: Maintain versions in files on the IaC repo e.g. `frontend.version` and `backend.version`. On a new release (from any of the repo), clone IaC repo, update the respective version file, commit and push. That should trigger the build on the IaC repo. – Azeem Jan 24 '23 at 16:37
  • my IaC repo does the checking of latest commit of frontend and backend by getting the latest githash from s3 but this still requires manual trigger from myself. Or perhaps you are telling to have my IaC repo have a github workflow which detects release on my other repo? because I still haven't got to that point. – joyfuljoy Jan 24 '23 at 16:45
  • Or you are suggesting that the frontend and backend workflow will trigger the IaC? because I thought IaC should be the one triggering itself via on: repository_dispatch ? – joyfuljoy Jan 24 '23 at 16:48
  • The latter, trigger from `frontend` and `backend`. That's one solution. But, [repository_dispatch](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch) seems to be much better. – Azeem Jan 24 '23 at 16:55
  • Yeah... if the trigger comes from the frontend and backend I will need to have my frontend and backend repo to know the existence of my IaC repo... but if I trigger from the IaC repo itself I would just need to dictate what repo of mine should I detect. But I am still torn because there might be more elegant and simple solution... – joyfuljoy Jan 24 '23 at 17:03
  • IIUC, `repository_dispatch` will be configured on the IaC repo, and the front-/backend repos will [trigger](https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-dispatch-event) that after a release. If IaC repo needs to do it itself, that should be some kind of polling e.g. cron job. – Azeem Jan 24 '23 at 17:08
  • yes , we have the same understanding I may have worded it wrong but the repository_dispatch will be on IaC github workflow so in my head I feel like it is listening on my frontend/backend repo but it really just frontend/backend repo triggering my IaC. – joyfuljoy Jan 24 '23 at 17:23
  • Right. Yes, you may perceive it like that too. – Azeem Jan 24 '23 at 17:37

0 Answers0