GitLab CI: Spring boot dependecy on another project

3/12/2020

I have a clustered application architecture, where 3 of my primary services make use of a dependency artifact (lets call it commons) that contains the modal files and other utils used by other 3 services.

Presently, I have all the 3 spring boot applications deployed on k8s through Gitlab CI via artifactory for image management.

Now, each time I make changes to my commons service, I have to change the version of the commons in pom.xml(so that it doesn't conflict with the previous artifactory image) and also change the pom versions of my other 3 services that depend on this new version and push all the 4 (first push commons so that the new build image is available in artifactory, and then the other 3) services.

Is there a better way to manage this. I would have preferred if, my 3 services where able to fetch the latest common version and add it to my pom version

-- MhnCodes
devops
gitlab
gitlab-ci
kubernetes
spring-boot

1 Answer

3/19/2020

This is currently supported in Reliza Hub (disclaimer: I'm developing the project).

The workflow to get latest release is documented here (see workflow 2.Get Latest Release Of A Project Or Product).

Idea is the following:

  1. you define project for your Shared Library and configure from GitLab CI to automatically stream build metadata to Reliza Hub on every build using Reliza Client.
  2. Automatic versioning can also be maintained via Reliza Hub (meaning that Hub would increment versions for you on every build based on your chosen versioning schema) - you need to use getversion command of Reliza Client for that.
  3. You can then use this automatic version increments to update version in your pom.xml at build time. So this process will be fully automated.
  4. Once that is done, in your CI pipelines for each of the 3 dependent services, you include call to Reliza Hub using getlatestrelease command of Reliza Client for your shared library. This call will return you back all metadata for the latest release of shared library, including its version.
  5. You can then plug this version into pom files of your dependent services.

Hope this helps.

-- taleodor
Source: StackOverflow