Skip to main content

Key Concepts of GitLab CI/CD

  • Pipelines: Automated processes that you define in your repository.
  • Stages: Groups of jobs that run sequentially (e.g., build, test, deploy).
  • Jobs: Tasks that run in parallel within a stage.
  • Scripts: Commands that run in the job’s environment.
  • Runners: Servers that execute the jobs in your pipeline.

Adding a GitLab CI/CD Pipeline to Your Repository

Create a .gitlab-ci.yml File:

  • Create a .gitlab-ci.yml file in the root directory of your repository.
  • Use YAML syntax to define your pipeline.
Breakdown:
  • stages: The stages that will run as part of the pipeline.
  • variables: Environment variables for your pipeline.
  • llm-experiment-job: The name of the job that will run.
  • stage: Specifies which stage the job belongs to.
  • image: The Docker image to use for the job.
  • only: Conditions that determine when the job will run.
  • script: Commands to run in the job.
  • artifacts: Files to save after the job completes.

Common only Event Options:

  1. Merge Requests: Triggers the pipeline when a merge request is created or updated.
  1. Specific Branches: Triggers the pipeline when code is pushed to specific branches.
  1. Changes to Specific Files: Triggers the pipeline when specific files are changed.
  1. Scheduled Pipelines: Triggers the pipeline on a scheduled time.
  1. Tags: Triggers the pipeline when a tag is created.
  1. Combining Multiple Conditions: You can combine multiple conditions for more granular control.