Search code examples
gitasp.net-coreteamcitycicd

Deploy Single Code Base To Multiple Clients


In my company there's an application repository that we would want to deploy to multiple clients. Each client have different application configuration values (appsettings.json) and this settings may change overtime depending on the clients. That is why, we create different git branches for each client in order to do CICD. There are multiple TeamCity Servers located in each client server (on premise) which are listening to their git branch for changes. Our concern is these number of clients will grow. The number of git branches will also increase and we do not want that to happen.

Note: Each client have their own staging and production environment. So we created the branch name as "clientA-staging", "clientA-production", "clientB-staging", "clientB-production". Another reason why we did this is because, if there is a changes in a client configuration. We just want to deploy this changes to that client only.

Are there any ways that we can improve this? What we want to achieve are:-

  1. Reduce and maintain the number of staging and production git branches to two branches only.
  2. Deploy to specific client only if there is configuration changes on their side.

Solution

  • I've managed to solve this by setting a comment filter in TeamCity (git commit message). By configuring the filter with for example "[clientA]", the deployment will only trigger if git comments matches the filter. In this case, it will only deploy to Client A.