Sobes.tech
Intern

What are jobs?

sobes.tech AI

Answer from AI

In the context of CI/CD, a job is a sequence of steps or tasks executed on one or more agents (runners) to achieve a specific goal within a pipeline. Jobs can run in parallel or sequentially, depending on the pipeline configuration.

Examples of tasks within a job:

  • Code compilation
  • Running tests (unit, integration, E2E)
  • Building artifacts (Docker images, packages)
  • Deployment to an environment

Example of defining a job in GitLab CI:

# Example of a job for building an application
build_job:
  stage: build # Pipeline stage to which the job belongs
  image: docker:latest # Image used to run the job
  script: # List of commands executed in the job
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker build -t $CI_REGISTRY_IMAGE .
    - docker push $CI_REGISTRY_IMAGE
  tags: # Optional: tags defining on which runners the job will be executed
    - docker-builder