GitLab CI/CD Discovery

Set up microservices discovery in your GitLab CI/CD pipelines.


This feature is currently in early adopter release and may not be available to all users.


If your organization uses GitLab as a platform for hosting code repositories, you can establish an automated process for microservices discovery by configuring GitLab CI/CD pipelines. Automated discovery ensures consistent updates and accurate representation of microservices within your system.


Before you start, prepare the following:

  • A YAML manifest file
  • A relevant Python script

To learn how to create a YAML file and a Python script, see Microservice Discovery Through a Manifest File.

Configuring Your GitLab CI/CD Pipeline

The GitLab CI/CD pipeline outlined in this guide is designed to automatically update your microservices on each push or merge request to the main branch. This ensures your microservice fact sheets are consistently updated with the latest changes. The pipeline includes the following steps:

  1. Checking out your code
  2. Setting up Python
  3. Installing the necessary Python dependencies
  4. Invoking the LeanIX service discovery Python helper

To set up this pipeline, create or update your .gitlab-ci.yml file in your repository root.

The following YAML script outlines the pipeline:

  - update_microservice

  image: python:3.12
    - pip install --upgrade pip
    - pip install requests pyyaml
    - python
    - main

By automating these steps, you not only streamline your microservice discovery process but also ensure accuracy and consistency in your microservice fact sheets.