12

Circle CI has a "config.yml" file. This file contains the configuration and it contains the steps in a job. There is a "checkout" included in the steps of the config.yml. what does the "checkout" do?

This is a how a basic sample config for circleci look like:

version: 2
jobs:
  build:
    docker:
      - image: alpine:3.7
    steps:
      - checkout
      - run:
          name: The First Step
          command: |
            echo 'Hello World!'

2 Answers2

5

What does the "checkout" do? Special step used to check out source code to the configured path (defaults to the working_directory). The reason this is a special step is because it is more of a helper function designed to make checking out code easy for you.

Additional Info: https://circleci.com/docs/2.0/configuration-reference/#checkout In the case of checkout, the step type is just a string with no additional attributes: - checkout

  • 16
    Yes. It's basically a `git clone` of your code from your VCS provider into your primary container or VM. – FelicianoTech Sep 26 '19 at 03:38
  • @FelicianoTech can u briefly explain what happened if i skip this step? – Sam Kah Chiin Jun 04 '21 at 10:26
  • 3
    @SamKahChiin Sure. Without the checkout step, CircleCI doesn't have your code. Without the code, it can't do anything that it's suppose to do. For example, CircleCI won't be able to run your tests, compile your code, or deploy your code. – FelicianoTech Jun 05 '21 at 03:58
0

In short: In order for you CI/CD workflow to do something with your code, it needs to get the code first. Checkout does that. It gets the code from your repo so that it can get all files and perform things you are asking it to do.

ashraf minhaj
  • 504
  • 2
  • 14