Skip to content

GitLab Pipelines

GitLab Pipelines provide a powerful solution for continuous integration and deployment (CI/CD) within your GitLab environment. This guide explains how to use GitLab Pipelines to build and deploy Martini packages, and also how you can deploy your Martini packages bundled with a Docker image of the latest version of Martini Runtime.

Overview

GitLab Pipelines allow you to automate the build and deployment of Martini packages directly from your GitLab repository and to build Docker images with the latest Martini Runtime bundled with your packages. The provided code is designed to be easily integrated with your GitLab CI/CD workflows.

Steps to Configure GitLab Pipelines

  1. Access the GitLab Pipelines Code: The configuration code for GitLab Pipelines is available on Lonti's GitLab account. You can access it here. The code is public and can be invoked directly by your GitLab Pipeline.

  2. Reference the Code in Your Pipeline: Clone or fork the repository from GitLab:

    1
    git clone git@gitlab.com:lonti/martini-build-pipeline.git
    
    Follow the instructions provided in the repository to integrate the code with your GitLab CI/CD configuration. This typically involves copying the .gitlab-ci.yml file into your own repository.

  3. Configure Your Pipeline: Adjust the pipeline configuration to fit your repository and deployment needs. This includes setting up any necessary environment variables, secrets, or custom build commands. Make sure to set up these 5 variables in your repository to ensure smooth deployment with your pipelines:

Variable Usage
MARTINI_USER_NAME Username of the Martini user on the instance
MARTINI_PASSWORD User's password
MARTINI_URL The URL of the Martini instance where artifacts will be uploaded
MR_VERSION The version of the runtime image which the Docker pulls
CI_REGISTRY_IMAGE The registry URL where the Docker image will be pushed after building
  1. Deploy Packages: Once configured, GitLab Pipelines will automatically handle the build and deployment of your Martini packages according to the specified pipeline configuration.

  2. Build Docker image: If you want to leverage the Docker CI/CD Pipeline, make sure to configure and add your Dockerfile in your Gitlab repository. Here's a sample Dockerfile to use with Martini Runtime:

1
2
3
4
5
6
ARG MR_VERSION
FROM toroio/martini-runtime:${MR_VERSION}

COPY packages /data/packages
WORKDIR /data
ENTRYPOINT ["sh", "/data/bin/toro-martini"]

If your Dockerfile is included in your GitLab repository, the pipeline will automatically manage all the build steps. Once the image is created, you can retrieve it from the container registry for use.

You can read more about it on our README for Gitlab Pipelines.

Additional Resources