Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does circleci checkout pull the latest code from master or the code for the specific commit

Tags:

git

circleci

Hello stackoverflow/circleci gods.

I have been using circleCI for a while now and I have a question about the 'checkout' step which I will do my best to explain. This is a snippet from my circleCI config file (I have a job 'a-job' whose first step is checkout):

a-job:
  docker:
    - image: docker-image-here
  steps:
    - checkout
    ...

My question is, does the circleci step 'checkout' pull the latest code from master or the code for the specific commit.

i.e. does checkout simply git clone master:latest or does it git clone SPECIFIC COMMIT HERE

like image 269
jcgh582 Avatar asked Apr 30 '18 02:04

jcgh582


1 Answers

disclaimer: Developer Evangelist at CircleCI

VonC's answer is incorrect. In CircleCI 2.0 (which is what that config is), the "special step" checkout checks out the current commit. The current commit is the commit that initiated the CI run in the first place.

So whenever you git push to GitHub or Bitbucket, that commit gets built and that's the commit that the checkout step retrieves. In the case where you git push multiple commits at the same time, the most recent commit is the one a build will be started for.

like image 140
FelicianoTech Avatar answered Oct 30 '22 20:10

FelicianoTech