Assignment 5
Assignment 5
Date: 29-11-2024
BATCH ID -2737877
Overview
This document provides a step-by-step guide to crea ng a mul -stage CI/CD pipeline in GitLab. It includes se ng up
your GitLab project, configuring the .gitlab-ci.yml file, and verifying pipeline execu on.
o Once the project is created, navigate to the Repository sec on in the le -hand menu.
2. Crea ng the .gitlab-ci.yml File
prepare:
stage: prepare
script:
- echo "Star ng the pipeline"
- echo "Prepare stage completed!"
build:
stage: build
script:
- echo "Building the applica on..."
- echo "Hello, World! from the build stage"
test:
stage: test
script:
- echo "Running tests..."
- echo "Hello, World! from the test stage"
deploy:
stage: deploy
script:
- echo "Deploying the applica on..."
- echo "Hello, World! from the deploy stage"
cleanup:
stage: cleanup
script:
- echo "Cleaning up resources..."
- echo "Pipeline execu on completed successfully!"
o Choose the branch where the .gitlab-ci.yml file was commi ed (usually main) and click Run Pipeline.
o Once the pipeline starts, you’ll see the stages (Prepare, Build, Test, Deploy, Cleanup) listed in the Pipelines
sec on.
2. Inspect Logs:
o Click on the failed stage in the Pipelines sec on to view error logs.
o Edit the .gitlab-ci.yml file to fix any issues. o Commit the changes to automa cally retry the pipeline.
6. Conclusion
By following these steps, you can successfully set up a mul -stage CI/CD pipeline in GitLab. This pipeline helps automate
key stages such as prepara on, building, tes ng, deployment, and cleanup. Use the pipeline logs to debug and refine your
workflow as needed.