Middle
How did you set up the CI/CD pipeline in GitLab?
sobes.tech AI
Answer from AI
To set up a CI/CD pipeline in GitLab, I created a .gitlab-ci.yml file in the root of the repository, where I described the stages and jobs. For example:
stages:
- build
- test
- deploy
build_job:
stage: build
script:
- echo "Building project..."
- python setup.py install
test_job:
stage: test
script:
- pytest tests/
deploy_job:
stage: deploy
script:
- echo "Deploying to production..."
only:
- main
In this file, I defined the sequence of stages, commands to execute, and conditions for running (for example, deploying only from the main branch). I also configured runners for executing tasks and integrated with external services (such as Docker Registry or Kubernetes) for automatic deployment.