Day 81: First Pipeline & GitLab Runners

Today was an exciting step forward in my CI/CD journey with GitLab!

πŸ”‘ What I did today:

  • βœ… Learned about GitLab Runners (shared vs. specific)

  • βœ… Configured a runner for my project

  • βœ… Wrote my first GitLab CI/CD pipeline (.gitlab-ci.yml)

  • βœ… Successfully ran jobs using the runner πŸŽ‰

πŸ›  Key Takeaways

  • GitLab Runners are the backbone of CI/CD in GitLab. They pick up jobs defined in the pipeline and execute them.

  • There are two main types:

    • Shared Runners: Available for all projects.

    • Specific Runners: Tied to a particular project or group.

  • The .gitlab-ci.yml file is where the pipeline magic happens – defining stages like build, test, and deploy.

    Pipeline code:

      stages:
          - build
          - test
    
      build_job:
          stage: build
          script:
            - echo "This is a build stage from  gitlab for building a docker image command is <docker build -t .>"
      test_job:
          stage: test
          script:
            - echo "This is a test stage from gitlab for testing a docker images"
            - mkdir -p logs
            - echo "this is logs from test job" 
         test_deploy_task:
          stage: test
          script:
          - echo "this job is running in parallel"
    

πŸ“Œ Why this matters

Understanding runners and pipelines is crucial because it’s the foundation of automation in GitLab CI/CD. From here, I’ll move toward building more advanced pipelines with testing, artifact handling, and deployment.


πŸ”₯ Up next: Setting up advanced stages in my GitLab pipelines!

0
Subscribe to my newsletter

Read articles from Shaharyar Shakir directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shaharyar Shakir
Shaharyar Shakir