'master' assumed to be the default remote branch

Bug #1083154 reported by Antoine "hashar" Musso
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zuul
Fix Released
Undecided
Antoine "hashar" Musso

Bug Description

Whenever someone has a git repository whose HEAD is not 'master', Zuul is unable to merge changes. The stack trace:

2012-11-26 11:07:37,751 INFO zuul.Scheduler: Adding operations/puppet, <Change 0x26fb790 35135,1> to <Pipeline check>
2012-11-26 11:07:37,998 ERROR zuul.Merger: Unable to reset repo <zuul.merger.Repo object at 0x1e2bbd0>
Traceback (most recent call last):
  File "zuul-0.0.131.fa64436-py2.7.egg/zuul/merger.py", line 144, in mergeChanges
    repo.reset()
  File "zuul-0.0.131.fa64436-py2.7.egg/zuul/merger.py", line 57, in reset
    self.repo.head.reference = self.repo.heads.master
  File "/usr/lib/python2.7/dist-packages/git/util.py", line 612, in __getattr__
    return list.__getattribute__(self, attr)
AttributeError: 'IterableList' object has no attribute 'master'
2012-11-26 11:07:37,998 INFO zuul.IndependentPipelineManager: Unable to merge change <Change 0x26fb790 35135,1>

In Repo.reset() of zuul/merger.py :

 self.repo.head.reference = self.repo.heads.master # 'master' hardcoded :/
 self.repo.head.reset(index=True, working_tree=True)
 self.repo.git.clean('-x', '-f', '-d')

Not sure how to fix that one, ideally it should reset to whatever defaut branch is used in remote but I havent found a way to get that information using python-git :(

Revision history for this message
Antoine "hashar" Musso (hashar) wrote :
Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

Python test script:

 from git import *
 repo = Repo( 'path/to/above/repo/clone' )
 print repo.remotes['origin'].refs

[<git.RemoteReference "refs/remotes/origin/production">, <git.RemoteReference "refs/remotes/origin/sandbox/hashar/zuulintegration">, <git.RemoteReference "refs/remotes/origin/test">, <git.RemoteReference "refs/remotes/origin/testlabs/bindir">, <git.RemoteReference "refs/remotes/origin/testlabs/jenkins">, <git.RemoteReference "refs/remotes/origin/testlabs/logmsgbot2">, <git.RemoteReference "refs/remotes/origin/testlabs/roanl10nupdate3">]

No HEAD there :-( Maybe that is our Gerrit installation.

Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

Might just be my local copy, on a server and on a fresh clone by fungi:
cat .git/refs/remotes/origin/HEAD
ref: refs/remotes/origin/production

Revision history for this message
Antoine "hashar" Musso (hashar) wrote :
Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

I have tested the change on a dev box and I am no more receiving the errors. Zuul happily triggers jobs for my repository set with a 'production' branch as HEAD.

Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

Change https://review.openstack.org/17239 has been merged in as commit sha1 f2626eb384b5f29df1ef2c446b49c9bbf7c6a8de

Seems it will be released in the version that follows 1.1.0

Changed in zuul:
status: New → Fix Committed
Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

Fix is included in v1.2.0.

Changed in zuul:
assignee: nobody → Antoine "hashar" Musso (hashar)
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.