'Creates a release branch and pushes tags to the microservice repos owned by --github_publisher.
A private key that has access to --github_publisher\'s github repos needs added
to a running ssh-agent on the machine this script will run on:
> <copy or rsync the key to the vm>
> eval `ssh-agent`
> ssh-add ~/.ssh/<key with access to github repos>'

def push_branch_and_tags(self):

    (major, minor, _) = self.__release_version.split('.')
    stable_branch = format_stable_branch(major, minor)
    for comp in COMPONENTS:
        comp_path = os.path.join(self.base_dir, comp)
        if self.__patch_release:
            check_run_quick('git    -C    {0}    checkout    {1}'.format(comp_path, stable_branch))
        else:
            check_run_quick('git    -C    {0}    checkout    -b    {1}'.format(comp_path, stable_branch))
        version_tag_build = ''
        if (comp == 'spinnaker-monitoring'):
            version_tag_build = 'version-{0}'.format(self.__bom_dict[SERVICES]['monitoring-daemon'][VERSION])
        else:
            version_tag_build = 'version-{0}'.format(self.__bom_dict[SERVICES][comp][VERSION])
        last_dash = version_tag_build.rindex('-')
        version_tag = version_tag_build[:last_dash]
        repo_to_push = 'git@github.com:{owner}/{comp}.git'.format(owner=self.__github_publisher, comp=comp)
        check_run_quick('git    -C    {comp}    remote    add    release    {url}'.format(comp=comp_path, url=repo_to_push))
        check_run_quick('git    -C    {comp}    push    release    {branch}'.format(comp=comp_path, branch=stable_branch))
        repo = self.__github.get_repo('{owner}/{comp}'.format(owner=self.__github_publisher, comp=comp))
        paginated_tags = repo.get_tags()
        tag_names = [tag.name for tag in paginated_tags]
        if (version_tag not in tag_names):
            print 'pushing    version    tag    {tag}    to    {owner}/{comp}'.format(tag=version_tag, owner=self.__github_publisher, comp=comp)
            check_run_quick('git    -C    {comp}    push    release    {tag}'.format(comp=comp_path, tag=version_tag))
        check_run_quick('git    -C    {comp}    remote    remove    release'.format(comp=comp_path))
