Checkout started to fail from one moment to another (Directory not empty and not git repository)


#1

Hi there.

I had a project running circleci 2.0, with tests and deploy to AWS (based on tags)

On the other day, I’ve also added circleci 2.0 to another project (based on the same account), and basically made a copy from config file, only swapped the cache keys and folder.

Yet, the project #1 build started to fail. It breaks on the checkout code part, giving the error “Directory (/home/circleci/src) you are trying to checkout to is not empty and not git repository”.

I’ve tried to change the folder to another thing, yet, it always gives me the same error.

Here’s my config file from project #1

https://www.pastiebin.com/5b9bcab9f1626

https://www.pastiebin.com/5b9bcae36dc7f

The build on the #2 project works fine, yet, #1 fails always.

I know that the working directory (and cache one) are the same directory on both projects, yet, I’ve tested with random folder names, and it gives me the same error on.

Thanks for the support


#2

I’d expect both of them to fail, to be honest. You’re trying to save/restore ~/src to the cache, and also checkout to it. These strike me as conflicting operations, and you should do one or the other.


#3

Hi there.

Thanks for the answer @halfer. Though, doesn’t seem to be the problem.

I’ve swapped the folders from #2 project to some other randomly, and it still builds without any problem.

Yet, on the #1 project, it keeps to give the same error (Directory (/home/circleci/up-hill/newfolder) you are trying to checkout to is not empty and not git repository)

I’ve disabled the save_cache and restore_cache steps, yet, same error

Here’s the new config: https://pastebin.com/MpZAJfUt

Thanks for the help


#4

Your restore_cache and save_cache are still in your config.


#5

Thanks for the answer @halfer. Yet, that restore_cache and save_cache is only on the deploy job.

Anyway, i’ve removed also removed those restore_cache and save_cache from the deploy job, and it keeps failing on me. (Also swapped to another folder)

Here’s the new config: https://pastebin.com/6XSJ5AE5

Have no clue what else to do to find out what is failing :frowning:


#6

Hmm, ok, more things to try:

  • Put a new run step that does a ls -lR /home/circleci/src before your checkout. It’d be interesting to see what this comes up with
  • I wonder what the real value of “anotherfolder” is here ~/up-hill/anotherfolder. Is there any value in just getting rid of this? I don’t know what value there is in not using the default working dir.
  • Ooh, I just noticed you are doing yarn install before a checkout - does this not need the dependencies file in your repo in order to work?

#7

Hi @halfer.

Thanks for the help… It was yarn install that was bugging it out. Strange that it wasn’t previously. Might have changed something during some process…

Thanks!