Closed Bug 1139066 Opened 11 years ago Closed 11 years ago

Support for git gecko repos

Categories

(Release Engineering :: Applications: MozharnessCore, defect, P1)

x86_64
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wcosta, Assigned: wcosta)

References

Details

Attachments

(2 files, 2 obsolete files)

Today, mozharness can only download configs from mercurial remotes.
Attached file MozReview Request: bz://1139066/wcosta (obsolete) —
/r/4623 - [PATCH 1/2] Bug 1139066 part 1: Use tc-vcs checkout command. /r/4625 - [PATCH 2/2] Bug 1139066 part 2: Add support to download configs from git remotes. Pull down these commits: hg pull review -r b36bf949fca309ea8314676ec47a040cb350043a
Attachment #8572351 - Flags: review?(sphink)
Attachment #8572351 - Flags: review?(jlund)
Attachment #8572351 - Flags: review?(jlal)
Comment on attachment 8572351 [details] MozReview Request: bz://1139066/wcosta vague r+ from me ... I only know some of these bits well. I am somewhat sad we end up duplicating this logic between tc-vcs and mozharness but I am not sure how to unify them yet.
Attachment #8572351 - Flags: review?(jlal) → review+
Comment on attachment 8572351 [details] MozReview Request: bz://1139066/wcosta https://reviewboard.mozilla.org/r/4621/#review3853 this looks pretty good to me. Again I'm leaning on jlal for the correct behaviour logic for tcvcs since all of mozharness/mozharness/mozilla/building/detect_repo.py is filled with static functions, do not avail of mozharness' logging/configs, and is a copy of another tool outside of mh, I think a more appropriate home is somewhere like mozharness/external_tools/detect_repo.py. what do you think? I'm open to your thoughts. ::: mozharness/base/vcs/tcvcs.py (Diff revision 1) > - > + if revision is None: I think the above c.get('revision', '') should handle the default assignment of an empty string if c['revision'] equates to None. ::: mozharness/base/vcs/tcvcs.py (Diff revision 1) > - branch = c.get('branch') > + branch = c.get('branch', '') do we need branch anymore? were you planning on using it? ::: mozharness/mozilla/building/buildb2gbase.py (Diff revision 1) > - return json.load(open(config_path, "r")) > + return self.retry(self.load_json_from_url, args=(url,)) nice, good call using self.retry
Attachment #8572351 - Flags: review?(jlund)
(In reply to Jordan Lund (:jlund) from comment #3) > Comment on attachment 8572351 [details] > MozReview Request: bz://1139066/wcosta > > https://reviewboard.mozilla.org/r/4621/#review3853 > > this looks pretty good to me. Again I'm leaning on jlal for the correct > behaviour logic for tcvcs > > since all of mozharness/mozharness/mozilla/building/detect_repo.py is filled > with static functions, do not avail of mozharness' logging/configs, and is a > copy of another tool outside of mh, I think a more appropriate home is > somewhere like mozharness/external_tools/detect_repo.py. what do you think? > I'm open to your thoughts. > Sure, I am going to move this module to there. > ::: mozharness/base/vcs/tcvcs.py > (Diff revision 1) > > - > > + if revision is None: > > I think the above c.get('revision', '') should handle the default assignment > of an empty string if c['revision'] equates to None. > The current behavior of query_revision() is to return None if it fails. mozharness try to query the local repo revision, and if the repo doesn't exist, it will return None and this value will be assigned to config['revision']. So, c['revision'] will be found with value None, and None will be returned. That's why the if is necessary. I could change the query_revision() behavior to return an empty string, but I was afraid to break other stuff. > ::: mozharness/base/vcs/tcvcs.py > (Diff revision 1) > > - branch = c.get('branch') > > + branch = c.get('branch', '') > > do we need branch anymore? were you planning on using it? > Ops, I forgot that. > ::: mozharness/mozilla/building/buildb2gbase.py > (Diff revision 1) > > - return json.load(open(config_path, "r")) > > + return self.retry(self.load_json_from_url, args=(url,)) > > nice, good call using self.retry
Attached file MozReview Request: bz://1139066/wcosta (obsolete) —
/r/4773 - Bug 1139066 part 1: Use tc-vcs checkout command. /r/4775 - Bug 1139066 part 2: Add support to download configs from git remotes. Pull down these commits: hg pull review -r 6c5144bd4c38257376aa9303d5f233ab2a9aa9ac
Attachment #8573285 - Flags: review?(sphink)
Attachment #8573285 - Flags: review?(jlund)
Attachment #8572351 - Flags: review+ → review?(jlund)
Comment on attachment 8572351 [details] MozReview Request: bz://1139066/wcosta /r/4623 - Bug 1139066 part 1: Use tc-vcs checkout command. /r/4625 - Bug 1139066 part 2: Add support to download configs from git remotes. Pull down these commits: hg pull review -r 6c5144bd4c38257376aa9303d5f233ab2a9aa9ac
Attachment #8573285 - Attachment is obsolete: true
Attachment #8573285 - Flags: review?(sphink)
Attachment #8573285 - Flags: review?(jlund)
Comment on attachment 8572351 [details] MozReview Request: bz://1139066/wcosta https://reviewboard.mozilla.org/r/4621/#review3921 ::: mozharness/mozilla/building/buildb2gbase.py (Diff revision 2) > +sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', 'external_tools')) so I think we already: sys.path.insert(1, os.path.dirname(sys.path[0])) hence why we can do things like: from mozharness.base.log import WARNING This makes me think we don't need to modify the path further and instead just do: from external_tools.detect_repo import foo, bar If I'm right, I don't think that's a blocker to you landing but just an fyi
Attachment #8572351 - Flags: review?(jlund)
So, c['revision'] will be found with value None, and > None will be returned. That's why the if is necessary. I could change the > query_revision() behavior to return an empty string, but I was afraid to > break other stuff. makes sense
Comment on attachment 8572351 [details] MozReview Request: bz://1139066/wcosta https://reviewboard.mozilla.org/r/4621/#review3923 lgtm :) how much of this have you tested?
Attachment #8572351 - Flags: review+
(In reply to Jordan Lund (:jlund) from comment #9) > Comment on attachment 8572351 [details] > MozReview Request: bz://1139066/wcosta > > https://reviewboard.mozilla.org/r/4621/#review3923 > > lgtm :) how much of this have you tested? I have tried combinations of local and taskcluster builds with git and hg repositories. Any further test I can perform to avoid breaking existing stuff?
(In reply to Jordan Lund (:jlund) from comment #7) > Comment on attachment 8572351 [details] > MozReview Request: bz://1139066/wcosta > > https://reviewboard.mozilla.org/r/4621/#review3921 > > ::: mozharness/mozilla/building/buildb2gbase.py > (Diff revision 2) > > +sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', 'external_tools')) > > so I think we already: > sys.path.insert(1, os.path.dirname(sys.path[0])) > > hence why we can do things like: > from mozharness.base.log import WARNING > > This makes me think we don't need to modify the path further and instead > just do: > from external_tools.detect_repo import foo, bar > > If I'm right, I don't think that's a blocker to you landing but just an fyi Makes sense, I will update the patch.
Comment on attachment 8572351 [details] MozReview Request: bz://1139066/wcosta /r/4623 - Bug 1139066 part 1: Use tc-vcs checkout command. /r/4625 - Bug 1139066 part 2: Add support to download configs from git remotes. Pull down these commits: hg pull review -r 34823757addcf582918913896e604ac9ddd48735
Attachment #8572351 - Flags: review?(sphink)
Attachment #8572351 - Flags: review?(jlund)
Attachment #8572351 - Flags: review+
I updated the patch based on the last comments, plus two small updates: 1) I noticed that a change piece in part 2 actually belongs to part 1 2) The query_gecko_config function was broken for git.m.o, I fixed it.
Comment on attachment 8572351 [details] MozReview Request: bz://1139066/wcosta https://reviewboard.mozilla.org/r/4621/#review3953 Ship It!
Attachment #8572351 - Flags: review?(jlund) → review+
Keywords: checkin-needed
(In reply to Wander Lairson Costa [:wcosta] from comment #10) > (In reply to Jordan Lund (:jlund) from comment #9) > > Comment on attachment 8572351 [details] > > MozReview Request: bz://1139066/wcosta > > > > https://reviewboard.mozilla.org/r/4621/#review3923 > > > > lgtm :) how much of this have you tested? > > I have tried combinations of local and taskcluster builds with git and hg > repositories. Any further test I can perform to avoid breaking existing > stuff? sounds sufficient. I wonder if there will be an odd buildbot issue that I'm not seeing. However, since mh is pinned on each branch, I'm fine with landing this and trying it out. lgtm :)
I'm guessing this must be source of the (nonfatal) AttributeError: 'GitConfig' object has no attribute 'json' I'm seeing here in https://treeherder.mozilla.org/#/jobs?repo=try&revision=97c1a52ce860 : 14:31:53 INFO - Deleting broken projects... 14:31:53 INFO - Running command: ['./repo', 'forall', '-c', 'git show-ref -q --head HEAD || rm -rfv $PWD'] in /builds/slave/b2g_try_l64-b2g-haz_dep-000000/build 14:31:53 INFO - Copy/paste: ./repo forall -c "git show-ref -q --head HEAD || rm -rfv $PWD" 14:31:53 INFO - Traceback (most recent call last): 14:31:53 INFO - File "/builds/slave/b2g_try_l64-b2g-haz_dep-000000/build/.repo/repo/main.py", line 506, in <module> 14:31:53 INFO - _Main(sys.argv[1:]) 14:31:53 INFO - File "/builds/slave/b2g_try_l64-b2g-haz_dep-000000/build/.repo/repo/main.py", line 482, in _Main 14:31:53 INFO - result = repo._Run(argv) or 0 14:31:53 INFO - File "/builds/slave/b2g_try_l64-b2g-haz_dep-000000/build/.repo/repo/main.py", line 161, in _Run 14:31:53 INFO - result = cmd.Execute(copts, cargs) 14:31:53 INFO - File "/builds/git-shared/repo/repo/subcmds/forall.py", line 200, in Execute 14:31:53 INFO - mirror = self.manifest.IsMirror 14:31:53 INFO - File "/builds/git-shared/repo/repo/manifest_xml.py", line 358, in IsMirror 14:31:53 INFO - return self.manifestProject.config.GetBoolean('repo.mirror') 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", line 112, in GetBoolean 14:31:53 INFO - v = self.GetString(name) 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", line 129, in GetString 14:31:53 INFO - v = self._cache[_key(name)] 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", line 246, in _cache 14:31:53 INFO - self._cache_dict = self._Read() 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", line 253, in _Read 14:31:53 INFO - self._SaveJson(d) 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", line 283, in _SaveJson 14:31:53 INFO - if os.path.exists(self.json): 14:31:53 INFO - AttributeError: 'GitConfig' object has no attribute 'json'
(In reply to Steve Fink [:sfink, :s:] from comment #16) > I'm guessing this must be source of the (nonfatal) AttributeError: > 'GitConfig' object has no attribute 'json' I'm seeing here in > https://treeherder.mozilla.org/#/jobs?repo=try&revision=97c1a52ce860 : > > 14:31:53 INFO - Deleting broken projects... > 14:31:53 INFO - Running command: ['./repo', 'forall', '-c', 'git > show-ref -q --head HEAD || rm -rfv $PWD'] in > /builds/slave/b2g_try_l64-b2g-haz_dep-000000/build > 14:31:53 INFO - Copy/paste: ./repo forall -c "git show-ref -q --head > HEAD || rm -rfv $PWD" > 14:31:53 INFO - Traceback (most recent call last): > 14:31:53 INFO - File > "/builds/slave/b2g_try_l64-b2g-haz_dep-000000/build/.repo/repo/main.py", > line 506, in <module> > 14:31:53 INFO - _Main(sys.argv[1:]) > 14:31:53 INFO - File > "/builds/slave/b2g_try_l64-b2g-haz_dep-000000/build/.repo/repo/main.py", > line 482, in _Main > 14:31:53 INFO - result = repo._Run(argv) or 0 > 14:31:53 INFO - File > "/builds/slave/b2g_try_l64-b2g-haz_dep-000000/build/.repo/repo/main.py", > line 161, in _Run > 14:31:53 INFO - result = cmd.Execute(copts, cargs) > 14:31:53 INFO - File > "/builds/git-shared/repo/repo/subcmds/forall.py", line 200, in Execute > 14:31:53 INFO - mirror = self.manifest.IsMirror > 14:31:53 INFO - File "/builds/git-shared/repo/repo/manifest_xml.py", > line 358, in IsMirror > 14:31:53 INFO - return > self.manifestProject.config.GetBoolean('repo.mirror') > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > line 112, in GetBoolean > 14:31:53 INFO - v = self.GetString(name) > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > line 129, in GetString > 14:31:53 INFO - v = self._cache[_key(name)] > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > line 246, in _cache > 14:31:53 INFO - self._cache_dict = self._Read() > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > line 253, in _Read > 14:31:53 INFO - self._SaveJson(d) > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > line 283, in _SaveJson > 14:31:53 INFO - if os.path.exists(self.json): > 14:31:53 INFO - AttributeError: 'GitConfig' object has no attribute > 'json' This happens when you run b2g_build.py in a fresh clone of B2G repo. I tried here and even mozharness master has this error. It then runs config.sh to clone the repos in the manifest file. I ignored because this error looked expect in the code flow.
(In reply to Wander Lairson Costa [:wcosta] from comment #17) > (In reply to Steve Fink [:sfink, :s:] from comment #16) > > I'm guessing this must be source of the (nonfatal) AttributeError: > > 'GitConfig' object has no attribute 'json' I'm seeing here in > > https://treeherder.mozilla.org/#/jobs?repo=try&revision=97c1a52ce860 : > > > > 14:31:53 INFO - Deleting broken projects... > > 14:31:53 INFO - Running command: ['./repo', 'forall', '-c', 'git > > show-ref -q --head HEAD || rm -rfv $PWD'] in > > /builds/slave/b2g_try_l64-b2g-haz_dep-000000/build > > 14:31:53 INFO - Copy/paste: ./repo forall -c "git show-ref -q --head > > HEAD || rm -rfv $PWD" > > 14:31:53 INFO - Traceback (most recent call last): > > 14:31:53 INFO - File > > "/builds/slave/b2g_try_l64-b2g-haz_dep-000000/build/.repo/repo/main.py", > > line 506, in <module> > > 14:31:53 INFO - _Main(sys.argv[1:]) > > 14:31:53 INFO - File > > "/builds/slave/b2g_try_l64-b2g-haz_dep-000000/build/.repo/repo/main.py", > > line 482, in _Main > > 14:31:53 INFO - result = repo._Run(argv) or 0 > > 14:31:53 INFO - File > > "/builds/slave/b2g_try_l64-b2g-haz_dep-000000/build/.repo/repo/main.py", > > line 161, in _Run > > 14:31:53 INFO - result = cmd.Execute(copts, cargs) > > 14:31:53 INFO - File > > "/builds/git-shared/repo/repo/subcmds/forall.py", line 200, in Execute > > 14:31:53 INFO - mirror = self.manifest.IsMirror > > 14:31:53 INFO - File "/builds/git-shared/repo/repo/manifest_xml.py", > > line 358, in IsMirror > > 14:31:53 INFO - return > > self.manifestProject.config.GetBoolean('repo.mirror') > > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > > line 112, in GetBoolean > > 14:31:53 INFO - v = self.GetString(name) > > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > > line 129, in GetString > > 14:31:53 INFO - v = self._cache[_key(name)] > > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > > line 246, in _cache > > 14:31:53 INFO - self._cache_dict = self._Read() > > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > > line 253, in _Read > > 14:31:53 INFO - self._SaveJson(d) > > 14:31:53 INFO - File "/builds/git-shared/repo/repo/git_config.py", > > line 283, in _SaveJson > > 14:31:53 INFO - if os.path.exists(self.json): > > 14:31:53 INFO - AttributeError: 'GitConfig' object has no attribute > > 'json' > > This happens when you run b2g_build.py in a fresh clone of B2G repo. I tried > here and even mozharness master has this error. It then runs config.sh to > clone the repos in the manifest file. I ignored because this error looked > expect in the code flow. I went a bit further into this, and it feels like the problem is that "repo forall" is called before "repo init". If I understood the code piece correctly [1], this behavior is expected. Is this a blocker to land this bug? [1] https://github.com/mozilla/build-mozharness/blob/master/mozharness/mozilla/building/buildb2gbase.py#L396-L417
Flags: needinfo?(sphink)
Ops, requested NI from wrong person =p
Flags: needinfo?(sphink)
^sfink
Flags: needinfo?(sphink)
No, I would not block landing for it. It is disturbing, though, since when you click on a clean hazard build on TH it shows an error message. But that's not the end of the world.
Flags: needinfo?(sphink)
Comment on attachment 8572351 [details] MozReview Request: bz://1139066/wcosta /r/4623 - Bug 1139066 part 1: Use tc-vcs checkout command. /r/4625 - Bug 1139066 part 2: Add support to download configs from git remotes. Pull down these commits: hg pull review -r 14efdd6647b528075dc7cf8ea9366223238da47d
Attachment #8572351 - Flags: review+ → review?(sphink)
According to what we talked on irc, we modified patch 2 to fix 3 problems: - Remove the braino "if True:" - Make the patches pyflakes clean - Make query_revision return None when the local repository doesn't exist.
Can the bug be closed?
Flags: needinfo?(coop)
(In reply to Wander Lairson Costa [:wcosta] from comment #28) > Can the bug be closed? That depends. If the trees you care about have in-tree pinning for mozharness, you will need to update the revision they point to if you have not already done so. Otherwise, yes, you can close the bug.
Flags: needinfo?(coop)
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment on attachment 8572351 [details] MozReview Request: bz://1139066/wcosta https://reviewboard.mozilla.org/r/4621/#review8191 Ship It!
Attachment #8572351 - Flags: review?(sphink) → review+
(Sorry for the bug spam; I had just long ago left this one at r?me because I wanted to come back sometime to see if I could understand why reviewboard never marked it r+.)
Attachment #8572351 - Attachment is obsolete: true
Attachment #8619650 - Flags: review+
Attachment #8619651 - Flags: review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: