I work for a small-sized company that develops and actively maintains around 40 microservices, >90% of them being simple java-based apps using Spring. Once the docker images get built, the resulting image:tag is replaced in the corresponding Kubernetes deployment and a rollout restart is performed.
Our build system is Gradle with kotlin syntax. The main issue we are facing right now is that there is no shared functionality being used/leveraged, we have 4-5 gradle files that contain custom implementations of various steps in the build process that are just manually copy-pasted in each product repository, such as:
- docker-utils.gradle (custom functions for building with docker)
- deployment-utils.gradle (custom functions for deploying with kubernetes)
- artifact-utils.gradle (custom functions for deploying artefacts to Nexus)
As you can already see, this is the worst thing imaginable in terms of code reusability and efficiency.
I want to develop a custom company-wide (specific to the way we build, tag and deploy products) gradle plugin while also reusing existing/popular open-source gradle plugins (such as docker plugin, deploy plugin, kubernetes plugin, etc.) Ideally, I want to call only 1 gradle task that will build the docker image, scan it and deploy it on a particular kubernetes cluster. The kubernetes deployment is 99% the same structure between all microservices, so any tips on reusing that as well is welcome.