Hello! I’m currently trying to optimize the build process for my company; however, I have a few kinks that I would want to solve. If anyone has any better suggestions that the way I’m planning on doing it, then please feel free!
Our current build process consists of IaC spread among 5 different repos:
- aws-{service}-build-setup
- aws-{service}-build-api
- aws-{service}-build-services
- aws-{service}-build-infrastructure
- aws-{service}-build-images
We perform pull requests each time a build is changed. We have a branch for each separate environment: prod, dev, qa. Each time an environment is changed, we make sure to update its respective branch, from a pull request, to trigger the build process. If the developers made changes in their Dev branch in their applications, we may have to build another lambda, service, etc. in our build process. So, we create a new branch, such as dev-update, and merge the changes into the dev branch for whichever respective build repo. This works well, as it enforces only specific infrastructure to be built- instead of building all the infrastructure again.
I want to condense the build process into something like this:
Repo: aws-service-build (dev branch.. prod / qa will look similar)
/.circleci
- config.yml
/setup
- builder.json (Cloudformation template) - manual build
/api
- aws_deploy.sh
- api.json
/services
- aws_deploy.sh
- services.json
/infrastructure
- aws_deploy.sh
- infrastructure.json
/images
- aws_deploy.sh (Only needs to perform an api call)
Then, I want to have a config.yml
file that contains the specific build jobs for whichever build. So:
version: 2
jobs:
build:
- run: |
# How to check if a specific build was changed in the repo?
# I don't want Circle to run /services if the latest pull request
# didn't make modifications to it.
# Or, should I run just use an API Trigger? And manually call?
buildApi:
- run: ./api/aws_deploy.sh
buildServices:
- run: ./services/aws_deploy.sh
As stated in the comments though, how could I use Circle to potentially know what was changed in the repo to only build the specific IaC that was modified? I was thinking a combination of using an env variable provided by Circle and Github’s api to view what was modified-- but I’m not even sure of how that would look.
Any ideas would be greatly appreciated-- sorry for the long question!