We haven't changed anything in our Jenkinsfile or Fastfile, however all of a sudden we're seeing this in our logs.
invalid object name master~1
It's causing an infinite auto-bump.
We use this function in our Fastffile to check whether or not we should bump the version or not.
def should_bump_version
last_changes = `git diff podspec HEAD~1`
!last_changes.lines.any? { | line | line.start_with?("+") and line.include?("s.version") }
end
With help from colleagues and shout out to Liam Nichols we realized that someone had switched our Jenkins configuration to a shallow clone and that was causing a boolean check to return
truewhen it shouldn't i.e. as soon as we do:it results in the following error being returned to its next line.
It was producing an error because with a shallow clone, the previous commits were not part of the clone. This made
HEAD~1undefined. Hence the error:This caused the
should_bump_versionfunction to incorrectly returntrue. And obviously Jenkins runs on every commit, so we were in an endless loop.We avoided this by setting the shallow clone depth to 5 in our Jenkins configuration. The reason that we initially changed this was that some repo's git clone was huge and this was done to save us some size.