Skip cache:clear if user wants to explicitly skip it
On every triggered database migration or a change in gitlab.yml we trigger rake cache:clear
task.
This task clears all Redis cache. Due to the way we are caching, not clearing the cache can have unintended consequences when loading a newly deployed version of GitLab. Users might see links that no longer exist and similar.
Running rake cache:clear
loads the whole rails environment so running that task is expensive. It is especially expensive on large instances with a lot of redis data.
For this reason we should provide an option to skip the cache clear. This task should still run by default, but if someone wants to disable it explicitly they should be able to do so.
Related to https://dev.gitlab.org/gitlab/organization/issues/1082#note_93545 and https://gitlab.com/gitlab-com/infrastructure/issues/903