Cherry-pick of modifications done on release/5.1 to unify way to choose URL/upload_dir based on git describe