I am facing an issue where the version of circle.yml used by the build is intermittently switching between 1 and 2. I have made multiple changes to circle.yml. Once some changes made in circle.yml caused the version to change from 2 to 1, I reverted them all one by one and reached the exact same contents of circle.yml file but the build continues to used version 1 now. I also changed the file by taking exactly the old file from the VCS to avoid whitespace / formatting issues. Still I see the same file of circle.yml has triggered version 1 and 2 in different cases.
It seems there is some caching of the circle.yml file causing the intermittentness.
I cannot share the code snippets since my repository is supposed to be private but I will add below observation and steps to reproduce.
The build was working when I added circle.yml file to root of my repo. It was taking version 2 when I add workflows section instead of the version 1 type steps and then again using version 1 when I commented the workflows part. After that I changed circle.yml to point to existing version 2 config file (.circleci/config.yml). Since this point the build has stopped finding my circle.yml file at all. Even After removing softlink and adding the actual file and commiting it is not making circle ready the circle.yml file. Across all these changes the version 2 specific .circleci/config.yml is sitting unchanged in my repo and is not being seen by circle at all.
The issue was with how git tracks the softlink. Git saw changing file to softlink as type change. Reverting to normal file as a normal text change in a text file. Hence the file was not being read at all.