Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Unable to checkout external pillar git repo using its git tag #38310
Description of Issue/Question
Unable to checkout external pillar git repo using its git tag. However, using branch names works, and even fetching the repo by its tag works.
This is the format of the ext_pillar configuration used:
The problem seems to happen because in gitfs.py the checkout def in PyGit2 uses target_sha instead of tag_sha when comparing to head_sha (see below).
elif tag_ref in refs: tag_obj = self.repo.revparse_single(tag_ref) if not isinstance(tag_obj, pygit2.Tag): log.error( '%s does not correspond to pygit2.Tag object', tag_ref ) else: try: # If no AttributeError raised, this is an annotated tag tag_sha = tag_obj.target.hex except AttributeError: try: tag_sha = tag_obj.hex except AttributeError: # Shouldn't happen, but could if a future pygit2 # API change breaks things. log.error( 'Unable to resolve %s from %s remote \'%s\' ' 'to either an annotated or non-annotated tag', tag_ref, self.role, self.id, exc_info_on_loglevel=logging.DEBUG ) return None if head_sha != target_sha: if not _perform_checkout(local_ref, branch=False): return None # Return the relative root, if present return self.check_root()
This portion of code is present since v2015.8.0.
@Ch3LL I closed the PR since it didn't fully fix the problem. Also, after rebasing with 2016.3, I'm encountering an issue where the external pillar attempts to checkout before fetching, resulting in a failed checkout. My fix seems to work based on 2015.8 though. I'll try to create some containers showing these behaviours.